1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-09-10 13:53:52 +02:00

*: add more option placeholders (#15923)

This commit is contained in:
Managor 2025-03-13 04:41:47 +02:00 committed by GitHub
parent 6d3ae965a1
commit 273c654101
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 68 additions and 68 deletions

View file

@ -9,19 +9,19 @@
- Start `htop` displaying processes owned by a specific user:
`htop --user {{username}}`
`htop {{[-u|--user]}} {{username}}`
- Display processes hierarchically in a tree view to show the parent-child relationships:
`htop --tree`
`htop {{[-t|--tree]}}`
- Sort processes by a specified `sort_item` (use `htop --sort help` for available options):
`htop --sort {{sort_item}}`
`htop {{[-s|--sort]}} {{sort_item}}`
- Start `htop` with the specified delay between updates, in tenths of a second (i.e. 50 = 5 seconds):
`htop --delay {{50}}`
`htop {{[-d|--delay]}} {{50}}`
- See interactive commands while running htop:
@ -33,4 +33,4 @@
- Display help:
`htop --help`
`htop {{[-h|--help]}}`

View file

@ -9,19 +9,19 @@
- Display the current user identity:
`id -un`
`id {{[-un|--user --name]}}`
- Display the current user identity as a number:
`id -u`
`id {{[-u|--user]}}`
- Display the current primary group identity:
`id -gn`
`id {{[-gn|--group --name]}}`
- Display the current primary group identity as a number:
`id -g`
`id {{[-g|--group]}}`
- Display an arbitrary user's ID (UID), group ID (GID) and groups to which they belong:

View file

@ -9,7 +9,7 @@
- Connect to a serial console with a specified baud rate:
`sudo picocom {{/dev/ttyXYZ}} --baud {{baud_rate}}`
`sudo picocom {{/dev/ttyXYZ}} {{[-b|--baud]}} {{baud_rate}}`
- Map special characters (e.g. `LF` to `CRLF`):

View file

@ -17,4 +17,4 @@
- Execute a command as another user:
`su - {{username}} -c "{{command}}"`
`su - {{username}} {{[-c|--command]}} "{{command}}"`

View file

@ -5,11 +5,11 @@
- List available network interfaces:
`tcpdump -D`
`tcpdump {{[-D|--list-interfaces]}}`
- Capture the traffic of a specific interface:
`tcpdump -i {{eth0}}`
`sudo tcpdump {{[-i|--interface]}} {{eth0}}`
- Capture all TCP traffic showing contents (ASCII) in console:
@ -21,7 +21,7 @@
- Capture the traffic from a specific interface, source, destination and destination port:
`tcpdump -i {{eth0}} src {{192.168.1.1}} and dst {{192.168.1.2}} and dst port {{80}}`
`tcpdump {{[-i|--interface]} {{eth0}} src {{192.168.1.1}} and dst {{192.168.1.2}} and dst port {{80}}`
- Capture the traffic of a network:

View file

@ -10,16 +10,16 @@
- Display only unique lines:
`sort {{path/to/file}} | uniq -u`
`sort {{path/to/file}} | uniq {{[-u|--unique]}}`
- Display only duplicate lines:
`sort {{path/to/file}} | uniq -d`
`sort {{path/to/file}} | uniq {{[-d|--repeated]}}`
- Display number of occurrences of each line along with that line:
`sort {{path/to/file}} | uniq -c`
`sort {{path/to/file}} | uniq {{[-c|--count]}}`
- Display number of occurrences of each line, sorted by the most frequent:
`sort {{path/to/file}} | uniq -c | sort -nr`
`sort {{path/to/file}} | uniq {{[-c|--count]}} | sort {{[-nr|--numeric-sort --reverse]}}`

View file

@ -5,19 +5,19 @@
- Count all lines in a file:
`wc --lines {{path/to/file}}`
`wc {{[-l|--lines]}} {{path/to/file}}`
- Count all words in a file:
`wc --words {{path/to/file}}`
`wc {{[-w|--words]}} {{path/to/file}}`
- Count all bytes in a file:
`wc --bytes {{path/to/file}}`
`wc {{[-c|--bytes]}} {{path/to/file}}`
- Count all characters in a file (taking multi-byte characters into account):
`wc --chars {{path/to/file}}`
`wc {{[-m|--chars]}} {{path/to/file}}`
- Count all lines, words and bytes from `stdin`:
@ -25,4 +25,4 @@
- Count the length of the longest line in number of characters:
`wc --max-line-length {{path/to/file}}`
`wc {{[-L|--max-line-length]}} {{path/to/file}}`

View file

@ -14,11 +14,11 @@
- 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):
`find . -name '*.log' -print0 | xargs -0 -P {{4}} -n 1 gzip`
`find . -name '*.log' -print0 | xargs {{[-0|--null]}} {{[-P|--max-procs]}} {{4}} {{[-n|--max-args]}} 1 gzip`
- Execute the command once per argument:
`{{arguments_source}} | xargs -n1 {{command}}`
`{{arguments_source}} | xargs {{-n|--max-args}} 1 {{command}}`
- Execute the command once for each input line, replacing any occurrences of the placeholder (here marked as `_`) with the input line:
@ -26,4 +26,4 @@
- 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:
`{{arguments_source}} | xargs -P {{max-procs}} {{command}}`
`{{arguments_source}} | xargs {{[-P|--max-procs]}} {{max-procs}} {{command}}`

