Commit 273c654 1 parent 6d3ae96 commit 273c654 Copy full SHA for 273c654
File tree 19 files changed +68
-68
lines changed
19 files changed +68
-68
lines changed Original file line number Diff line number Diff line change 9
9
10
10
- Start ` htop ` displaying processes owned by a specific user:
11
11
12
- ` htop -- user {{username}} `
12
+ ` htop {{[-u|-- user]}} {{username}} `
13
13
14
14
- Display processes hierarchically in a tree view to show the parent-child relationships:
15
15
16
- ` htop -- tree `
16
+ ` htop {{[-t|-- tree]}} `
17
17
18
18
- Sort processes by a specified ` sort_item ` (use ` htop --sort help ` for available options):
19
19
20
- ` htop -- sort {{sort_item}} `
20
+ ` htop {{[-s|-- sort]}} {{sort_item}} `
21
21
22
22
- Start ` htop ` with the specified delay between updates, in tenths of a second (i.e. 50 = 5 seconds):
23
23
24
- ` htop -- delay {{50}} `
24
+ ` htop {{[-d|-- delay]}} {{50}} `
25
25
26
26
- See interactive commands while running htop:
27
27
33
33
34
34
- Display help:
35
35
36
- ` htop -- help `
36
+ ` htop {{[-h|-- help]}} `
Original file line number Diff line number Diff line change 9
9
10
10
- Display the current user identity:
11
11
12
- ` id -un `
12
+ ` id {{[ -un|--user --name]}} `
13
13
14
14
- Display the current user identity as a number:
15
15
16
- ` id -u `
16
+ ` id {{[-u|--user]}} `
17
17
18
18
- Display the current primary group identity:
19
19
20
- ` id -gn `
20
+ ` id {{[ -gn|--group --name]}} `
21
21
22
22
- Display the current primary group identity as a number:
23
23
24
- ` id -g `
24
+ ` id {{[-g|--group]}} `
25
25
26
26
- Display an arbitrary user's ID (UID), group ID (GID) and groups to which they belong:
27
27
Original file line number Diff line number Diff line change 9
9
10
10
- Connect to a serial console with a specified baud rate:
11
11
12
- ` sudo picocom {{/dev/ttyXYZ}} -- baud {{baud_rate}} `
12
+ ` sudo picocom {{/dev/ttyXYZ}} {{[-b|-- baud]}} {{baud_rate}} `
13
13
14
14
- Map special characters (e.g. ` LF ` to ` CRLF ` ):
15
15
Original file line number Diff line number Diff line change 17
17
18
18
- Execute a command as another user:
19
19
20
- ` su - {{username}} -c "{{command}}" `
20
+ ` su - {{username}} {{[-c|--command]}} "{{command}}" `
Original file line number Diff line number Diff line change 5
5
6
6
- List available network interfaces:
7
7
8
- ` tcpdump -D `
8
+ ` tcpdump {{[-D|--list-interfaces]}} `
9
9
10
10
- Capture the traffic of a specific interface:
11
11
12
- ` tcpdump -i {{eth0}} `
12
+ ` sudo tcpdump {{[-i|--interface]}} {{eth0}}`
13
13
14
14
- Capture all TCP traffic showing contents (ASCII) in console:
15
15
21
21
22
22
- Capture the traffic from a specific interface, source, destination and destination port:
23
23
24
- ` tcpdump -i {{eth0}} src {{192.168.1.1}} and dst {{192.168.1.2}} and dst port {{80}} `
24
+ ` tcpdump {{[-i|--interface]} {{eth0}} src {{192.168.1.1}} and dst {{192.168.1.2}} and dst port {{80}} `
25
25
26
26
- Capture the traffic of a network:
27
27
Original file line number Diff line number Diff line change 10
10
11
11
- Display only unique lines:
12
12
13
- ` sort {{path/to/file}} | uniq -u `
13
+ ` sort {{path/to/file}} | uniq {{[-u|--unique]}} `
14
14
15
15
- Display only duplicate lines:
16
16
17
- ` sort {{path/to/file}} | uniq -d `
17
+ ` sort {{path/to/file}} | uniq {{[-d|--repeated]}} `
18
18
19
19
- Display number of occurrences of each line along with that line:
20
20
21
- ` sort {{path/to/file}} | uniq -c `
21
+ ` sort {{path/to/file}} | uniq {{[-c|--count]}} `
22
22
23
23
- Display number of occurrences of each line, sorted by the most frequent:
24
24
25
- ` sort {{path/to/file}} | uniq -c | sort -nr `
25
+ ` sort {{path/to/file}} | uniq {{[-c|--count]}} | sort {{[ -nr|--numeric-sort --reverse]}} `
Original file line number Diff line number Diff line change 5
5
6
6
- Count all lines in a file:
7
7
8
- ` wc -- lines {{path/to/file}} `
8
+ ` wc {{[-l|-- lines]}} {{path/to/file}} `
9
9
10
10
- Count all words in a file:
11
11
12
- ` wc -- words {{path/to/file}} `
12
+ ` wc {{[-w|-- words]}} {{path/to/file}} `
13
13
14
14
- Count all bytes in a file:
15
15
16
- ` wc -- bytes {{path/to/file}} `
16
+ ` wc {{[-c|-- bytes]}} {{path/to/file}} `
17
17
18
18
- Count all characters in a file (taking multi-byte characters into account):
19
19
20
- ` wc -- chars {{path/to/file}} `
20
+ ` wc {{[-m|-- chars]}} {{path/to/file}} `
21
21
22
22
- Count all lines, words and bytes from ` stdin ` :
23
23
24
24
` {{find .}} | wc `
25
25
26
26
- Count the length of the longest line in number of characters:
27
27
28
- ` wc -- max-line-length {{path/to/file}} `
28
+ ` wc {{[-L|-- max-line-length]}} {{path/to/file}} `
Original file line number Diff line number Diff line change 14
14
15
15
- Gzip all files with ` .log ` extension taking advantage of multiple threads (` -print0 ` uses a null character to split file names, and ` -0 ` uses it as delimiter):
16
16
17
- ` find . -name '*.log' -print0 | xargs -0 -P {{4}} -n 1 gzip `
17
+ ` find . -name '*.log' -print0 | xargs {{[-0|--null]}} {{[-P|--max-procs]}} {{4}} {{[-n|--max-args]}} 1 gzip `
18
18
19
19
- Execute the command once per argument:
20
20
21
- ` {{arguments_source}} | xargs -n1 {{command}} `
21
+ ` {{arguments_source}} | xargs {{-n|--max-args}} 1 {{command}} `
22
22
23
23
- Execute the command once for each input line, replacing any occurrences of the placeholder (here marked as ` _ ` ) with the input line:
24
24
25
25
` {{arguments_source}} | xargs -I _ {{command}} _ {{optional_extra_arguments}} `
26
26
27
27
- Parallel runs of up to ` max-procs ` processes at a time; the default is 1. If ` max-procs ` is 0, xargs will run as many processes as possible at a time:
28
28
29
- ` {{arguments_source}} | xargs -P {{max-procs}} {{command}} `
29
+ ` {{arguments_source}} | xargs {{[-P|--max-procs]}} {{max-procs}} {{command}} `
Original file line number Diff line number Diff line change 5
5
6
6
- Open a given serial port:
7
7
8
- ` sudo cu -- line {{/dev/ttyXYZ}} `
8
+ ` sudo cu {{[-l|-- line]}} {{/dev/ttyXYZ}} `
9
9
10
10
- Open a given serial port with a given baud rate:
11
11
12
- ` sudo cu -- line {{/dev/ttyXYZ}} -- speed {{115200}} `
12
+ ` sudo cu {{[-l|-- line]}} {{/dev/ttyXYZ}} {{[-s|-- speed]}} {{115200}} `
13
13
14
14
- Open a given serial port with a given baud rate and echo characters locally (half-duplex mode):
15
15
16
- ` sudo cu -- line {{/dev/ttyXYZ}} -- speed {{115200}} -- halfduplex `
16
+ ` sudo cu {{[-l|-- line]}} {{/dev/ttyXYZ}} {{[-s|-- speed]}} {{115200}} {{[-h|-- halfduplex]}} `
17
17
18
18
- Open a given serial port with a given baud rate, parity, and no hardware or software flow control:
19
19
20
- ` sudo cu -- line {{/dev/ttyXYZ}} -- speed {{115200}} --parity={{even|odd|none}} -- nortscts --nostop `
20
+ ` sudo cu {{[-l|-- line]}} {{/dev/ttyXYZ}} {{[-s|-- speed]}} {{115200}} --parity={{even|odd|none}} {{[-f|-- nortscts]}} --nostop `
21
21
22
22
- Exit the ` cu ` session when in connection:
23
23
Original file line number Diff line number Diff line change 9
9
10
10
- Show kernel error messages:
11
11
12
- ` sudo dmesg -- level err `
12
+ ` sudo dmesg {{[-l|-- level]}} err `
13
13
14
14
- Show kernel messages and keep reading new ones, similar to ` tail -f ` (available in kernels 3.5.0 and newer):
15
15
16
- ` sudo dmesg -w `
16
+ ` sudo dmesg {{[-w|--follow]}} `
17
17
18
18
- Show how much physical memory is available on this system:
19
19
20
- ` sudo dmesg | grep -i memory `
20
+ ` sudo dmesg | grep {{[-i|--ignore-case]}} memory `
21
21
22
22
- Show kernel messages 1 page at a time:
23
23
24
24
` sudo dmesg | less `
25
25
26
26
- Show kernel messages with a timestamp (available in kernels 3.5.0 and newer):
27
27
28
- ` sudo dmesg -T `
28
+ ` sudo dmesg {{[-T|--ctime]}} `
29
29
30
30
- Show kernel messages in human-readable form (available in kernels 3.5.0 and newer):
31
31
32
- ` sudo dmesg -H `
32
+ ` sudo dmesg {{[-H|--human]}} `
33
33
34
34
- Colorize output (available in kernels 3.5.0 and newer):
35
35
36
- ` sudo dmesg -L `
36
+ ` sudo dmesg {{[-L|--color]}} `
Original file line number Diff line number Diff line change 9
9
10
10
- Power off the system (same as ` poweroff ` ):
11
11
12
- ` halt -- poweroff `
12
+ ` halt {{[-p|-- poweroff]}} `
13
13
14
14
- Reboot the system (same as ` reboot ` ):
15
15
16
16
` halt --reboot `
17
17
18
18
- Halt immediately without contacting the system manager:
19
19
20
- ` halt -- force `
20
+ ` halt {{[-f|-- force]}} `
21
21
22
22
- Write the wtmp shutdown entry without halting the system:
23
23
24
- ` halt -- wtmp-only `
24
+ ` halt {{[-w|-- wtmp-only]}} `
Original file line number Diff line number Diff line change 13
13
14
14
- Display CPU statistics:
15
15
16
- ` iostat -c `
16
+ ` iostat {{[-c|--compact]}} `
17
17
18
18
- Display disk statistics with disk names (including LVM):
19
19
Original file line number Diff line number Diff line change 6
6
7
7
- View chains, rules, packet/byte counters and line numbers for the filter table:
8
8
9
- ` sudo iptables -- verbose --numeric --list --line-numbers `
9
+ ` sudo iptables {{[-vnL --line-numbers|-- verbose --numeric --list --line-numbers]}} `
10
10
11
- - Set chain [ P ] olicy rule:
11
+ - Set chain policy rule:
12
12
13
- ` sudo iptables -- policy {{chain}} {{rule}} `
13
+ ` sudo iptables {{[-P|-- policy]}} {{chain}} {{rule}} `
14
14
15
- - [ A ] ppend rule to chain policy for IP:
15
+ - Append rule to chain policy for IP:
16
16
17
- ` sudo iptables -- append {{chain}} -- source {{ip}} -- jump {{rule}} `
17
+ ` sudo iptables {{[-A|-- append]}} {{chain}} {{[-s|-- source]}} {{ip}} {{[-j|-- jump]}} {{rule}} `
18
18
19
- - [ A ] ppend rule to chain policy for IP considering [ p ] rotocol and port:
19
+ - Append rule to chain policy for IP considering protocol and port:
20
20
21
- ` sudo iptables -- append {{chain}} -- source {{ip}} -- protocol {{tcp|udp|icmp|...}} --dport {{port}} -- jump {{rule}} `
21
+ ` sudo iptables {{[-A|-- append]}} {{chain}} {{[-s|-- source]}} {{ip}} {{[-p|-- protocol]}} {{tcp|udp|icmp|...}} --dport {{port}} {{[-j|-- jump]}} {{rule}} `
22
22
23
23
- Add a NAT rule to translate all traffic from the ` 192.168.0.0/24 ` subnet to the host's public IP:
24
24
25
- ` sudo iptables -- table {{nat}} -- append {{POSTROUTING}} -- source {{192.168.0.0/24}} -- jump {{MASQUERADE}} `
25
+ ` sudo iptables {{[-t|-- table]}} {{nat}} {{[-A|-- append]}} {{POSTROUTING}} {{[-s|-- source]}} {{192.168.0.0/24}} {{[-j|-- jump]}} {{MASQUERADE}} `
26
26
27
- - [ D ] elete chain rule:
27
+ - Delete chain rule:
28
28
29
- ` sudo iptables -- delete {{chain}} {{rule_line_number}} `
29
+ ` sudo iptables {{[-D|-- delete]}} {{chain}} {{rule_line_number}} `
Original file line number Diff line number Diff line change 5
5
6
6
- Open a given serial port:
7
7
8
- ` sudo minicom -- device {{/dev/ttyXYZ}} `
8
+ ` sudo minicom {{[-D|-- device]}} {{/dev/ttyXYZ}} `
9
9
10
10
- Open a given serial port with a given baud rate:
11
11
12
- ` sudo minicom -- device {{/dev/ttyXYZ}} -- baudrate {{115200}} `
12
+ ` sudo minicom {{[-D|-- device]}} {{/dev/ttyXYZ}} {{[-b|-- baudrate]}} {{115200}} `
13
13
14
14
- Enter the configuration menu before communicating with a given serial port:
15
15
16
- ` sudo minicom -- device {{/dev/ttyXYZ}} -- setup `
16
+ ` sudo minicom {{[-D|-- device]}} {{/dev/ttyXYZ}} {{[-s|-- setup]}} `
17
17
18
18
- Exit minicom:
19
19
Original file line number Diff line number Diff line change 9
9
10
10
- Power off the system (same as ` poweroff ` ):
11
11
12
- ` reboot -- poweroff `
12
+ ` reboot {{[-p|-- poweroff]}} `
13
13
14
14
- Halt (terminates all processes and shuts down the CPU) the system (same as ` halt ` ):
15
15
16
16
` reboot --halt `
17
17
18
18
- Reboot immediately without contacting the system manager:
19
19
20
- ` reboot -- force `
20
+ ` reboot {{[-f|-- force]}} `
21
21
22
22
- Write the wtmp shutdown entry without rebooting the system:
23
23
24
- ` reboot -- wtmp-only `
24
+ ` reboot {{[-w|-- wtmp-only]}} `
Original file line number Diff line number Diff line change 10
10
11
11
- Remove specific nested directories recursively:
12
12
13
- ` rmdir -- parents {{path/to/directory1 path/to/directory2 ...}} `
13
+ ` rmdir {{[-p|-- parents]}} {{path/to/directory1 path/to/directory2 ...}} `
Original file line number Diff line number Diff line change 9
9
10
10
- [ r] eboot immediately:
11
11
12
- ` shutdown -r now `
12
+ ` shutdown {{[-r|--reboot]}} now `
13
13
14
14
- [ r] eboot in 5 minutes:
15
15
16
- ` shutdown -r +{{5}} & `
16
+ ` shutdown {{[-r|--reboot]}} +{{5}} & `
17
17
18
18
- Shutdown at 1:00 pm (Uses 24[ h] clock):
19
19
Original file line number Diff line number Diff line change 5
5
6
6
- Start tracing a specific [ p] rocess by its PID:
7
7
8
- ` strace -p {{pid}} `
8
+ ` strace {{[-p|--attach]}} {{pid}} `
9
9
10
- - Trace a [ p] rocess and filt [ e ] r output by system call:
10
+ - Trace a [ p] rocess and filter output by system call [ e ] xpression :
11
11
12
- ` strace -p {{pid}} -e {{system_call,system_call2,...}} `
12
+ ` strace {{[-p|--attach]}} {{pid}} -e {{system_call,system_call2,...}} `
13
13
14
14
- Count time, calls, and errors for each system call and report a summary on program exit:
15
15
16
- ` strace -p {{pid}} -c `
16
+ ` strace {{[-p|--attach]}} {{pid}} {{[-c|--summary-only]}} `
17
17
18
- - Show the [ T ] ime spent in every system call and specify the maximum string [ s ] ize to print:
18
+ - Show the time spent in every system call and specify the maximum string size to print:
19
19
20
- ` strace -p {{pid}} -T -s {{32}} `
20
+ ` strace {{[-p|--attach]}} {{pid}} {{[-T|--syscall-times]}} {{[-s|--string-limit]}} {{32}} `
21
21
22
22
- Start tracing a program by executing it:
23
23
27
27
28
28
` strace -e trace=file {{program}} `
29
29
30
- - Start tracing network operations of a program as well as all its [ f ] orked and child processes, saving the [ o ] utput to a file:
30
+ - Start tracing network operations of a program as well as all its forked and child processes, saving the output to a file:
31
31
32
- ` strace -f -e trace=network -o {{trace.txt}} {{program}} `
32
+ ` strace {{[-f|--follow-forks]}} -e trace=network {{[-o|--output]}} {{trace.txt}} {{program}} `
Original file line number Diff line number Diff line change 29
29
30
30
- List all service/socket/automount units filtering by running/failed state:
31
31
32
- ` systemctl list-units -- type= {{service|socket|automount}} --state= {{failed|running}} `
32
+ ` systemctl list-units {{[-t|-- type]}} {{service|socket|automount}} --state {{failed|running}} `
33
33
34
34
- Show the contents & absolute path of a unit file:
35
35
You can’t perform that action at this time.
0 commit comments