Shell and Command Line Basics Flashcards

1
Q

internal command

A

command within your shell, part of the shell

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

external command

A

stored as separate binaries, started with a sub-process

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

PATH

A

environment variable storing a list of directories in which commands can be found

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

change PATH variable by editing…

A

shell config file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

required to run programs which don’t exist in PATH

A

complete path of the utility

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

command completion

A

type part of a command or filename and press Tab key for completion
- displays result or possible results

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

history

A
  • record of typed commands
  • stored in /bash_history
  • up and down arrow keys
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

historical search

A
  • ctrl+R to begin a reverse search
  • ctrl+S is a forward search
  • ctrl+G terminate search
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

movement

A
  • ctrl+A start of line
  • ctrl+E end of line
  • ctrl+left or right arrows move by one word
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

delete text

A
  • ctrl+D or delete key deletes character under cursor
  • backspace deletes character to the left of cursor
  • ctrl+K deletes all text from cursor to end of line
  • ctrl+X, backspace deletes all text from cursor to start of line
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

invoke an editor

A
  • ctrl-X, ctrl+E

- launches an editor defined by FCEDIT or EDITOR environment variables

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

main global config files for shell

A
  • ~/.bashrc

- ~/.profile

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

~ directory

A

your home directory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

environment variables

A

value references which can be shared by different programs within an environment

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

set environment variable

A
  • know name of env var
  • use assignment operator (=)
  • export variable
    (i. e. export NNTPSERVER=new.abigisp.com)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

$ identifier

A

identifies a variable (i.e. echo $PATH)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

command env

A

view entire environment of variables

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

command unset

A
  • remove environment variable

- syntax: unset [variableName]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

command man

A
  • text-based system known as man, for manual

- syntax: man [programName]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

less pager

A
  • displays information
  • spacebar to move forward by a page
  • esc followed by V to move back a page
  • arrow keys move up or down line by line
  • / key to search for text
  • q key to exit
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

command info

A
  • info pages which allow hypertext format

- syntax: info [program]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

stream

A

data entity that can be manipulated

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

standard input stream

A

stdin input typically from a keyboard

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

standard output stream

A

stdout, normally displayed on screen

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
standard error stream
- stderr, carry high-priority info such as error messages | - typically sent to stdout
26
> redirection
creates a new file containing stdout, overwriting if necessary
27
>> redirection
appends stdout to existing file, creating if necessary
28
2> redirection
creates a new file containing stderr, overwriting if necessary
29
2>> redirection
appends stderr to existing file, creating if necessary
30
&> redirection
creates a new file containing both stdout and stderr, overwriting if necessary
31
< redirection
sends contents of file as stdin
32
<< redirection
accepts text on following lines as stdin
33
<> redirection
causes specified file to be used for both stdin and stdout
34
stdin number
0
35
stdout number
1
36
sterr number
2
37
null device
/dev/null | potentially usable to discard data
38
tee
splits stdin to diplay on stdout and as many files as specified
39
| operator
pipe
40
piping
redirecting output from one program to the input of another program
41
command cat
- concatenate files linking them together end to end into one file - typing one file will simply display that file in stdout
42
command expand
convert tabs to spaces
43
fmt command
reformat paragraphs
44
command head
view beginning lines of a file
45
command od
display files in Octal
46
command od
display files in octal (base-8)
47
command sort
sort files
48
command split
break a file into pieces
49
command tr
- translate characters | - syntax: tr [options] set1 set2
50
command uniq
delete duplicate lines
51
command nl
number lines
52
command pr
prepare a plain-text file for printing
53
comman tail
diplays lines at end of file
54
command less
- read a file a screen at a time, paging back and forth through the file - spacebar pages forward - escape+V goes back a page
55
command cut
extract portions of input lines and displat them on stdout
56
command cut
extract portions of input lines and display them on stdout
57
command wc
- displays word count as well as line and byte counts for a file - syntax: wc [fileName]
58
regular expressions
express patterns in text
59
[] regex
match any one character within brackets
60
range regex
variant of bracket, matches any character within a range with a start and end point
61
dot regex
matches any character
62
^ regex
matches the start of a line
63
$ regex
matches the end of a line
64
* regex
matches zero or more occurrences
65
+ regex
matches one or more occurrences
66
| regex
vertical bar matches multiple possibilities (i.e. car|truck)
67
() regex
denote subsection, think order of operations
68
\ regex
escapes following character, literally matching the following character regardless if it is a special character
69
command grep
- search through output | - syntax: grep [options] regexp [files]
70
command sed
- modifying text - syntax: sed [options] -f script-file [input-file] sed [options] script-text [input-file] - script text is the set of commands sed should perform