View file

@ -5,19 +5,19 @@
- Open a given serial port:
`sudo cu --line {{/dev/ttyXYZ}}`
`sudo cu {{[-l|--line]}} {{/dev/ttyXYZ}}`
- Open a given serial port with a given baud rate:
`sudo cu --line {{/dev/ttyXYZ}} --speed {{115200}}`
`sudo cu {{[-l|--line]}} {{/dev/ttyXYZ}} {{[-s|--speed]}} {{115200}}`
- Open a given serial port with a given baud rate and echo characters locally (half-duplex mode):
`sudo cu --line {{/dev/ttyXYZ}} --speed {{115200}} --halfduplex`
`sudo cu {{[-l|--line]}} {{/dev/ttyXYZ}} {{[-s|--speed]}} {{115200}} {{[-h|--halfduplex]}}`
- Open a given serial port with a given baud rate, parity, and no hardware or software flow control:
`sudo cu --line {{/dev/ttyXYZ}} --speed {{115200}} --parity={{even|odd|none}} --nortscts --nostop`
`sudo cu {{[-l|--line]}} {{/dev/ttyXYZ}} {{[-s|--speed]}} {{115200}} --parity={{even|odd|none}} {{[-f|--nortscts]}} --nostop`
- Exit the `cu` session when in connection:

View file

@ -9,15 +9,15 @@
- Show kernel error messages:
`sudo dmesg --level err`
`sudo dmesg {{[-l|--level]}} err`
- Show kernel messages and keep reading new ones, similar to `tail -f` (available in kernels 3.5.0 and newer):
`sudo dmesg -w`
`sudo dmesg {{[-w|--follow]}}`
- Show how much physical memory is available on this system:
`sudo dmesg | grep -i memory`
`sudo dmesg | grep {{[-i|--ignore-case]}} memory`
- Show kernel messages 1 page at a time:
@ -25,12 +25,12 @@
- Show kernel messages with a timestamp (available in kernels 3.5.0 and newer):
`sudo dmesg -T`
`sudo dmesg {{[-T|--ctime]}}`
- Show kernel messages in human-readable form (available in kernels 3.5.0 and newer):
`sudo dmesg -H`
`sudo dmesg {{[-H|--human]}}`
- Colorize output (available in kernels 3.5.0 and newer):
`sudo dmesg -L`
`sudo dmesg {{[-L|--color]}}`

View file

@ -9,7 +9,7 @@
- Power off the system (same as `poweroff`):
`halt --poweroff`
`halt {{[-p|--poweroff]}}`
- Reboot the system (same as `reboot`):
@ -17,8 +17,8 @@
- Halt immediately without contacting the system manager:
`halt --force`
`halt {{[-f|--force]}}`
- Write the wtmp shutdown entry without halting the system:
`halt --wtmp-only`
`halt {{[-w|--wtmp-only]}}`

View file

@ -13,7 +13,7 @@
- Display CPU statistics:
`iostat -c`
`iostat {{[-c|--compact]}}`
- Display disk statistics with disk names (including LVM):

View file

@ -6,24 +6,24 @@
- View chains, rules, packet/byte counters and line numbers for the filter table:
`sudo iptables --verbose --numeric --list --line-numbers`
`sudo iptables {{[-vnL --line-numbers|--verbose --numeric --list --line-numbers]}}`
- Set chain [P]olicy rule:
- Set chain policy rule:
`sudo iptables --policy {{chain}} {{rule}}`
`sudo iptables {{[-P|--policy]}} {{chain}} {{rule}}`
- [A]ppend rule to chain policy for IP:
- Append rule to chain policy for IP:
`sudo iptables --append {{chain}} --source {{ip}} --jump {{rule}}`
`sudo iptables {{[-A|--append]}} {{chain}} {{[-s|--source]}} {{ip}} {{[-j|--jump]}} {{rule}}`
- [A]ppend rule to chain policy for IP considering [p]rotocol and port:
- Append rule to chain policy for IP considering protocol and port:
`sudo iptables --append {{chain}} --source {{ip}} --protocol {{tcp|udp|icmp|...}} --dport {{port}} --jump {{rule}}`
`sudo iptables {{[-A|--append]}} {{chain}} {{[-s|--source]}} {{ip}} {{[-p|--protocol]}} {{tcp|udp|icmp|...}} --dport {{port}} {{[-j|--jump]}} {{rule}}`
- Add a NAT rule to translate all traffic from the `192.168.0.0/24` subnet to the host's public IP:
`sudo iptables --table {{nat}} --append {{POSTROUTING}} --source {{192.168.0.0/24}} --jump {{MASQUERADE}}`
`sudo iptables {{[-t|--table]}} {{nat}} {{[-A|--append]}} {{POSTROUTING}} {{[-s|--source]}} {{192.168.0.0/24}} {{[-j|--jump]}} {{MASQUERADE}}`
- [D]elete chain rule:
- Delete chain rule:
`sudo iptables --delete {{chain}} {{rule_line_number}}`
`sudo iptables {{[-D|--delete]}} {{chain}} {{rule_line_number}}`

