bash - bash38-end Flashcards

1
Q

/dev/null

A

The permanently empty file

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

touch «filepath»

A

Create an empty file at «filepath», or update its modification time

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

date

A

Print the current date and time

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

file «filepath»

A

Print the type of file at «filepath»

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

command 2> «filepath»

A

Run «command», sending stderr to «filepath»

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

command &> «filepath»

A

Run «command», sending stdout and stderr to «filepath»

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

kill -9 «pid»

A

Kill the process with ID «pid»

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

make «target»

A

Build the target «target» using the Makefile in the current directory

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

history

A

Print the command history

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

«name»=«value»

A

Set the shell variable «name» to «value»

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

A

Shell quotation that expands variables and interprets some special characters

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

…’

A

Shell quotation that interprets everything literally

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

...

A

Shell quotation that runs the command inside and substitute its output

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

USER

A

The shell environment variable set to the name of the current user

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

HOME

A

The shell environment variable set to the home directory of the current user

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

PATH

A

The shell environment variable set to the directories to search for commands

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

SHELL

A

The shell environment variable set to the path of the current shell

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

PWD

A

The shell environment variable set to the current working directory

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

source «filepath»

A

Execute the commands in «filepath» in the current shell (as if they were typed)

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

$?

A

The exit status of the last command

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

cmd1 ; cmd2

A

Run cmd1, then run cmd2

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

cmd1 && cmd2

A

Run cmd1, then run cmd2 only if cmd1 succeeded

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

cmd1 || cmd2

A

Run cmd1, then run cmd2 only if cmd1 failed

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

[[ «condition» ]]

A

Test if «condition» is true

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
$(...)
Run the command inside and return its output
26
$((...))
Evaluate the arithmetic expression inside
27
$«name»
Substitute the value of the shell variable «name»
28
(cmd)
Run cmd in a subshell
29
“current working directory”
The directory the shell uses as a reference point for relative paths.
30
home directory
What you call the directory where that user's files typically reside.
31
pwd
The command that prints the shell's current working directory
32
ls
The command that prints the contents (files and directories) in the current working directory.
33
ls «dirpath»
The command that prints the contents of the named directory, «dirpath».
34
ls –a
The command to print directory contents including hidden files
35
ls –l
The command to print directory contents in a long, more descriptive format
36
.
The hidden directory that refers to the directory itself
37
..
The hidden directory that refers to a directory's parent directory
38
man «command»
The command to show the “manual page” for «command»
39
mkdir «dirpath»
The command to create a new directory, «dirpath»
40
cd «dirpath»
The command to change the current working directory to «dirpath»
41
~
The user's home directory
42
cp «frompath» «topath»
The command to make a copy of «frompath» as «topath»
43
cp «frompath» «dirpath»
The command to make a copy of a file, «frompath», in another directory, «dirpath»
44
mv «frompath» «topath»
The command to rename (and possibly move) «frompath» as «topath»
45
mv «frompath» «dirpath»
The command to move a file, «frompath», to another directory, «dirpath»
46
rm «filepath»
The command to delete file, «filepath»
47
rm -r «dirpath»
The command to delete a directory, «dirpath», and all its contents.
48
cat «filepath»
The command to print the contents of «filepath»
49
head «filepath»
The command to print the first 10 lines of «filepath»
50
tail «filepath»
The command to print the last 10 lines of «filepath»
51
more «filepath»
The command to print contents of «filepath», one screen at a time.
52
grep «word» «filepath»
Print the lines in «filepath» that contain «word»
53
wc «filepath»
Print the number of lines, words, and characters in «filepath»
54
sort «filepath»
Print the lines of «filepath» sorted in alphabetical order
55
«command» > «topath»
The redirection that causes the stdout of «command» to be stored in the file «topath»
56
«command» < «frompath»
The redirection that causes the stdin of «command» to come from the file «frompath»
57
«command» >> «topath»
The redirection that causes the stdout of «command» to be appended to the file «topath»
58
«fromcommand» | «tocommand»
The redirection that causes the stdout of «command» to be the stdin of the command «tocommand»
59
stdin
The name of the input stream
60
stdout
The name of the output stream
61
stderr
The name of the error stream
62
absolute path
A path the is fully specified from the root directory down.
63
relative path
A path that is relative to the current working directory.
64
/
The root directory OR the character to separate directories in a path.
65
“current working directory”
The directory the shell uses as a reference point for relative paths.
66
home directory
The directory where that user's files typically reside.
67
pwd
The command that prints the shell's current working directory
68
ls
The command that prints the contents (files and directories) in the current working directory.
69
ls «directorypath»
The command that prints the contents of the named directory.
70
ls –a
The command to print directory contents including hidden files
71
ls –l
The command to print directory contents in a long, more descriptive format
72
.
The hidden directory that refers to the directory itself.
73
..
The hidden directory that refers to a directory's parent directory.
74
man «command»
The command “manual page” for a given command
75
cd «directorypath»
The command to change the current working directory to «pathname»
76
~
The user's home directory
77
cp «fromfilepath» «tofilepath»
The command to make a copy of «fromfile» as «tofile»
78
cp «fromfilepath» «directorypath»
The command to make a copy of a file in another directory
79
mv «fromfilepath» «tofilepath»
The command to rename (and possibly move) «fromfilepath» as «tofilepath»
80
mv «fromfilepath» «directorypathpath»
The command to move a file to another directory
81
rm «filepath»
The command to delete file(s).
82
rm -r «directorypath»
The command to delete a directory and all its contents.
83
rmdir «directorypath»
The command to delete an empty directory
84
cat «filepath»
The command to print the contents of the named file
85
head «filepath»
The command to print the first 10 lines of the named file
86
tail «filepath»
The command to print the last 10 lines of the named file
87
more «filepath»
The command to print the named file, one screen at a time.
88
grep «word» «filepath»
Print the lines in a file that contain «word»
89
wc «filepath»
Print the number of lines, words, and characters in the named file.
90
echo «command line»
Print the «command line»
91
sort –n «filepath»
Print the lines of the file sorted in numeric order
92
sort «filepath»
Print the lines of the file sorted in alphabetical order
93
mkdir «directorypath»
The command to create a new directory.