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
Q

standard error stream

A
  • stderr, carry high-priority info such as error messages

- typically sent to stdout

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

> redirection

A

creates a new file containing stdout, overwriting if necessary

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

> > redirection

A

appends stdout to existing file, creating if necessary

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

2> redirection

A

creates a new file containing stderr, overwriting if necessary

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

2» redirection

A

appends stderr to existing file, creating if necessary

30
Q

&> redirection

A

creates a new file containing both stdout and stderr, overwriting if necessary

31
Q

< redirection

A

sends contents of file as stdin

32
Q

&laquo_space;redirection

A

accepts text on following lines as stdin

33
Q

<> redirection

A

causes specified file to be used for both stdin and stdout

34
Q

stdin number

A

0

35
Q

stdout number

A

1

36
Q

sterr number

A

2

37
Q

null device

A

/dev/null

potentially usable to discard data

38
Q

tee

A

splits stdin to diplay on stdout and as many files as specified

39
Q

operator

A

pipe

40
Q

piping

A

redirecting output from one program to the input of another program

41
Q

command cat

A
  • concatenate files linking them together end to end into one file
  • typing one file will simply display that file in stdout
42
Q

command expand

A

convert tabs to spaces

43
Q

fmt command

A

reformat paragraphs

44
Q

command head

A

view beginning lines of a file

45
Q

command od

A

display files in Octal

46
Q

command od

A

display files in octal (base-8)

47
Q

command sort

A

sort files

48
Q

command split

A

break a file into pieces

49
Q

command tr

A
  • translate characters

- syntax: tr [options] set1 set2

50
Q

command uniq

A

delete duplicate lines

51
Q

command nl

A

number lines

52
Q

command pr

A

prepare a plain-text file for printing

53
Q

comman tail

A

diplays lines at end of file

54
Q

command less

A
  • 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
Q

command cut

A

extract portions of input lines and displat them on stdout

56
Q

command cut

A

extract portions of input lines and display them on stdout

57
Q

command wc

A
  • displays word count as well as line and byte counts for a file
  • syntax: wc [fileName]
58
Q

regular expressions

A

express patterns in text

59
Q

[] regex

A

match any one character within brackets

60
Q

range regex

A

variant of bracket, matches any character within a range with a start and end point

61
Q

dot regex

A

matches any character

62
Q

^ regex

A

matches the start of a line

63
Q

$ regex

A

matches the end of a line

64
Q
  • regex
A

matches zero or more occurrences

65
Q

+ regex

A

matches one or more occurrences

66
Q

regex

A

vertical bar matches multiple possibilities (i.e. car|truck)

67
Q

() regex

A

denote subsection, think order of operations

68
Q

\ regex

A

escapes following character, literally matching the following character regardless if it is a special character

69
Q

command grep

A
  • search through output

- syntax: grep [options] regexp [files]

70
Q

command sed

A
  • 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