/
unix-linux.json
388 lines (388 loc) · 10.9 KB
/
unix-linux.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
{
"sections": [
{
"title": "File System",
"commands": [
{
"command": "ls",
"description": "list items in current directory"
},
{
"command": "ls -l",
"description": "list items in current directory and show in long format to see perimissions, size, and modification date"
},
{
"command": "ls -a",
"description": "list all items in current directory, including hidden files"
},
{
"command": "ls -F",
"description": "list all items in current directory and show directories with a slash and executables with a star"
},
{
"command": "ls dir",
"description": "list all items in directory dir"
},
{
"command": "cd dir",
"description": "change directory to dir"
},
{
"command": "cd ..",
"description": "go up one directory"
},
{
"command": "cd /",
"description": "go to the root directory"
},
{
"command": "cd ~",
"description": "go to to your home directory"
},
{
"command": "cd -",
"description": "go to the last directory you were just in"
},
{
"command": "pwd",
"description": "show present working directory"
},
{
"command": "mkdir dir",
"description": "make directory dir"
},
{
"command": "rm file",
"description": "remove file"
},
{
"command": "rm -r dir",
"description": "remove directory dir recursively"
},
{
"command": "cp file1 file2",
"description": "copy file1 to file2"
},
{
"command": "cp -r dir1 dir2",
"description": "copy directory dir1 to dir2 recursively"
},
{
"command": "mv file1 file2",
"description": "move (rename) file1 to file2"
},
{
"command": "ln -s file link",
"description": "create symbolic link to file"
},
{
"command": "touch file",
"description": "create or update file"
},
{
"command": "cat file",
"description": "output the contents of file"
},
{
"command": "less file",
"description": "view file with page navigation"
},
{
"command": "head file",
"description": "output the first 10 lines of file"
},
{
"command": "tail file",
"description": "output the last 10 lines of file"
},
{
"command": "tail -f file",
"description": "output the contents of file as it grows, starting with the last 10 lines"
},
{
"command": "vim file",
"description": "edit file"
},
{
"command": "alias name 'command'",
"description": "create an alias for a command"
}
]
},
{
"title": "System",
"commands": [
{
"command": "shutdown",
"description": "shut down machine"
},
{
"command": "reboot",
"description": "restart machine"
},
{
"command": "date",
"description": "show the current date and time"
},
{
"command": "whoami",
"description": "who you are logged in as"
},
{
"command": "finger user",
"description": "display information about user"
},
{
"command": "man command",
"description": "show the manual for command"
},
{
"command": "df",
"description": "show disk usage"
},
{
"command": "du",
"description": "show directory space usage"
},
{
"command": "free",
"description": "show memory and swap usage"
},
{
"command": "whereis app",
"description": "show possible locations of app"
},
{
"command": "which app",
"description": "show which app will be run by default"
}
]
},
{
"title": "Process Management",
"commands": [
{
"command": "ps",
"description": "display your currently active processes"
},
{
"command": "top",
"description": "display all running processes"
},
{
"command": "kill pid",
"description": "kill process id pid"
},
{
"command": "kill -9 pid",
"description": "force kill process id pid"
}
]
},
{
"title": "Permissions",
"commands": [
{
"command": "ls -l",
"description": "list items in current directory and show permissions"
},
{
"command": "chmod ugo file",
"description": "change permissions of file to ugo - u is the user's permissions, g is the group's permissions, and o is everyone else's permissions. The values of u, g, and o can be any number between 0 and 7."
},
{
"command": 7,
"description": "full permissions"
},
{
"command": 6,
"description": "read and write only"
},
{
"command": 5,
"description": "read and execute only"
},
{
"command": 4,
"description": "read only"
},
{
"command": 3,
"description": "write and execute only"
},
{
"command": 2,
"description": "write only"
},
{
"command": 1,
"description": "execute only"
},
{
"command": 0,
"description": "no permissions"
},
{
"command": "chmod 600 file",
"description": "you can read and write - good for files"
},
{
"command": "chmod 700 file",
"description": "you can read, write, and execute - good for scripts"
},
{
"command": "chmod 644 file",
"description": "you can read and write, and everyone else can only read - good for web pages"
},
{
"command": "chmod 755 file",
"description": "you can read, write, and execute, and everyone else can read and execute - good for programs that you want to share"
}
]
},
{
"title": "Networking",
"commands": [
{
"command": "wget file",
"description": "download a file"
},
{
"command": "curl file",
"description": "download a file"
},
{
"command": "scp user@host:file dir",
"description": "secure copy a file from remote server to the dir directory on your machine"
},
{
"command": "scp file user@host:dir",
"description": "secure copy a file from your machine to the dir directory on a remote server"
},
{
"command": "scp -r user@host:dir dir",
"description": "secure copy the directory dir from remote server to the directory dir on your machine"
},
{
"command": "ssh user@host",
"description": "connect to host as user"
},
{
"command": "ssh -p port user@host",
"description": "connect to host on port as user"
},
{
"command": "ssh-copy-id user@host",
"description": "add your key to host for user to enable a keyed or passwordless login"
},
{
"command": "ping host",
"description": "ping host and output results"
},
{
"command": "whois domain",
"description": "get information for domain"
},
{
"command": "dig domain",
"description": "get DNS information for domain"
},
{
"command": "dig -x host",
"description": "reverse lookup host"
},
{
"command": "lsof -i tcp:1337",
"description": "list all processes running on port 1337"
}
]
},
{
"title": "Searching",
"commands": [
{
"command": "grep pattern files",
"description": "search for pattern in files"
},
{
"command": "grep -r pattern dir",
"description": "search recursively for pattern in dir"
},
{
"command": "grep -rn pattern dir",
"description": "search recursively for pattern in dir and show the line number found"
},
{
"command": "grep -r pattern dir --include='*.ext",
"description": "search recursively for pattern in dir and only search in files with .ext extension"
},
{
"command": "command | grep pattern",
"description": "search for pattern in the output of command"
},
{
"command": "find file",
"description": "find all instances of file in real system"
},
{
"command": "locate file",
"description": "find all instances of file using indexed database built from the updatedb command. Much faster than find"
},
{
"command": "sed -i 's/day/night/g' file",
"description": "find all occurrences of day in a file and replace them with night - s means substitude and g means global - sed also supports regular expressions"
}
]
},
{
"title": "Compression",
"commands": [
{
"command": "tar cf file.tar files",
"description": "create a tar named file.tar containing files"
},
{
"command": "tar xf file.tar",
"description": "extract the files from file.tar"
},
{
"command": "tar czf file.tar.gz files",
"description": "create a tar with Gzip compression"
},
{
"command": "tar xzf file.tar.gz",
"description": "extract a tar using Gzip"
},
{
"command": "gzip file",
"description": "compresses file and renames it to file.gz"
},
{
"command": "gzip -d file.gz",
"description": "decompresses file.gz back to file"
}
]
},
{
"title": "Shortcuts ",
"commands": [
{
"command": "ctrl+a",
"description": "move cursor to beginning of line"
},
{
"command": "ctrl+f",
"description": "move cursor to end of line"
},
{
"command": "alt+f",
"description": "move cursor forward 1 word"
},
{
"command": "alt+b",
"description": "move cursor backward 1 word"
}
]
}
]
}