• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/43

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

43 Cards in this Set

  • Front
  • Back

jobs

to see what jobs are running in the background and to check on their status.

&

Add to the end of a command to run the command in the background.


cut -d: -f1 /etc/passwd | sort | lp

output the first field of the /etc/passwd file delimited by a :. Then, sort the out put, and after, send the contents to the printer.

cat < file1 > file2

this will act similarly to the "cp file1 file2" command if the "cp" is not working properly or is broken.


uname -a

to see all of the contents about the kernel and the OS

sed '/^$/d' file1 > file2

to delete all of the blank lines within a given file.

ls -l $(which cp)

to see all the long output for the "cp" command. Permissions, owner, group, size, creation date, location etc...

echo $(ls)

to output the "ls" command as an expression.

echo {A..Z}


echo Number_{1..5}


echo a{A{1,2},B{3,4}}b


echo mkdir {2007..2009}-0{1..9}{2007..2009}-{10..12}

A through Z, Number_1 through 5, aA1b aA2b aB3b aB4b, make a bunch or directories.

diff



diff file2.txt file1.txt.old > txtdiff &

Examines two files then outputs the differences to standard out.

"Background Jobs"

Output might be intertwined with other command output. Just because I run concurrent commands in the background doesn't mean they will execute faster. It might actually be a bit slower.

nice

This will cause the command to run at lower priority when executed, which means it will be give less resources as well. Give a lower priority by adding a numerical value to the command. Quote complex commands that follow the nice command.

(


)

Start and end a sub shell

{


}

Start and end a command block

'

Strong quote will treat everything, including the special characters, as text.

"

Weak quote will treat some of the special characters within the quotes as special characters.

?

single character wild card

!

Not what ever comes next in the set

\ or backslash-escaping

to change the meaning of a character. Fore example, if you are looking for a ! in a document you can precede it with a \!

find . -name some-string


find . -name '*.c'

- will search the directory that you are in for a given string. You can also search by user, file size, date last accessed, etc.



- Will search the current directory and sub sub ... for all files ending in .c

Ctrl-m

Acts the same as Enter.

stty or stty all

Check the key binds on Linux and BSD/Unix based systems


ctrl-\

Can be used if ctrl-c doesn't work

ctrl-u

Delete an entire command from the end of the the line. Or from the beginning of the line to the cursor location

fc

Fix command, I can alter a command using a text editor. Then, exit the editor and use then command in the terminal.

ctrl-p


ctrl-n


esc->

- Go back through history


- Go to the last command entered


- " "

ctrl-r

Will a reverse-i-search. I can then start typing something in the previous command and it will populate on the line.



Pressing ctrl-r again will search for the next occurrence etc etc.



If I have already done a search, hitting ctrl-r twice will go to the first string that I typed in History

export PATH=$PATH:what/you/wanttoadd/to/the/path

Adding something to you PATH env variable. Depending upon where the : is will determine if the added the end or the beginning of your path.

cd ~username

to go to the home directory of a particular user.

esc /

This command will complete only file names

esc-c


esc-u


esc-l


esc-.

- Capitalize word after point


- Change word after point to all capital


- Change word after point to all lower


- Insert last word in previous command line after point.

!n


! string


!? string


^ string1^string2

- If you remember the line number of the command you are looking for.


- Refers to the most resent command starting with "string"


- The most resent command ending in string


- Repeat the last command, replacing string1 with stirng2

Word designators:



0


n


^


$


- Zeroth (first) word in a line


- The nth word in a line


- The first argument (the second word)


- The last argument in a line

Designators Cont...



%


x-y


*


x*


x-

- The word matched by the most recent ?string search


- A range of words from x to y. -y is synonymous with 0-y


- All words but the zeroth; synonymous with 1-$.; if there is only one word on the line, an empty string is returned.


- Synonymous with x-$


- The words from x to the second to las word

word designator : event designator



!!:0

Repeat the previous command with different arguments by typing !!:0 followed by the new arguments

Modifiers (can follow designators, multiple modifiers can be used separated by a :)



h


r


e


t


- Removes a trailing pathname component, leaving the head.


- Removes the trailing suffix of a form .xxx


- Removes all but the trailing suffix


- Removes all leading pathname components, leaving the tail.

Modifiers cont...



p


q


x


s/old/new/

- Prints the resulting command but doesn't execute it.


- Quotes the substituted words, escaping further substitutions.


- Quotes the substituted words, breaking them into words at blanks and newlines


- Substitute the new with the old.

Options:



noclobber

- The - turns the option on and the + turns it off. "set -o <option> -"



- Want let you > to existing file

shopt

- used for editing environmental variables, vary similar to options.


-s to turn on


-u to turn off


Shell Variables

- varname=value


- Must be all caps


- If the value is more than one word must be in quotes


- "$aaa" if there are added spaces in the string that way bash will treat it like one word.


HISTCMD


HISTFILESIZE


HISTSIZE


HISTCONTROL


HISTIGNORE


HISTTIMEFORMAT

-


-


-


- can use to control what shows in history, such as excluding cmds starting with spaces and repeated commands. ignorespace, ignoreups


- If a pattern is met, it is not recorded in history. & will ignore duplicates.


-

Mail Variables:


MAIL or MAILPATH (list of files)


MAILCHECK


- name of file to check for incoming


- how often to check

command precedence

1. Aliases


2. Key words like function and several others, like if or for.


3. Functions


4. Built-ins like cd and ls


5. Scripts and executables, for which the shell searches in the directories listed in the PATH env var