View file

@ -5,15 +5,15 @@
- Open a given serial port:
`sudo minicom --device {{/dev/ttyXYZ}}`
`sudo minicom {{[-D|--device]}} {{/dev/ttyXYZ}}`
- Open a given serial port with a given baud rate:
`sudo minicom --device {{/dev/ttyXYZ}} --baudrate {{115200}}`
`sudo minicom {{[-D|--device]}} {{/dev/ttyXYZ}} {{[-b|--baudrate]}} {{115200}}`
- Enter the configuration menu before communicating with a given serial port:
`sudo minicom --device {{/dev/ttyXYZ}} --setup`
`sudo minicom {{[-D|--device]}} {{/dev/ttyXYZ}} {{[-s|--setup]}}`
- Exit minicom:

View file

@ -9,7 +9,7 @@
- Power off the system (same as `poweroff`):
`reboot --poweroff`
`reboot {{[-p|--poweroff]}}`
- Halt (terminates all processes and shuts down the CPU) the system (same as `halt`):
@ -17,8 +17,8 @@
- Reboot immediately without contacting the system manager:
`reboot --force`
`reboot {{[-f|--force]}}`
- Write the wtmp shutdown entry without rebooting the system:
`reboot --wtmp-only`
`reboot {{[-w|--wtmp-only]}}`

View file

@ -10,4 +10,4 @@
- Remove specific nested directories recursively:
`rmdir --parents {{path/to/directory1 path/to/directory2 ...}}`
`rmdir {{[-p|--parents]}} {{path/to/directory1 path/to/directory2 ...}}`

View file

@ -9,11 +9,11 @@
- [r]eboot immediately:
`shutdown -r now`
`shutdown {{[-r|--reboot]}} now`
- [r]eboot in 5 minutes:
`shutdown -r +{{5}} &`
`shutdown {{[-r|--reboot]}} +{{5}} &`
- Shutdown at 1:00 pm (Uses 24[h] clock):

View file

@ -5,19 +5,19 @@
- Start tracing a specific [p]rocess by its PID:
`strace -p {{pid}}`
`strace {{[-p|--attach]}} {{pid}}`
- Trace a [p]rocess and filt[e]r output by system call:
- Trace a [p]rocess and filter output by system call [e]xpression:
`strace -p {{pid}} -e {{system_call,system_call2,...}}`
`strace {{[-p|--attach]}} {{pid}} -e {{system_call,system_call2,...}}`
- Count time, calls, and errors for each system call and report a summary on program exit:
`strace -p {{pid}} -c`
`strace {{[-p|--attach]}} {{pid}} {{[-c|--summary-only]}}`
- Show the [T]ime spent in every system call and specify the maximum string [s]ize to print:
- Show the time spent in every system call and specify the maximum string size to print:
`strace -p {{pid}} -T -s {{32}}`
`strace {{[-p|--attach]}} {{pid}} {{[-T|--syscall-times]}} {{[-s|--string-limit]}} {{32}}`
- Start tracing a program by executing it:
@ -27,6 +27,6 @@
`strace -e trace=file {{program}}`
- Start tracing network operations of a program as well as all its [f]orked and child processes, saving the [o]utput to a file:
- Start tracing network operations of a program as well as all its forked and child processes, saving the output to a file:
`strace -f -e trace=network -o {{trace.txt}} {{program}}`
`strace {{[-f|--follow-forks]}} -e trace=network {{[-o|--output]}} {{trace.txt}} {{program}}`

View file

@ -29,7 +29,7 @@
- List all service/socket/automount units filtering by running/failed state:
`systemctl list-units --type={{service|socket|automount}} --state={{failed|running}}`
`systemctl list-units {{[-t|--type]}} {{service|socket|automount}} --state {{failed|running}}`
- Show the contents & absolute path of a unit file: