Repository navigation
Expand file tree
/
Copy pathlinux_commands_db_comprehensive.json
More file actions
4733 lines (4584 loc) · 133 KB
/
Copy pathlinux_commands_db_comprehensive.json
File metadata and controls
4733 lines (4584 loc) · 133 KB
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
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{
"_meta": {
"description": "Comprehensive Linux Commands Database with Educational Content",
"version": "2.0",
"categories": ["file_operations", "text_processing", "system_info", "process_management", "network", "compression", "permissions", "user_management", "disk_management", "package_management"]
},
"command_combinations": {
"find_and_delete": {
"description": "Find and delete files matching a pattern",
"command": "find . -name '*.tmp' -type f -delete",
"explanation": "Searches current directory for .tmp files and deletes them. -type f ensures only files, not directories",
"safer_alternative": "find . -name '*.tmp' -type f -exec rm -i {} \\;",
"tags": ["find", "delete", "cleanup", "combination"]
},
"grep_count_occurrences": {
"description": "Count occurrences of a pattern in files",
"command": "grep -r 'pattern' . | wc -l",
"explanation": "grep searches recursively, wc -l counts the lines (occurrences)",
"tags": ["grep", "wc", "count", "combination"]
},
"list_by_size": {
"description": "List files sorted by size",
"command": "ls -lhS",
"explanation": "-l (long format), -h (human readable sizes), -S (sort by size, largest first)",
"tags": ["ls", "sort", "size"]
},
"list_by_date": {
"description": "List files sorted by modification time",
"command": "ls -lht",
"explanation": "-t sorts by time (newest first), combine with -r for oldest first",
"tags": ["ls", "sort", "date", "time"]
},
"disk_usage_sorted": {
"description": "Show disk usage sorted by size",
"command": "du -sh * | sort -rh",
"explanation": "du shows disk usage, sort -rh sorts reverse (-r) human-readable (-h) numbers",
"tags": ["du", "sort", "disk", "combination"]
},
"find_large_files": {
"description": "Find files larger than 100MB",
"command": "find . -type f -size +100M -exec ls -lh {} \\; | awk '{print $9, $5}'",
"explanation": "Finds large files and displays name with size in human-readable format",
"tags": ["find", "size", "large files", "combination"]
},
"count_files_by_extension": {
"description": "Count files grouped by extension",
"command": "find . -type f | sed 's/.*\\.//' | sort | uniq -c | sort -rn",
"explanation": "Extracts extensions, sorts, counts unique ones, and sorts by frequency",
"tags": ["find", "sed", "uniq", "count", "combination"]
},
"monitor_log_file": {
"description": "Monitor log file in real-time",
"command": "tail -f /var/log/syslog",
"explanation": "-f follows the file, showing new lines as they're added. Press Ctrl+C to stop",
"tags": ["tail", "log", "monitor", "realtime"]
},
"search_and_replace_files": {
"description": "Search and replace text in multiple files",
"command": "find . -type f -name '*.txt' -exec sed -i 's/old/new/g' {} +",
"explanation": "Finds .txt files and replaces old with new in-place. Remove -i to preview first",
"safer_alternative": "find . -type f -name '*.txt' -exec sed 's/old/new/g' {} +",
"tags": ["find", "sed", "replace", "combination"]
},
"top_processes_by_memory": {
"description": "Show top 10 processes using most memory",
"command": "ps aux --sort=-%mem | head -11",
"explanation": "Lists processes sorted by memory usage, head shows top 10 (11 includes header)",
"tags": ["ps", "memory", "sort", "combination"]
},
"top_processes_by_cpu": {
"description": "Show top 10 processes using most CPU",
"command": "ps aux --sort=-%cpu | head -11",
"explanation": "Lists processes sorted by CPU usage (descending)",
"tags": ["ps", "cpu", "sort", "combination"]
},
"find_listening_ports": {
"description": "Find all listening network ports",
"command": "netstat -tuln | grep LISTEN",
"explanation": "-t (TCP), -u (UDP), -l (listening), -n (numeric), grep filters listening ports",
"alternative": "ss -tuln | grep LISTEN",
"tags": ["netstat", "ss", "port", "network", "combination"]
},
"check_port_usage": {
"description": "Check what's using a specific port",
"command": "lsof -i :8080",
"explanation": "Shows process using port 8080. May need sudo for all processes",
"tags": ["lsof", "port", "network"]
},
"archive_directory": {
"description": "Create compressed archive of directory",
"command": "tar -czf archive.tar.gz /path/to/directory",
"explanation": "-c (create), -z (gzip), -f (file). Use -j for bzip2, -J for xz compression",
"tags": ["tar", "compress", "archive", "backup"]
},
"extract_archive": {
"description": "Extract compressed archive",
"command": "tar -xzf archive.tar.gz",
"explanation": "-x (extract), -z (gzip), -f (file). tar auto-detects compression type",
"tags": ["tar", "extract", "decompress"]
},
"find_recently_modified": {
"description": "Find files modified in last 24 hours",
"command": "find . -type f -mtime -1",
"explanation": "-mtime -1 means less than 1 day ago. Use -mmin -60 for last 60 minutes",
"tags": ["find", "modified", "recent", "time"]
},
"disk_space_by_directory": {
"description": "Show disk usage for each directory",
"command": "du -h --max-depth=1 | sort -rh",
"explanation": "Shows size of immediate subdirectories, sorted largest first",
"tags": ["du", "disk", "directory", "sort", "combination"]
},
"count_lines_in_files": {
"description": "Count total lines across all files",
"command": "find . -type f -name '*.py' -exec wc -l {} + | tail -1",
"explanation": "Counts lines in all Python files, tail shows total",
"tags": ["find", "wc", "count", "lines", "combination"]
},
"kill_processes_by_name": {
"description": "Kill all processes matching a name",
"command": "pkill -f 'process_name'",
"explanation": "-f matches full command line. Use killall for exact name match",
"safer_alternative": "pgrep -f 'process_name' (to see what would be killed first)",
"tags": ["pkill", "kill", "process"]
},
"watch_command_output": {
"description": "Run command repeatedly and watch output",
"command": "watch -n 2 'df -h'",
"explanation": "Runs df -h every 2 seconds. Press Ctrl+C to stop",
"tags": ["watch", "monitor", "repeat"]
},
"find_duplicate_files": {
"description": "Find duplicate files by content",
"command": "find . -type f -exec md5sum {} + | sort | uniq -w32 -D",
"explanation": "Calculates MD5 hash of each file, finds duplicates by hash",
"tags": ["find", "md5sum", "duplicate", "combination"]
},
"recursive_grep_with_context": {
"description": "Search with surrounding context lines",
"command": "grep -rn -A 3 -B 3 'pattern' .",
"explanation": "-r (recursive), -n (line numbers), -A (lines after), -B (lines before)",
"tags": ["grep", "search", "context"]
},
"find_empty_files": {
"description": "Find empty files and directories",
"command": "find . -empty",
"explanation": "Finds both empty files (0 bytes) and empty directories",
"tags": ["find", "empty"]
},
"parallel_compression": {
"description": "Compress using multiple CPU cores",
"command": "tar -I pigz -cf archive.tar.gz directory/",
"explanation": "Uses pigz (parallel gzip) for faster compression on multi-core systems",
"alternative": "tar -I 'xz -T0' -cf archive.tar.xz directory/ (for xz compression)",
"tags": ["tar", "compression", "parallel", "performance"]
},
"batch_rename_files": {
"description": "Rename multiple files using pattern",
"command": "for f in *.txt; do mv \"$f\" \"${f%.txt}.md\"; done",
"explanation": "Changes all .txt files to .md. ${f%.txt} removes .txt extension",
"tags": ["rename", "batch", "loop"]
},
"find_and_grep": {
"description": "Find files and search content",
"command": "find . -name '*.log' -exec grep -l 'ERROR' {} +",
"explanation": "Finds .log files containing 'ERROR'. -l shows only filenames",
"tags": ["find", "grep", "combination", "search"]
},
"monitor_directory_changes": {
"description": "Watch for file changes in directory",
"command": "watch -d ls -l",
"explanation": "-d highlights differences between updates",
"tags": ["watch", "monitor", "files"]
},
"network_bandwidth_test": {
"description": "Test network bandwidth between hosts",
"command": "iperf3 -c server_ip",
"explanation": "Measures TCP/UDP bandwidth. Run 'iperf3 -s' on server first",
"tags": ["iperf", "network", "bandwidth", "performance"]
},
"csv_column_extraction": {
"description": "Extract specific columns from CSV",
"command": "cut -d',' -f1,3 file.csv",
"explanation": "Extracts columns 1 and 3. -d sets delimiter, -f selects fields",
"tags": ["cut", "csv", "column", "text processing"]
},
"json_pretty_print": {
"description": "Pretty print JSON file",
"command": "cat file.json | python -m json.tool",
"explanation": "Formats JSON with proper indentation for readability",
"alternative": "jq '.' file.json (if jq is installed)",
"tags": ["json", "format", "pretty print"]
}
},
"ls": {
"description": "List directory contents - one of the most fundamental commands",
"usage": "ls [OPTIONS] [FILE]...",
"category": "file_operations",
"tags": ["files", "directory", "list", "show", "basic"],
"common_options": {
"-l": "Long format with permissions, owner, size, date",
"-a": "Show all files including hidden (starting with .)",
"-h": "Human-readable sizes (KB, MB, GB)",
"-t": "Sort by modification time, newest first",
"-r": "Reverse sort order",
"-S": "Sort by file size, largest first",
"-R": "Recursive - list subdirectories too",
"-i": "Show inode numbers",
"-d": "List directories themselves, not contents"
},
"examples": [
{
"command": "ls -la",
"explanation": "Long format showing all files including hidden"
},
{
"command": "ls -lhS",
"explanation": "Long format, human-readable sizes, sorted by size"
},
{
"command": "ls -lt | head -10",
"explanation": "Show 10 most recently modified files"
},
{
"command": "ls -lR",
"explanation": "Recursive listing of all subdirectories"
}
],
"tips": [
"Combine multiple options: ls -lAhtr shows all files, long format, human sizes, sorted by time (oldest first)",
"Use ls -d */ to list only directories",
"ls -1 shows one file per line (useful for scripting)"
]
},
"cd": {
"description": "Change directory - navigate filesystem",
"usage": "cd [DIRECTORY]",
"category": "file_operations",
"tags": ["directory", "navigate", "change", "basic"],
"special_paths": {
"~": "Home directory",
"-": "Previous directory",
"..": "Parent directory",
"../..": "Two levels up",
".": "Current directory (rarely needed)",
"/": "Root directory"
},
"examples": [
{
"command": "cd /var/log",
"explanation": "Change to absolute path"
},
{
"command": "cd ~/Documents",
"explanation": "Go to Documents in home directory"
},
{
"command": "cd -",
"explanation": "Switch to previous directory (toggle)"
},
{
"command": "cd ../..",
"explanation": "Go up two directory levels"
}
],
"tips": [
"Use 'pushd' and 'popd' for directory stack navigation",
"'cd' with no arguments goes to home directory",
"Use Tab completion to avoid typing full paths"
]
},
"pwd": {
"description": "Print working directory - show current location",
"usage": "pwd [OPTIONS]",
"category": "file_operations",
"tags": ["directory", "current", "path", "location", "basic"],
"common_options": {
"-L": "Print logical path (with symlinks)",
"-P": "Print physical path (resolve symlinks)"
},
"examples": [
{
"command": "pwd",
"explanation": "Show current directory path"
},
{
"command": "pwd -P",
"explanation": "Show real path (resolve symbolic links)"
}
],
"tips": [
"Useful in scripts to save current location: OLDPWD=$(pwd)",
"Combine with command substitution: cd $(dirname $(pwd))"
]
},
"cat": {
"description": "Concatenate and display file contents",
"usage": "cat [OPTIONS] [FILE]...",
"category": "file_operations",
"tags": ["file", "read", "display", "show", "content", "basic"],
"common_options": {
"-n": "Number all output lines",
"-b": "Number non-empty lines only",
"-s": "Squeeze multiple blank lines into one",
"-A": "Show all characters including non-printing",
"-E": "Display $ at end of each line",
"-T": "Display TAB characters as ^I"
},
"examples": [
{
"command": "cat file.txt",
"explanation": "Display file contents"
},
{
"command": "cat file1.txt file2.txt > combined.txt",
"explanation": "Concatenate multiple files into one"
},
{
"command": "cat -n script.py",
"explanation": "Show file with line numbers"
},
{
"command": "cat > newfile.txt",
"explanation": "Create new file (type content, Ctrl+D to save)"
}
],
"tips": [
"For large files, use 'less' or 'more' instead",
"Use 'tac' to display file in reverse order",
"cat without arguments reads from stdin (useful in pipes)"
]
},
"grep": {
"description": "Search text using patterns - powerful text search tool",
"usage": "grep [OPTIONS] PATTERN [FILE]...",
"category": "text_processing",
"tags": ["search", "find", "text", "pattern", "filter"],
"common_options": {
"-r": "Recursive search in directories",
"-i": "Case-insensitive search",
"-n": "Show line numbers",
"-v": "Invert match (show non-matching lines)",
"-l": "Show only filenames with matches",
"-c": "Count matching lines",
"-A NUM": "Show NUM lines after match",
"-B NUM": "Show NUM lines before match",
"-C NUM": "Show NUM lines before and after",
"-w": "Match whole words only",
"-E": "Extended regex (same as egrep)",
"-o": "Show only matched part of line",
"--color": "Highlight matches in color"
},
"examples": [
{
"command": "grep 'error' logfile.txt",
"explanation": "Find lines containing 'error'"
},
{
"command": "grep -rn 'TODO' .",
"explanation": "Recursively search for 'TODO' with line numbers"
},
{
"command": "grep -i 'warning' *.log",
"explanation": "Case-insensitive search in all .log files"
},
{
"command": "grep -v '^#' config.txt",
"explanation": "Show lines not starting with # (exclude comments)"
},
{
"command": "grep -E 'error|warning|critical' app.log",
"explanation": "Search for multiple patterns (OR logic)"
}
],
"tips": [
"Use grep -P for Perl-compatible regex",
"Combine with other commands: ps aux | grep nginx",
"Use grep -c to count occurrences instead of piping to wc -l"
]
},
"find": {
"description": "Search for files and directories in hierarchy",
"usage": "find [PATH] [OPTIONS] [EXPRESSION]",
"category": "file_operations",
"tags": ["search", "file", "locate", "recursive"],
"common_options": {
"-name": "Search by filename (case-sensitive)",
"-iname": "Search by filename (case-insensitive)",
"-type f": "Find files only",
"-type d": "Find directories only",
"-size +10M": "Files larger than 10MB",
"-size -10k": "Files smaller than 10KB",
"-mtime -7": "Modified in last 7 days",
"-mtime +30": "Modified more than 30 days ago",
"-user username": "Files owned by user",
"-perm 755": "Files with specific permissions",
"-exec": "Execute command on found files",
"-delete": "Delete found files (use carefully!)",
"-empty": "Find empty files/directories"
},
"examples": [
{
"command": "find . -name '*.txt'",
"explanation": "Find all .txt files in current directory and subdirectories"
},
{
"command": "find /home -type f -mtime -7",
"explanation": "Find files modified in last 7 days"
},
{
"command": "find . -size +100M -exec ls -lh {} \\;",
"explanation": "Find large files and show their sizes"
},
{
"command": "find . -name '*.log' -delete",
"explanation": "Find and delete all .log files (careful!)"
},
{
"command": "find . -type f -name '*.py' | wc -l",
"explanation": "Count number of Python files"
}
],
"tips": [
"Use -maxdepth N to limit search depth",
"Combine multiple conditions: find . -name '*.txt' -size +1M",
"Use -print0 with xargs -0 for filenames with spaces"
]
},
"awk": {
"description": "Pattern scanning and text processing language",
"usage": "awk 'pattern {action}' [FILE]",
"category": "text_processing",
"tags": ["text", "processing", "column", "format", "advanced"],
"examples": [
{
"command": "awk '{print $1, $3}' file.txt",
"explanation": "Print 1st and 3rd column from each line"
},
{
"command": "awk -F',' '{print $2}' data.csv",
"explanation": "Print 2nd column from comma-separated file"
},
{
"command": "awk '/error/ {print $0}' log.txt",
"explanation": "Print lines containing 'error'"
},
{
"command": "awk '{sum+=$1} END {print sum}' numbers.txt",
"explanation": "Sum values in first column"
},
{
"command": "ps aux | awk '{print $2, $11}'",
"explanation": "Show PID and command name from ps output"
}
],
"tips": [
"$0 is the entire line, $1 is first field, $2 second field, etc.",
"Use BEGIN and END blocks for initialization and summary",
"Built-in variables: NR (line number), NF (number of fields)"
]
},
"sed": {
"description": "Stream editor for filtering and transforming text",
"usage": "sed [OPTIONS] 'command' [FILE]",
"category": "text_processing",
"tags": ["text", "edit", "replace", "stream", "advanced"],
"common_options": {
"-i": "Edit files in-place (modify original)",
"-e": "Multiple editing commands",
"-n": "Suppress automatic output",
"-r": "Use extended regex"
},
"examples": [
{
"command": "sed 's/old/new/g' file.txt",
"explanation": "Replace all occurrences of 'old' with 'new'"
},
{
"command": "sed -i 's/foo/bar/g' file.txt",
"explanation": "Replace in-place (modify file directly)"
},
{
"command": "sed -n '10,20p' file.txt",
"explanation": "Print lines 10 to 20"
},
{
"command": "sed '/pattern/d' file.txt",
"explanation": "Delete lines matching pattern"
},
{
"command": "sed 's/^/PREFIX: /' file.txt",
"explanation": "Add prefix to each line"
}
],
"tips": [
"Test without -i first to preview changes",
"Use sed -i.bak to create backup before modifying",
"Combine multiple commands: sed -e 's/a/b/' -e 's/c/d/'"
]
},
"ps": {
"description": "Report process status - show running processes",
"usage": "ps [OPTIONS]",
"category": "process_management",
"tags": ["process", "running", "tasks", "list", "system"],
"common_options": {
"aux": "All processes, user-oriented format",
"ef": "All processes, full format",
"-u username": "Processes for specific user",
"--sort=-%mem": "Sort by memory usage",
"--sort=-%cpu": "Sort by CPU usage"
},
"examples": [
{
"command": "ps aux",
"explanation": "Show all running processes with detailed info"
},
{
"command": "ps aux | grep nginx",
"explanation": "Find nginx processes"
},
{
"command": "ps aux --sort=-%mem | head -10",
"explanation": "Top 10 memory-consuming processes"
},
{
"command": "ps -ef | grep python",
"explanation": "Find all Python processes"
}
],
"tips": [
"Use 'top' or 'htop' for real-time monitoring",
"ps aux shows: USER, PID, %CPU, %MEM, COMMAND",
"Combine with pgrep for specific searches"
]
},
"top": {
"description": "Display and update sorted information about processes",
"usage": "top [OPTIONS]",
"category": "process_management",
"tags": ["process", "monitor", "cpu", "memory", "performance", "realtime"],
"interactive_keys": {
"q": "Quit",
"k": "Kill a process",
"M": "Sort by memory usage",
"P": "Sort by CPU usage",
"T": "Sort by running time",
"u": "Filter by user",
"1": "Show individual CPU cores",
"h": "Help"
},
"examples": [
{
"command": "top",
"explanation": "Interactive process monitor"
},
{
"command": "top -u username",
"explanation": "Show processes for specific user"
},
{
"command": "top -bn1 | head -20",
"explanation": "Non-interactive snapshot of top processes"
}
],
"tips": [
"Press 'M' to sort by memory, 'P' for CPU",
"Use 'htop' for a more user-friendly interface",
"top shows load average in first line: 1min, 5min, 15min"
]
},
"df": {
"description": "Report file system disk space usage",
"usage": "df [OPTIONS] [FILE]...",
"category": "disk_management",
"tags": ["disk", "space", "usage", "storage", "filesystem"],
"common_options": {
"-h": "Human-readable sizes (GB, MB)",
"-i": "Show inode information",
"-T": "Show filesystem type",
"-a": "Include pseudo filesystems",
"--total": "Show grand total"
},
"examples": [
{
"command": "df -h",
"explanation": "Show disk space in human-readable format"
},
{
"command": "df -hT",
"explanation": "Include filesystem types"
},
{
"command": "df -i",
"explanation": "Show inode usage (file count limits)"
},
{
"command": "df -h /home",
"explanation": "Check space for specific mount point"
}
],
"tips": [
"Use 'du' to see disk usage by directory",
"If df shows 100% but files deleted, check for open file handles with lsof",
"Watch out for inode exhaustion (df -i)"
]
},
"du": {
"description": "Estimate file space usage - disk usage by directory",
"usage": "du [OPTIONS] [FILE]...",
"category": "disk_management",
"tags": ["disk", "usage", "size", "directory", "space"],
"common_options": {
"-h": "Human-readable sizes",
"-s": "Summary only (total for each argument)",
"-c": "Grand total",
"--max-depth=N": "Limit directory depth",
"-a": "Include files, not just directories",
"--exclude": "Exclude pattern"
},
"examples": [
{
"command": "du -sh *",
"explanation": "Show size of each item in current directory"
},
{
"command": "du -h --max-depth=1 | sort -rh",
"explanation": "Show directory sizes sorted by size"
},
{
"command": "du -sh /var/log",
"explanation": "Total size of /var/log directory"
},
{
"command": "du -ah | sort -rh | head -20",
"explanation": "Find 20 largest files/directories"
}
],
"tips": [
"du counts actual disk usage (considers hard links)",
"For fast estimates, use --apparent-size",
"Use ncdu for interactive disk usage explorer"
]
},
"free": {
"description": "Display amount of free and used memory in the system",
"usage": "free [OPTIONS]",
"category": "system_info",
"tags": ["memory", "ram", "usage", "available", "system"],
"common_options": {
"-h": "Human-readable output",
"-m": "Show in megabytes",
"-g": "Show in gigabytes",
"-s N": "Update every N seconds",
"-t": "Show total line"
},
"examples": [
{
"command": "free -h",
"explanation": "Show memory usage in human-readable format"
},
{
"command": "free -m -s 2",
"explanation": "Show memory in MB, update every 2 seconds"
},
{
"command": "free -ht",
"explanation": "Human-readable with total line"
}
],
"tips": [
"'available' column shows memory available for new apps",
"Buffers/cache is memory used for system caching (reclaimable)",
"Don't worry if 'free' is low - Linux uses free RAM for caching"
]
},
"tar": {
"description": "Archive utility - create and extract tar archives",
"usage": "tar [OPTIONS] [FILE]...",
"category": "compression",
"tags": ["archive", "compress", "extract", "backup"],
"common_options": {
"-c": "Create archive",
"-x": "Extract archive",
"-t": "List contents",
"-f": "Specify filename",
"-z": "gzip compression",
"-j": "bzip2 compression",
"-J": "xz compression",
"-v": "Verbose output",
"-C": "Extract to specific directory"
},
"examples": [
{
"command": "tar -czf backup.tar.gz /data",
"explanation": "Create gzip-compressed archive of /data"
},
{
"command": "tar -xzf backup.tar.gz",
"explanation": "Extract gzip-compressed archive"
},
{
"command": "tar -tzf backup.tar.gz",
"explanation": "List contents without extracting"
},
{
"command": "tar -xzf file.tar.gz -C /destination",
"explanation": "Extract to specific directory"
},
{
"command": "tar -cjf archive.tar.bz2 dir/",
"explanation": "Create bzip2-compressed archive (better compression)"
}
],
"tips": [
"Remember: tar -czf creates, tar -xzf extracts",
"Modern tar auto-detects compression: tar -xf works for any format",
"Use -v to see progress during operations"
]
},
"wget": {
"description": "Download files from the web - non-interactive downloader",
"usage": "wget [OPTIONS] [URL]",
"category": "network",
"tags": ["download", "web", "http", "fetch", "transfer"],
"common_options": {
"-O": "Output to specific file",
"-c": "Continue partial download",
"-r": "Recursive download",
"-np": "No parent directories (with -r)",
"-q": "Quiet mode",
"-P": "Prefix directory for downloads",
"--limit-rate": "Limit download speed"
},
"examples": [
{
"command": "wget https://example.com/file.zip",
"explanation": "Download file"
},
{
"command": "wget -c https://example.com/large-file.iso",
"explanation": "Resume interrupted download"
},
{
"command": "wget -O custom-name.zip https://example.com/file.zip",
"explanation": "Save with custom filename"
},
{
"command": "wget -r -np https://example.com/docs/",
"explanation": "Recursively download website section"
}
],
"tips": [
"Use -c to resume downloads if connection drops",
"wget keeps retrying if network is unstable",
"For single file downloads, curl is more flexible"
]
},
"curl": {
"description": "Transfer data from or to a server - versatile data transfer tool",
"usage": "curl [OPTIONS] [URL]",
"category": "network",
"tags": ["http", "download", "api", "web", "request", "transfer"],
"common_options": {
"-O": "Save with remote filename",
"-o": "Save to specific file",
"-I": "Fetch headers only",
"-L": "Follow redirects",
"-X": "Specify request method (GET, POST, etc.)",
"-d": "Send data (for POST)",
"-H": "Add custom header",
"-u": "User authentication",
"-v": "Verbose output",
"-s": "Silent mode"
},
"examples": [
{
"command": "curl https://api.example.com/data",
"explanation": "Fetch URL content"
},
{
"command": "curl -I https://example.com",
"explanation": "Get HTTP headers only"
},
{
"command": "curl -X POST -d 'key=value' https://api.example.com",
"explanation": "Send POST request with data"
},
{
"command": "curl -H 'Authorization: Bearer token' https://api.example.com",
"explanation": "Add custom header (API authentication)"
},
{
"command": "curl -o file.html https://example.com",
"explanation": "Download and save to file"
}
],
"tips": [
"Use -L to follow redirects (important for many sites)",
"curl is better for APIs, wget for downloading files",
"Add | jq for pretty JSON formatting"
]
},
"chmod": {
"description": "Change file permissions - control who can read/write/execute",
"usage": "chmod [OPTIONS] MODE FILE...",
"category": "permissions",
"tags": ["permissions", "access", "rights", "security"],
"permission_numbers": {
"7": "rwx (read, write, execute)",
"6": "rw- (read, write)",
"5": "r-x (read, execute)",
"4": "r-- (read only)",
"3": "-wx (write, execute)",
"2": "-w- (write only)",
"1": "--x (execute only)",
"0": "--- (no permissions)"
},
"symbolic_modes": {
"u": "User/owner",
"g": "Group",
"o": "Others",
"a": "All (ugo)",
"+": "Add permission",
"-": "Remove permission",
"=": "Set exact permission"
},
"examples": [
{
"command": "chmod 755 script.sh",
"explanation": "Owner: rwx, Group: r-x, Others: r-x"
},
{
"command": "chmod +x file.sh",
"explanation": "Add execute permission for all"
},
{
"command": "chmod u+x,g-w file",
"explanation": "Add execute for owner, remove write for group"
},
{
"command": "chmod -R 644 directory/",
"explanation": "Recursively set permissions (files: rw-r--r--)"
}
],
"tips": [
"755 for scripts/executables, 644 for regular files",
"Never use 777 unless absolutely necessary (security risk)",
"Use chmod -R carefully on directories"
]
},
"chown": {
"description": "Change file owner and group",
"usage": "chown [OPTIONS] OWNER[:GROUP] FILE...",
"category": "permissions",
"tags": ["ownership", "user", "group", "permissions"],
"common_options": {
"-R": "Recursive (for directories)",
"-v": "Verbose output",
"--reference": "Use ownership of reference file"
},
"examples": [
{
"command": "chown user file.txt",
"explanation": "Change owner to 'user'"
},
{
"command": "chown user:group file.txt",
"explanation": "Change owner and group"
},
{
"command": "chown -R user:group directory/",
"explanation": "Recursively change ownership"
},
{
"command": "chown :group file.txt",
"explanation": "Change group only (keep owner)"
}
],
"tips": [
"Usually requires sudo/root privileges",
"Use chgrp to change group only",
"Check current ownership with ls -l"
]
},
"ln": {
"description": "Make links between files - create shortcuts",
"usage": "ln [OPTIONS] TARGET LINK_NAME",
"category": "file_operations",
"tags": ["link", "symbolic", "shortcut", "symlink"],
"link_types": {
"hard": "Direct reference to file data (same inode)",
"symbolic": "Pointer to filename (can cross filesystems)"
},
"common_options": {
"-s": "Create symbolic link (recommended)",
"-f": "Force (remove existing destination)",
"-n": "Treat symlink to directory as file",
"-v": "Verbose output"
},
"examples": [
{
"command": "ln -s /path/to/file linkname",
"explanation": "Create symbolic link"
},
{
"command": "ln -s /opt/app/current /usr/local/bin/app",
"explanation": "Create symlink for easy access"
},
{
"command": "ln file hardlink",
"explanation": "Create hard link (no -s)"
}
],
"tips": [
"Always use absolute paths with symlinks",
"Symbolic links can point to non-existent files (check with ls -l)",
"Hard links can't cross filesystems or link to directories"
]
},
"netstat": {
"description": "Network statistics - show network connections, routing tables",
"usage": "netstat [OPTIONS]",
"category": "network",
"tags": ["network", "connections", "ports", "sockets", "statistics"],
"common_options": {
"-t": "TCP connections",
"-u": "UDP connections",
"-l": "Listening sockets only",
"-n": "Numeric addresses (don't resolve names)",
"-p": "Show program/PID",
"-a": "All sockets",
"-r": "Routing table",
"-s": "Statistics by protocol"
},
"examples": [
{
"command": "netstat -tuln",
"explanation": "Show all TCP/UDP listening ports"
},
{
"command": "netstat -tunap",
"explanation": "Show all connections with program names"
},
{
"command": "netstat -rn",
"explanation": "Show routing table"
},
{
"command": "netstat -s",
"explanation": "Show network statistics"
}
],
"tips": [
"Use ss instead of netstat (faster, more info)",
"netstat -tulnp | grep :80 to check specific port",
"May need sudo to see all process names"
]
},
"ss": {
"description": "Socket statistics - modern replacement for netstat",
"usage": "ss [OPTIONS]",
"category": "network",
"tags": ["network", "sockets", "connections", "ports"],
"common_options": {
"-t": "TCP sockets",
"-u": "UDP sockets",
"-l": "Listening sockets",
"-n": "Numeric addresses",
"-p": "Show processes",
"-a": "All sockets",
"-s": "Summary statistics"
},
"examples": [
{
"command": "ss -tuln",
"explanation": "Show listening TCP/UDP ports"
},