Skip to content

Commit 273c654

Browse files
authored
*: add more option placeholders (#15923)
1 parent 6d3ae96 commit 273c654

19 files changed

+68
-68
lines changed

pages/common/htop.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@
99

1010
- Start `htop` displaying processes owned by a specific user:
1111

12-
`htop --user {{username}}`
12+
`htop {{[-u|--user]}} {{username}}`
1313

1414
- Display processes hierarchically in a tree view to show the parent-child relationships:
1515

16-
`htop --tree`
16+
`htop {{[-t|--tree]}}`
1717

1818
- Sort processes by a specified `sort_item` (use `htop --sort help` for available options):
1919

20-
`htop --sort {{sort_item}}`
20+
`htop {{[-s|--sort]}} {{sort_item}}`
2121

2222
- Start `htop` with the specified delay between updates, in tenths of a second (i.e. 50 = 5 seconds):
2323

24-
`htop --delay {{50}}`
24+
`htop {{[-d|--delay]}} {{50}}`
2525

2626
- See interactive commands while running htop:
2727

@@ -33,4 +33,4 @@
3333

3434
- Display help:
3535

36-
`htop --help`
36+
`htop {{[-h|--help]}}`

pages/common/id.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@
99

1010
- Display the current user identity:
1111

12-
`id -un`
12+
`id {{[-un|--user --name]}}`
1313

1414
- Display the current user identity as a number:
1515

16-
`id -u`
16+
`id {{[-u|--user]}}`
1717

1818
- Display the current primary group identity:
1919

20-
`id -gn`
20+
`id {{[-gn|--group --name]}}`
2121

2222
- Display the current primary group identity as a number:
2323

24-
`id -g`
24+
`id {{[-g|--group]}}`
2525

2626
- Display an arbitrary user's ID (UID), group ID (GID) and groups to which they belong:
2727

pages/common/picocom.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
- Connect to a serial console with a specified baud rate:
1111

12-
`sudo picocom {{/dev/ttyXYZ}} --baud {{baud_rate}}`
12+
`sudo picocom {{/dev/ttyXYZ}} {{[-b|--baud]}} {{baud_rate}}`
1313

1414
- Map special characters (e.g. `LF` to `CRLF`):
1515

pages/common/su.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@
1717

1818
- Execute a command as another user:
1919

20-
`su - {{username}} -c "{{command}}"`
20+
`su - {{username}} {{[-c|--command]}} "{{command}}"`

pages/common/tcpdump.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
66
- List available network interfaces:
77

8-
`tcpdump -D`
8+
`tcpdump {{[-D|--list-interfaces]}}`
99

1010
- Capture the traffic of a specific interface:
1111

12-
`tcpdump -i {{eth0}}`
12+
`sudo tcpdump {{[-i|--interface]}} {{eth0}}`
1313

1414
- Capture all TCP traffic showing contents (ASCII) in console:
1515

@@ -21,7 +21,7 @@
2121

2222
- Capture the traffic from a specific interface, source, destination and destination port:
2323

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}}`
2525

2626
- Capture the traffic of a network:
2727

pages/common/uniq.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@
1010

1111
- Display only unique lines:
1212

13-
`sort {{path/to/file}} | uniq -u`
13+
`sort {{path/to/file}} | uniq {{[-u|--unique]}}`
1414

1515
- Display only duplicate lines:
1616

17-
`sort {{path/to/file}} | uniq -d`
17+
`sort {{path/to/file}} | uniq {{[-d|--repeated]}}`
1818

1919
- Display number of occurrences of each line along with that line:
2020

21-
`sort {{path/to/file}} | uniq -c`
21+
`sort {{path/to/file}} | uniq {{[-c|--count]}}`
2222

2323
- Display number of occurrences of each line, sorted by the most frequent:
2424

25-
`sort {{path/to/file}} | uniq -c | sort -nr`
25+
`sort {{path/to/file}} | uniq {{[-c|--count]}} | sort {{[-nr|--numeric-sort --reverse]}}`

pages/common/wc.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,24 @@
55
66
- Count all lines in a file:
77

8-
`wc --lines {{path/to/file}}`
8+
`wc {{[-l|--lines]}} {{path/to/file}}`
99

1010
- Count all words in a file:
1111

12-
`wc --words {{path/to/file}}`
12+
`wc {{[-w|--words]}} {{path/to/file}}`
1313

1414
- Count all bytes in a file:
1515

16-
`wc --bytes {{path/to/file}}`
16+
`wc {{[-c|--bytes]}} {{path/to/file}}`
1717

1818
- Count all characters in a file (taking multi-byte characters into account):
1919

20-
`wc --chars {{path/to/file}}`
20+
`wc {{[-m|--chars]}} {{path/to/file}}`
2121

2222
- Count all lines, words and bytes from `stdin`:
2323

2424
`{{find .}} | wc`
2525

2626
- Count the length of the longest line in number of characters:
2727

28-
`wc --max-line-length {{path/to/file}}`
28+
`wc {{[-L|--max-line-length]}} {{path/to/file}}`

pages/common/xargs.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@
1414

1515
- 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):
1616

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`
1818

1919
- Execute the command once per argument:
2020

21-
`{{arguments_source}} | xargs -n1 {{command}}`
21+
`{{arguments_source}} | xargs {{-n|--max-args}} 1 {{command}}`
2222

2323
- Execute the command once for each input line, replacing any occurrences of the placeholder (here marked as `_`) with the input line:
2424

2525
`{{arguments_source}} | xargs -I _ {{command}} _ {{optional_extra_arguments}}`
2626

2727
- 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:
2828

29-
`{{arguments_source}} | xargs -P {{max-procs}} {{command}}`
29+
`{{arguments_source}} | xargs {{[-P|--max-procs]}} {{max-procs}} {{command}}`

pages/linux/cu.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@
55
66
- Open a given serial port:
77

8-
`sudo cu --line {{/dev/ttyXYZ}}`
8+
`sudo cu {{[-l|--line]}} {{/dev/ttyXYZ}}`
99

1010
- Open a given serial port with a given baud rate:
1111

12-
`sudo cu --line {{/dev/ttyXYZ}} --speed {{115200}}`
12+
`sudo cu {{[-l|--line]}} {{/dev/ttyXYZ}} {{[-s|--speed]}} {{115200}}`
1313

1414
- Open a given serial port with a given baud rate and echo characters locally (half-duplex mode):
1515

16-
`sudo cu --line {{/dev/ttyXYZ}} --speed {{115200}} --halfduplex`
16+
`sudo cu {{[-l|--line]}} {{/dev/ttyXYZ}} {{[-s|--speed]}} {{115200}} {{[-h|--halfduplex]}}`
1717

1818
- Open a given serial port with a given baud rate, parity, and no hardware or software flow control:
1919

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`
2121

2222
- Exit the `cu` session when in connection:
2323

pages/linux/dmesg.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,28 @@
99

1010
- Show kernel error messages:
1111

12-
`sudo dmesg --level err`
12+
`sudo dmesg {{[-l|--level]}} err`
1313

1414
- Show kernel messages and keep reading new ones, similar to `tail -f` (available in kernels 3.5.0 and newer):
1515

16-
`sudo dmesg -w`
16+
`sudo dmesg {{[-w|--follow]}}`
1717

1818
- Show how much physical memory is available on this system:
1919

20-
`sudo dmesg | grep -i memory`
20+
`sudo dmesg | grep {{[-i|--ignore-case]}} memory`
2121

2222
- Show kernel messages 1 page at a time:
2323

2424
`sudo dmesg | less`
2525

2626
- Show kernel messages with a timestamp (available in kernels 3.5.0 and newer):
2727

28-
`sudo dmesg -T`
28+
`sudo dmesg {{[-T|--ctime]}}`
2929

3030
- Show kernel messages in human-readable form (available in kernels 3.5.0 and newer):
3131

32-
`sudo dmesg -H`
32+
`sudo dmesg {{[-H|--human]}}`
3333

3434
- Colorize output (available in kernels 3.5.0 and newer):
3535

36-
`sudo dmesg -L`
36+
`sudo dmesg {{[-L|--color]}}`

pages/linux/halt.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@
99

1010
- Power off the system (same as `poweroff`):
1111

12-
`halt --poweroff`
12+
`halt {{[-p|--poweroff]}}`
1313

1414
- Reboot the system (same as `reboot`):
1515

1616
`halt --reboot`
1717

1818
- Halt immediately without contacting the system manager:
1919

20-
`halt --force`
20+
`halt {{[-f|--force]}}`
2121

2222
- Write the wtmp shutdown entry without halting the system:
2323

24-
`halt --wtmp-only`
24+
`halt {{[-w|--wtmp-only]}}`

pages/linux/iostat.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
- Display CPU statistics:
1515

16-
`iostat -c`
16+
`iostat {{[-c|--compact]}}`
1717

1818
- Display disk statistics with disk names (including LVM):
1919

pages/linux/iptables.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,24 @@
66
77
- View chains, rules, packet/byte counters and line numbers for the filter table:
88

9-
`sudo iptables --verbose --numeric --list --line-numbers`
9+
`sudo iptables {{[-vnL --line-numbers|--verbose --numeric --list --line-numbers]}}`
1010

11-
- Set chain [P]olicy rule:
11+
- Set chain policy rule:
1212

13-
`sudo iptables --policy {{chain}} {{rule}}`
13+
`sudo iptables {{[-P|--policy]}} {{chain}} {{rule}}`
1414

15-
- [A]ppend rule to chain policy for IP:
15+
- Append rule to chain policy for IP:
1616

17-
`sudo iptables --append {{chain}} --source {{ip}} --jump {{rule}}`
17+
`sudo iptables {{[-A|--append]}} {{chain}} {{[-s|--source]}} {{ip}} {{[-j|--jump]}} {{rule}}`
1818

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:
2020

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}}`
2222

2323
- Add a NAT rule to translate all traffic from the `192.168.0.0/24` subnet to the host's public IP:
2424

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}}`
2626

27-
- [D]elete chain rule:
27+
- Delete chain rule:
2828

29-
`sudo iptables --delete {{chain}} {{rule_line_number}}`
29+
`sudo iptables {{[-D|--delete]}} {{chain}} {{rule_line_number}}`

pages/linux/minicom.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
66
- Open a given serial port:
77

8-
`sudo minicom --device {{/dev/ttyXYZ}}`
8+
`sudo minicom {{[-D|--device]}} {{/dev/ttyXYZ}}`
99

1010
- Open a given serial port with a given baud rate:
1111

12-
`sudo minicom --device {{/dev/ttyXYZ}} --baudrate {{115200}}`
12+
`sudo minicom {{[-D|--device]}} {{/dev/ttyXYZ}} {{[-b|--baudrate]}} {{115200}}`
1313

1414
- Enter the configuration menu before communicating with a given serial port:
1515

16-
`sudo minicom --device {{/dev/ttyXYZ}} --setup`
16+
`sudo minicom {{[-D|--device]}} {{/dev/ttyXYZ}} {{[-s|--setup]}}`
1717

1818
- Exit minicom:
1919

pages/linux/reboot.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@
99

1010
- Power off the system (same as `poweroff`):
1111

12-
`reboot --poweroff`
12+
`reboot {{[-p|--poweroff]}}`
1313

1414
- Halt (terminates all processes and shuts down the CPU) the system (same as `halt`):
1515

1616
`reboot --halt`
1717

1818
- Reboot immediately without contacting the system manager:
1919

20-
`reboot --force`
20+
`reboot {{[-f|--force]}}`
2121

2222
- Write the wtmp shutdown entry without rebooting the system:
2323

24-
`reboot --wtmp-only`
24+
`reboot {{[-w|--wtmp-only]}}`

pages/linux/rmdir.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010

1111
- Remove specific nested directories recursively:
1212

13-
`rmdir --parents {{path/to/directory1 path/to/directory2 ...}}`
13+
`rmdir {{[-p|--parents]}} {{path/to/directory1 path/to/directory2 ...}}`

pages/linux/shutdown.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99

1010
- [r]eboot immediately:
1111

12-
`shutdown -r now`
12+
`shutdown {{[-r|--reboot]}} now`
1313

1414
- [r]eboot in 5 minutes:
1515

16-
`shutdown -r +{{5}} &`
16+
`shutdown {{[-r|--reboot]}} +{{5}} &`
1717

1818
- Shutdown at 1:00 pm (Uses 24[h] clock):
1919

pages/linux/strace.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@
55
66
- Start tracing a specific [p]rocess by its PID:
77

8-
`strace -p {{pid}}`
8+
`strace {{[-p|--attach]}} {{pid}}`
99

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:
1111

12-
`strace -p {{pid}} -e {{system_call,system_call2,...}}`
12+
`strace {{[-p|--attach]}} {{pid}} -e {{system_call,system_call2,...}}`
1313

1414
- Count time, calls, and errors for each system call and report a summary on program exit:
1515

16-
`strace -p {{pid}} -c`
16+
`strace {{[-p|--attach]}} {{pid}} {{[-c|--summary-only]}}`
1717

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:
1919

20-
`strace -p {{pid}} -T -s {{32}}`
20+
`strace {{[-p|--attach]}} {{pid}} {{[-T|--syscall-times]}} {{[-s|--string-limit]}} {{32}}`
2121

2222
- Start tracing a program by executing it:
2323

@@ -27,6 +27,6 @@
2727

2828
`strace -e trace=file {{program}}`
2929

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:
3131

32-
`strace -f -e trace=network -o {{trace.txt}} {{program}}`
32+
`strace {{[-f|--follow-forks]}} -e trace=network {{[-o|--output]}} {{trace.txt}} {{program}}`

pages/linux/systemctl.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
- List all service/socket/automount units filtering by running/failed state:
3131

32-
`systemctl list-units --type={{service|socket|automount}} --state={{failed|running}}`
32+
`systemctl list-units {{[-t|--type]}} {{service|socket|automount}} --state {{failed|running}}`
3333

3434
- Show the contents & absolute path of a unit file:
3535

0 commit comments

Comments
 (0)