-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.py
392 lines (266 loc) · 6.25 KB
/
index.py
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
389
Live URL: https://aminbiography.github.io/linux/
<h1>Here are some essential Linux commands that every Linux user should know.</h1>
<h2>01: Navigating the File System</h2>
<p>pwd</p>
<p></p>Prints the current working directory.</p>
```
pwd
```
<p>cd <directory></directory></p>
<p>Changes the current directory to <directory>. To go back to the previous directory, use cd -.</p>
```
cd /home/user
```
<p>ls</p>
<p>Lists the files and directories in the current directory. Use ls -l for detailed information and ls -a to include hidden files.</p>
```
ls -l
```
<p>cd ~</p>
<p>Moves to the user's home directory.</p>
```
cd ~
```
<h2>02: Managing Files and Directories</h2>
<p>mkdir <directory></p>
<p>Creates a new directory.</p>
```
mkdir new_folder
```
<p>touch <file></p>
<p>Creates a new empty file or updates the timestamp of an existing file.</p>
```
touch file.txt
```
<p>cp <source> <destination></p>
<p>Copies files or directories. Use -r to copy directories recursively.</p>
```
cp file1.txt file2.txt
```
<p>mv <source> <destination></p>
<p>Moves or renames files and directories.</p>
```
mv file1.txt /home/user/docs/
```
<p>rm <file></p>
<p>Removes a file. Use -r for directories and -f to force remove without prompt.</p>
```
rm file.txt
rm -r folder
```
<h2>03: Viewing and Manipulating Files</h2>
<p>cat <file></p>
<p>Displays the contents of a file.</p>
```
cat file.txt
```
<p>less <file></p>
<p>Allows you to view the contents of a file one screen at a time.</p>
```
less file.txt
```
<p>head <file></p>
<p>Displays the first 10 lines of a file (use -n to specify a different number).</p>
```
head file.txt
```
<p>tail <file></p>
<p>Displays the last 10 lines of a file (use -n for a different number).</p>
```
tail file.txt
```
<p>grep <pattern> <file></p>
<p>Searches for a pattern inside a file.</p>
```
grep "search_text" file.txt
```
<h2>04: File Permissions</h2>
<p>chmod <permissions> <file></p>
<p>Changes the permissions of a file or directory. Use r, w, x for read, write, and execute.</p>
```
chmod 755 script.sh
```
<p>chown <user>:<group> <file></p>
<p>Changes the owner and/or group of a file or directory.</p>
```
chown user:group file.txt
```
<h2>05: Process Management</h2>
<p>ps</p>
<p>Displays the current processes running on the system.</p>
```
ps aux
```
<p>top</p>
<p>Displays system processes and resource usage in real-time.</p>
```
top
```
<p>kill <pid></p>
<p>Terminates a process by its process ID (PID).</p>
```
kill 1234
```
<p>killall <process_name></p>
<p>Terminates all processes with the given name.</p>
```
killall firefox
```
<p>bg</p>
<p>Resumes a paused job in the background.</p>
```
bg
```
<p>fg</p>
<p>Brings a background job to the foreground.</p>
```
fg
```
<h2>06: Disk Usage</h2>
<p>df</p>
<p>Displays disk space usage of file systems.</p>
```
df -h
```
<p>du</p>
<p>Shows disk usage for files and directories.</p>
```
du -sh /path/to/directory
```
<h2>07: Networking</h2>
<p>ping <host></p>
<p>Pings a host (IP or domain) to check network connectivity.</p>
```
ping google.com
```
<p>ifconfig or ip a</p>
<p>Displays network interfaces and their configurations.</p>
```
ifconfig
```
<p>netstat</p>
<p>Displays network connections, routing tables, interface statistics, and more.</p>
```
netstat -tuln
```
<h2>08: Package Management</h2>
<p>apt-get (Debian-based)</p>
<p>Used for package installation, removal, and updates (e.g., on Ubuntu).</p>
```
sudo apt-get update
sudo apt-get install <package>
```
<p>yum (Red Hat-based)</p>
<p>Used for package management in Red Hat-based distributions like CentOS.</p>
```
sudo yum install <package>
```
<p>dnf (Fedora-based)</p>
<p>A newer package manager for Fedora and CentOS.</p>
```
sudo dnf install <package>
```
<h2>09: Searching for Files</h2>
<p>find <directory> -name <filename></p>
<p>Searches for files within a directory hierarchy.</p>
```
find /home/user -name "file.txt"
```
<p>locate <filename></p>
<p>Searches for files using a prebuilt index (faster than find).</p>
```
locate file.txt
```
<h2>10: Archiving and Compression</h2>
<p>tar</p>
<p>Archives files. Use -czf to create a compressed archive and -xzf to extract.</p>
```
tar -czf archive.tar.gz folder
tar -xzf archive.tar.gz
```
<p>gzip</p>
<p>Compresses files using the gzip algorithm.</p>
```
gzip file.txt
```
<p>unzip</p>
<p>Extracts files from a .zip archive.</p>
```
unzip archive.zip
```
<h2>11: User Management</h2>
<p>useradd <username></p>
<p>Adds a new user.</p>
```
sudo useradd newuser
```
<p>passwd <username></p>
<p>Changes the password for a user.</p>
```
sudo passwd newuser
```
<p>whoami</p>
<p>Displays the current logged-in user.</p>
```
whoami
```
<h2>12: System Information</h2>
<p>uname -a</p>
<p>Displays detailed information about the system kernel.</p>
```
uname -a
```
<p>uptime</p>
<p>Shows how long the system has been running, along with the load averages.</p>
```
uptime
```
<p>free</p>
<p>Displays memory usage.</p>
```
free -h
```
<h2>13: Help and Manual Pages</h2>
<p>man <command></p>
<p>Displays the manual page for a command.</p>
```
man ls
```
<p>--help</p>
<p>Provides a brief help message for a command.</p>
```
ls --help
```
<h2>14: Environment Variables</h2>
<p>export <variable_name>=<value></p>
<p>Sets environment variables for the current session. This is useful for configuring paths and settings.</p>
```
export PATH=$PATH:/new/directory/path
```
<p>echo $<variable_name></p>
<p>Displays the value of an environment variable.</p>
```
echo $PATH
```
<h2>15: Viewing and Monitoring System Logs</h2>
<p>dmesg</p>
<p>Displays system messages and logs, often used for troubleshooting hardware and kernel-related issues.</p>
```
dmesg | less
```
<p>journalctl</p>
<p>Views logs collected by systemd (on systems using systemd). Use -xe for more detailed, real-time logs.</p>
```
journalctl -xe
```
<<<<<<< HEAD
# # # Linux # # # ############################################
=======
####################### # # # Linux # # # #####################
>>>>>>> 8a71c4c9a919458095934130b70ae6f05c896a25
# https://www.kali.org/
# Download > https://www.kali.org/get-kali/#kali-platforms
# Live Boot > https://www.kali.org/get-kali/#kali-live
# Kali 2024.3 (64-bit) > Download
# rufus > https://rufus.ie/en/
# https://www.youtube.com/watch?v=ozGmd1Xt_cU