Update cheatsheets

This commit is contained in:
ivuorinen
2025-03-14 00:18:08 +00:00
parent 904f7fe0c1
commit 605e1cdfd8
20 changed files with 97 additions and 68 deletions

View File

@@ -10,19 +10,19 @@ source: https://github.com/tldr-pages/tldr.git
- 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

@@ -14,15 +14,15 @@ source: https://github.com/tldr-pages/tldr.git
- 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:
@@ -30,12 +30,12 @@ source: https://github.com/tldr-pages/tldr.git
- 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

@@ -14,7 +14,7 @@ source: https://github.com/tldr-pages/tldr.git
- Power off the system (same as `poweroff`):
`halt --poweroff`
`halt {{[-p|--poweroff]}}`
- Reboot the system (same as `reboot`):
@@ -22,8 +22,8 @@ source: https://github.com/tldr-pages/tldr.git
- 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

@@ -18,7 +18,7 @@ source: https://github.com/tldr-pages/tldr.git
- Display CPU statistics:
`iostat -c`
`iostat {{[-c|--compact]}}`
- Display disk statistics with disk names (including LVM):

View File

@@ -11,24 +11,24 @@ source: https://github.com/tldr-pages/tldr.git
- 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

@@ -10,15 +10,15 @@ source: https://github.com/tldr-pages/tldr.git
- 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

@@ -14,7 +14,7 @@ source: https://github.com/tldr-pages/tldr.git
- 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`):
@@ -22,8 +22,8 @@ source: https://github.com/tldr-pages/tldr.git
- 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

@@ -15,4 +15,4 @@ source: https://github.com/tldr-pages/tldr.git
- Remove specific nested directories recursively:
`rmdir --parents {{path/to/directory1 path/to/directory2 ...}}`
`rmdir {{[-p|--parents]}} {{path/to/directory1 path/to/directory2 ...}}`

View File

@@ -14,11 +14,11 @@ source: https://github.com/tldr-pages/tldr.git
- [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

@@ -10,19 +10,19 @@ source: https://github.com/tldr-pages/tldr.git
- 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:
@@ -32,6 +32,6 @@ source: https://github.com/tldr-pages/tldr.git
`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

@@ -34,7 +34,7 @@ source: https://github.com/tldr-pages/tldr.git
- 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: