From 605e1cdfd86dafd61e7ea221a26e0ddaf24e7a0a Mon Sep 17 00:00:00 2001 From: ivuorinen Date: Fri, 14 Mar 2025 00:18:08 +0000 Subject: [PATCH] Update cheatsheets --- tldr/htop | 10 +++++----- tldr/id | 8 ++++---- tldr/linux/cu | 8 ++++---- tldr/linux/dmesg | 12 ++++++------ tldr/linux/halt | 6 +++--- tldr/linux/iostat | 2 +- tldr/linux/iptables | 20 ++++++++++---------- tldr/linux/minicom | 6 +++--- tldr/linux/reboot | 6 +++--- tldr/linux/rmdir | 2 +- tldr/linux/shutdown | 4 ++-- tldr/linux/strace | 16 ++++++++-------- tldr/linux/systemctl | 2 +- tldr/picocom | 2 +- tldr/su | 2 +- tldr/sunos/share | 29 +++++++++++++++++++++++++++++ tldr/tcpdump | 6 +++--- tldr/uniq | 8 ++++---- tldr/wc | 10 +++++----- tldr/xargs | 6 +++--- 20 files changed, 97 insertions(+), 68 deletions(-) create mode 100644 tldr/sunos/share diff --git a/tldr/htop b/tldr/htop index 5f059695..249cc601 100644 --- a/tldr/htop +++ b/tldr/htop @@ -14,19 +14,19 @@ source: https://github.com/tldr-pages/tldr.git - 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: @@ -38,4 +38,4 @@ source: https://github.com/tldr-pages/tldr.git - Display help: -`htop --help` +`htop {{[-h|--help]}}` diff --git a/tldr/id b/tldr/id index ab76d9e3..5ccf467e 100644 --- a/tldr/id +++ b/tldr/id @@ -14,19 +14,19 @@ source: https://github.com/tldr-pages/tldr.git - 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: diff --git a/tldr/linux/cu b/tldr/linux/cu index 5fefcb52..2f786719 100644 --- a/tldr/linux/cu +++ b/tldr/linux/cu @@ -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: diff --git a/tldr/linux/dmesg b/tldr/linux/dmesg index 43c37b82..0f9f8787 100644 --- a/tldr/linux/dmesg +++ b/tldr/linux/dmesg @@ -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]}}` diff --git a/tldr/linux/halt b/tldr/linux/halt index 9b3c8da7..a3a44fea 100644 --- a/tldr/linux/halt +++ b/tldr/linux/halt @@ -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]}}` diff --git a/tldr/linux/iostat b/tldr/linux/iostat index d440bfc4..77b50803 100644 --- a/tldr/linux/iostat +++ b/tldr/linux/iostat @@ -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): diff --git a/tldr/linux/iptables b/tldr/linux/iptables index c1a6b81f..748870c7 100644 --- a/tldr/linux/iptables +++ b/tldr/linux/iptables @@ -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}}` diff --git a/tldr/linux/minicom b/tldr/linux/minicom index c9ed5e16..6ecd5f0d 100644 --- a/tldr/linux/minicom +++ b/tldr/linux/minicom @@ -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: diff --git a/tldr/linux/reboot b/tldr/linux/reboot index db1c5693..ef87d18d 100644 --- a/tldr/linux/reboot +++ b/tldr/linux/reboot @@ -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]}}` diff --git a/tldr/linux/rmdir b/tldr/linux/rmdir index 0af4d5b9..b17c57cc 100644 --- a/tldr/linux/rmdir +++ b/tldr/linux/rmdir @@ -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 ...}}` diff --git a/tldr/linux/shutdown b/tldr/linux/shutdown index 9f01072d..6863eb9a 100644 --- a/tldr/linux/shutdown +++ b/tldr/linux/shutdown @@ -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): diff --git a/tldr/linux/strace b/tldr/linux/strace index 52e2d048..af622303 100644 --- a/tldr/linux/strace +++ b/tldr/linux/strace @@ -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}}` diff --git a/tldr/linux/systemctl b/tldr/linux/systemctl index a3a5588a..becd049e 100644 --- a/tldr/linux/systemctl +++ b/tldr/linux/systemctl @@ -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: diff --git a/tldr/picocom b/tldr/picocom index c9d4e284..0b31f628 100644 --- a/tldr/picocom +++ b/tldr/picocom @@ -14,7 +14,7 @@ source: https://github.com/tldr-pages/tldr.git - 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`): diff --git a/tldr/su b/tldr/su index c6b296da..cc277ccf 100644 --- a/tldr/su +++ b/tldr/su @@ -22,4 +22,4 @@ source: https://github.com/tldr-pages/tldr.git - Execute a command as another user: -`su - {{username}} -c "{{command}}"` +`su - {{username}} {{[-c|--command]}} "{{command}}"` diff --git a/tldr/sunos/share b/tldr/sunos/share new file mode 100644 index 00000000..2c7e1c97 --- /dev/null +++ b/tldr/sunos/share @@ -0,0 +1,29 @@ +--- +syntax: markdown +tags: [tldr, sunos] +source: https://github.com/tldr-pages/tldr.git +--- +# share + +> Make local resource/filesystem available for mounting by remote systems. +> More information: . + +- List all currently shared file systems: + +`share` + +- Share a directory with read/write access: + +`share -F nfs -o rw {{/path/to/directory}}` + +- Share a directory with read-only access: + +`share -F nfs -o ro {{/path/to/directory}}` + +- Share a directory with specific options (e.g., allow root access from a specific host): + +`share -F nfs -o rw,root={{hostname}} {{/path/to/directory}}` + +- Make sharing persistent by adding entries to `/etc/dfs/dfstab`: + +`echo "share -F nfs -o rw {{/path/to/directory}}" >> /etc/dfs/dfstab` diff --git a/tldr/tcpdump b/tldr/tcpdump index 06a66e5f..36e6a909 100644 --- a/tldr/tcpdump +++ b/tldr/tcpdump @@ -10,11 +10,11 @@ source: https://github.com/tldr-pages/tldr.git - 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: @@ -26,7 +26,7 @@ source: https://github.com/tldr-pages/tldr.git - 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: diff --git a/tldr/uniq b/tldr/uniq index 0a0b570a..1cca9046 100644 --- a/tldr/uniq +++ b/tldr/uniq @@ -15,16 +15,16 @@ source: https://github.com/tldr-pages/tldr.git - 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]}}` diff --git a/tldr/wc b/tldr/wc index 9bf54996..0d43f186 100644 --- a/tldr/wc +++ b/tldr/wc @@ -10,19 +10,19 @@ source: https://github.com/tldr-pages/tldr.git - 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`: @@ -30,4 +30,4 @@ source: https://github.com/tldr-pages/tldr.git - 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}}` diff --git a/tldr/xargs b/tldr/xargs index 9485121b..eef24496 100644 --- a/tldr/xargs +++ b/tldr/xargs @@ -19,11 +19,11 @@ source: https://github.com/tldr-pages/tldr.git - 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: @@ -31,4 +31,4 @@ source: https://github.com/tldr-pages/tldr.git - 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}}`