Basic Linux Commands Flashcards

http://www.cheatography.com/davechild/cheat-sheets/linux-command-line/

1
Q

(Bash Commands) uname -a

A

Show system and kernel

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

(Bash Commands) head -n1 /etc/issue

A

Show distribution

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

(Bash Commands) mount

A

Show mounted filesystems

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

(Bash Commands) date

A

Show system date

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

(Bash Commands) uptime

A

Show uptime

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

(Bash Commands) whoami

A

Show your username

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

(Bash Commands) man commandName

A

Show manual for commandName

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

(Bash Shortcuts) CTRL-c

A

Stop current command

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

(Bash Shortcuts) CTRL-z

A

Sleep program

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

(Bash Shortcuts) CTRL-a

A

Go to start of line

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

(Bash Shortcuts) CTRL-e

A

Go to end of line

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

(Bash Shortcuts) CTRL-u

A

Cut from start of line

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

(Bash Shortcuts) CTRL-k

A

Cut to end of line

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

(Bash Shortcuts) CTRL-r

A

Search history

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

(Bash Shortcuts) !!

A

Repeat last command

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

(Bash Shortcuts) !abc

A

Run last command starting with abc

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

(Bash Shortcuts) !abc:p

A

Print last command starting with abc

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

(Bash Shortcuts) !$

A

Last argument of previous command

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

(Bash Shortcuts) ALT-.

A

Last argument of previous command

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

(Bash Shortcuts) !*

A

All arguments of previous command

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

(Bash Shortcuts) ^abc^123

A

Run previous command, replacing abc with 123

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

(Bash Variables) env

A

Show environment variables

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

(Bash Variables) echo $NAME

A

Output value of $NAME variable

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

(Bash Variables) export NAME=value

A

Set $NAME to value

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
(Bash Variables) $PATH
Executable search path
26
(Bash Variables) $HOME
Home directory
27
(Bash Variables) $SHELL
Current shell
28
(IO Redirection) cmd < file
Input of cmd from file
29
(IO Redirection) cmd1 <(cmd2)
Output of cmd2 as file input to cmd1
30
(IO Redirection) cmd > file
Standard output (stdout) of cmd to file
31
(IO Redirection) cmd > /dev/null
Discard stdout of cmd
32
(IO Redirection) cmd >> file
Append stdout to file
33
(IO Redirection) cmd 2> file
Error output (stderr) of cmd to file
34
(IO Redirection) cmd 1>&2
stdout to same place as stderr
35
(IO Redirection) cmd 2>&1
stderr to same place as stdout
36
(IO Redirection) cmd &> file
Every output of cmd to file
37
(Pipes) cmd1 | cmd2
stdout of cmd1 to cmd2
38
(Pipes) cmd1 |& cmd2
stderr of cmd1 to cmd2
39
(Command Lists) cmd1 ; cmd2
Run cmd1 then cmd2
40
(Command Lists) cmd1 && cmd2
Run cmd2 if cmd1 is successful
41
(Command Lists) cmd1 || cmd2
Run cmd2 if cmd1 is not successful
42
(Command Lists) cmd &
Run cmd in a subshell
43
(Directory Operations) pwd
Show current directory
44
(Directory Operations) mkdir directoryName
Make directory directoryName
45
(Directory Operations) cd directoryName
Change directory to directoryName
46
(Directory Operations) cd ..
Go up a directory
47
(Directory Operations) ls
List files
48
(ls Options) -a
Show all (including hidden)
49
(ls Options) -R
Recursive list
50
(ls Options) -r
Reverse order
51
(ls Options) -t
Sort by last modified
52
(ls Options) -S
Sort by file size
53
(ls Options) -l
Long listing format
54
(ls Options) -1
One file per line
55
(ls Options) -m
Comma-separated output
56
(ls Options) -Q
Quoted output
57
(Search Files) grep pattern files
Search for pattern in files
58
(Search Files) grep -i
Case insensitive search
59
(Search Files) grep -r
Recursive search
60
(Search Files) grep -v
Inverted search
61
(Search Files) grep -o
Show matched part of file only
62
(Search Files) find /dir/ -name name*
Find files starting with name in dir
63
(Search Files) find /dir/ -user name
Find files owned by name in dir
64
(Search Files) find /dir/ -mmin num
Find files modifed less than num minutes ago in dir
65
(Search Files) whereis command
Find binary / source / manual for command
66
(Search Files) locate file
Find file (quick search of system index)
67
(File Operations) touch file1
Create file1
68
(File Operations) cat file1 file2
Concatenate files and output
69
(File Operations) less file1
View and paginate file1
70
(File Operations) file file1
Get type of file1
71
(File Operations) cp file1 file2
Copy file1 to file2
72
(File Operations) mv file1 file2
Move file1 to file2
73
(File Operations) rm file1
Delete file1
74
(File Operations) head file1
Show first 10 lines of file1
75
(File Operations) tail file1
Show last 10 lines of file1
76
(File Operations) tail -f file1
Output last lines of file1 as it changes
77
(Process Management) ps
Show snapshot of processes
78
(Process Management) top
Show real time processes
79
(Process Management) kill pid
Kill process with id pid
80
(Process Management) pkill name
Kill process with name name
81
(Process Management) killall name
Kill all processes with names beginning name
82
(File Permissions) chmod 775 file
Change mode of file to 775
83
(File Permissions) chmod -R 600 folder
Recursively chmod folder to 600
84
(File Permissions) chown user:group file
Change file owner to user and group to group
85
(File Permission Numbers) What does the first digit stands for (e.g. in chmod 775)
It is the owner permission
86
(File Permission Numbers) What does the second digit stands for (e.g. in chmod 775)
It is the group
87
(File Permission Numbers) What does the second digit stands for (e.g. in chmod 775)
It is for everyone.
88
(File Permission Numbers) How do you get the meaning of each digit? (e.g. in chmod 775)
Calculate each of the three permission digits by adding the numeric values of the permissions. 4: read (r), 2: write (w), 1: execute (x)
89
(File Permission Numbers) What does 765 means?
The owner permission is 7 (=4+2+1), so rwx. The group permission is 6 (=4+2), so rw-. Everyone is 5 (=4+1), so r-x.
90
Show system and kernel
(Bash Commands) uname -a
91
Show distribution
(Bash Commands) head -n1 /etc/issue
92
Show mounted filesystems
(Bash Commands) mount
93
Show system date
(Bash Commands) date
94
Show uptime
(Bash Commands) uptime
95
Show your username
(Bash Commands) whoami
96
Show manual for commandName
(Bash Commands) man commandName
97
Stop current command
(Bash Shortcuts) CTRL-c
98
Sleep program
(Bash Shortcuts) CTRL-z
99
Go to start of line
(Bash Shortcuts) CTRL-a
100
Go to end of line
(Bash Shortcuts) CTRL-e
101
Cut from start of line
(Bash Shortcuts) CTRL-u
102
Cut to end of line
(Bash Shortcuts) CTRL-k
103
Search history
(Bash Shortcuts) CTRL-r
104
Repeat last command
(Bash Shortcuts) !!
105
Run last command starting with abc
(Bash Shortcuts) !abc
106
Print last command starting with abc
(Bash Shortcuts) !abc:p
107
Last argument of previous command
(Bash Shortcuts) !$
108
Last argument of previous command
(Bash Shortcuts) ALT-.
109
All arguments of previous command
(Bash Shortcuts) !*
110
Run previous command, replacing abc with 123
(Bash Shortcuts) ^abc^123
111
Show environment variables
(Bash Variables) env
112
Output value of $NAME variable
(Bash Variables) echo $NAME
113
Set $NAME to value
(Bash Variables) export NAME=value
114
Executable search path
(Bash Variables) $PATH
115
Home directory
(Bash Variables) $HOME
116
Current shell
(Bash Variables) $SHELL
117
Input of cmd from file
(IO Redirection) cmd < file
118
Output of cmd2 as file input to cmd1
(IO Redirection) cmd1 <(cmd2)
119
Standard output (stdout) of cmd to file
(IO Redirection) cmd > file
120
Discard stdout of cmd
(IO Redirection) cmd > /dev/null
121
Append stdout to file
(IO Redirection) cmd >> file
122
Error output (stderr) of cmd to file
(IO Redirection) cmd 2> file
123
stdout to same place as stderr
(IO Redirection) cmd 1>&2
124
stderr to same place as stdout
(IO Redirection) cmd 2>&1
125
Every output of cmd to file
(IO Redirection) cmd &> file
126
stdout of cmd1 to cmd2
(Pipes) cmd1 | cmd2
127
stderr of cmd1 to cmd2
(Pipes) cmd1 |& cmd2
128
Run cmd1 then cmd2
(Command Lists) cmd1 ; cmd2
129
Run cmd2 if cmd1 is successful
(Command Lists) cmd1 && cmd2
130
Run cmd2 if cmd1 is not successful
(Command Lists) cmd1 || cmd2
131
Run cmd in a subshell
(Command Lists) cmd &
132
Show current directory
(Directory Operations) pwd
133
Make directory directoryName
(Directory Operations) mkdir directoryName
134
Change directory to directoryName
(Directory Operations) cd directoryName
135
Go up a directory
(Directory Operations) cd ..
136
List files
(Directory Operations) ls
137
Show all (including hidden)
(ls Options) -a
138
Recursive list
(ls Options) -R
139
Reverse order
(ls Options) -r
140
Sort by last modified
(ls Options) -t
141
Sort by file size
(ls Options) -S
142
Long listing format
(ls Options) -l
143
One file per line
(ls Options) -1
144
Comma-separated output
(ls Options) -m
145
Quoted output
(ls Options) -Q
146
Search for pattern in files
(Search Files) grep pattern files
147
Case insensitive search
(Search Files) grep -i
148
Recursive search
(Search Files) grep -r
149
Inverted search
(Search Files) grep -v
150
Show matched part of file only
(Search Files) grep -o
151
Find files starting with name in dir
(Search Files) find /dir/ -name name*
152
Find files owned by name in dir
(Search Files) find /dir/ -user name
153
Find files modifed less than num minutes ago in dir
(Search Files) find /dir/ -mmin num
154
Find binary / source / manual for command
(Search Files) whereis command
155
Find file (quick search of system index)
(Search Files) locate file
156
Create file1
(File Operations) touch file1
157
Concatenate files and output
(File Operations) cat file1 file2
158
View and paginate file1
(File Operations) less file1
159
Get type of file1
(File Operations) file file1
160
Copy file1 to file2
(File Operations) cp file1 file2
161
Move file1 to file2
(File Operations) mv file1 file2
162
Delete file1
(File Operations) rm file1
163
Show first 10 lines of file1
(File Operations) head file1
164
Show last 10 lines of file1
(File Operations) tail file1
165
Output last lines of file1 as it changes
(File Operations) tail -f file1
166
Show snapshot of processes
(Process Management) ps
167
Show real time processes
(Process Management) top
168
Kill process with id pid
(Process Management) kill pid
169
Kill process with name name
(Process Management) pkill name
170
Kill all processes with names beginning name
(Process Management) killall name
171
Change mode of file to 775
(File Permissions) chmod 775 file
172
Recursively chmod folder to 600
(File Permissions) chmod -R 600 folder
173
Change file owner to user and group to group
(File Permissions) chown user:group file
174
It is the owner permission
(File Permission Numbers) What does the first digit stands for (e.g. in chmod 775)
175
It is the group
(File Permission Numbers) What does the second digit stands for (e.g. in chmod 775)
176
It is for everyone.
(File Permission Numbers) What does the second digit stands for (e.g. in chmod 775)
177
Calculate each of the three permission digits by adding the numeric values of the permissions. 4: read (r), 2: write (w), 1: execute (x)
(File Permission Numbers) How do you get the meaning of each digit? (e.g. in chmod 775)
178
The owner permission is 7 (=4+2+1), so rwx. The group permission is 6 (=4+2), so rw-. Everyone is 5 (=4+1), so r-x.
(File Permission Numbers) What does 765 means?