Update cheatsheets

This commit is contained in:
ivuorinen
2025-03-12 00:18:03 +00:00
parent 4ed84edbe1
commit ffbd8c31db
29 changed files with 244 additions and 70 deletions

View File

@@ -13,30 +13,30 @@ source: https://github.com/tldr-pages/tldr.git
`curl {{https://example.com}}`
- Make an HTTP GET request, fo[L]low any `3xx` redirects, and [D]ump the reply headers and contents to `stdout`:
- Make an HTTP GET request, follow any `3xx` redirects, and dump the reply headers and contents to `stdout`:
`curl --location --dump-header - {{https://example.com}}`
`curl {{[-L|--location]}} {{[-D|--dump-header]}} - {{https://example.com}}`
- Download a file, saving the [O]utput under the filename indicated by the URL:
- Download a file, saving the output under the filename indicated by the URL:
`curl --remote-name {{https://example.com/filename.zip}}`
`curl {{[-O|--remote-name]}} {{https://example.com/filename.zip}}`
- Send form-encoded [d]ata (POST request of type `application/x-www-form-urlencoded`). Use `--data @file_name` or `--data @'-'` to read from `stdin`:
- Send form-encoded data (POST request of type `application/x-www-form-urlencoded`). Use `--data @file_name` or `--data @'-'` to read from `stdin`:
`curl -X POST --data {{'name=bob'}} {{http://example.com/form}}`
`curl {{[-X|--request]}} POST {{[-d|--data]}} {{'name=bob'}} {{http://example.com/form}}`
- Send a request with an extra header, using a custom HTTP method and over a pro[x]y (such as BurpSuite), ignoring insecure self-signed certificates:
- Send a request with an extra header, using a custom HTTP method and over a proxy (such as BurpSuite), ignoring insecure self-signed certificates:
`curl -k --proxy {{http://127.0.0.1:8080}} --header {{'Authorization: Bearer token'}} --request {{GET|PUT|POST|DELETE|PATCH|...}} {{https://example.com}}`
`curl {{[-k|--insecure]}} {{[-x|--proxy]}} {{http://127.0.0.1:8080}} {{[-H|--header]}} {{'Authorization: Bearer token'}} {{[-X|--request]}} {{GET|PUT|POST|DELETE|PATCH|...}} {{https://example.com}}`
- Send data in JSON format, specifying the appropriate Content-Type [H]eader:
- Send data in JSON format, specifying the appropriate Content-Type header:
`curl --data {{'{"name":"bob"}'}} --header {{'Content-Type: application/json'}} {{http://example.com/users/1234}}`
`curl {{[-d|--data]}} {{'{"name":"bob"}'}} {{[-H|--header]}} {{'Content-Type: application/json'}} {{http://example.com/users/1234}}`
- Pass client certificate and key for a resource, skipping certificate validation:
`curl --cert {{client.pem}} --key {{key.pem}} --insecure {{https://example.com}}`
`curl {{[-E|--cert]}} {{client.pem}} --key {{key.pem}} {{[-k|--insecure]}} {{https://example.com}}`
- Resolve a hostname to a custom IP address, with [v]erbose output (similar to editing the `/etc/hosts` file for custom DNS resolution):
- Resolve a hostname to a custom IP address, with verbose output (similar to editing the `/etc/hosts` file for custom DNS resolution):
`curl --verbose --resolve {{example.com}}:{{80}}:{{127.0.0.1}} {{http://example.com}}`
`curl {{[-v|--verbose]}} --resolve {{example.com}}:{{80}}:{{127.0.0.1}} {{http://example.com}}`

View File

@@ -14,16 +14,16 @@ source: https://github.com/tldr-pages/tldr.git
- Look inside a zipped file and determine the file type(s) inside:
`file -z {{foo.zip}}`
`file {{[-z|--uncompress]}} {{foo.zip}}`
- Allow file to work with special or device files:
`file -s {{path/to/file}}`
`file {{[-s|--special-files]}} {{path/to/file}}`
- Don't stop at first file type match; keep going until the end of the file:
`file -k {{path/to/file}}`
`file {{[-k|--keep-going]}} {{path/to/file}}`
- Determine the MIME encoding type of a file:
`file -i {{path/to/file}}`
`file {{[-i|--mime]}} {{path/to/file}}`

View File

@@ -14,15 +14,15 @@ source: https://github.com/tldr-pages/tldr.git
- Attach a process to gdb:
`gdb -p {{procID}}`
`gdb {{[-p|--pid]}} {{procID}}`
- Debug with a core file:
`gdb -c {{core}} {{executable}}`
`gdb {{[-c|--core]}} {{core}} {{executable}}`
- Execute given GDB commands upon start:
`gdb -ex "{{commands}}" {{executable}}`
`gdb {{[-ex|--eval-command]}} "{{commands}}" {{executable}}`
- Start `gdb` and pass arguments to the executable:
@@ -30,4 +30,4 @@ source: https://github.com/tldr-pages/tldr.git
- Skip debuginfod and pagination prompts and then print the backtrace:
`gdb -c {{core}} {{executable}} -iex 'set debuginfod enabled on' -iex 'set pagination off' -ex bt`
`gdb {{[-c|--core]}} {{core}} {{executable}} -iex 'set debuginfod enabled on' -iex 'set pagination off' -ex bt`

13
tldr/gettext Normal file
View File

@@ -0,0 +1,13 @@
---
syntax: markdown
tags: [tldr, common]
source: https://github.com/tldr-pages/tldr.git
---
# gettext
> Get string translations.
> More information: <https://www.gnu.org/software/gettext/manual/html_node/gettext-Invocation.html>.
- Get the translation of a string or output a default string if it doesn't exist:
`LANGUAGE={{locale}} gettext {{msgid}} {{default_value}}`

View File

@@ -9,7 +9,7 @@ source: https://github.com/tldr-pages/tldr.git
> See also `git checkout` and `git reset`.
> More information: <https://git-scm.com/docs/git-restore>.
- Restore an unstaged file to the version of the current commit (HEAD):
- Restore an unstaged file to the staged version:
`git restore {{path/to/file}}`

View File

@@ -12,21 +12,21 @@ source: https://github.com/tldr-pages/tldr.git
`cal`
- Display [3] months spanning the date:
- Display 3 months spanning the date:
`cal -3`
`cal {{[-3|--three]}}`
- Display the whole calendar for the current [y]ear:
`cal --year`
`cal {{[-y|--year]}}`
- Display the next twelve months:
`cal --twelve`
`cal {{[-Y|--twelve]}}`
- Use Monday as the first day of the week:
`cal --monday`
`cal {{[-m|--monday]}}`
- Display a calendar for a specific year (4 digits):

View File

@@ -26,8 +26,8 @@ source: https://github.com/tldr-pages/tldr.git
- [n]umber all output lines:
`cat -n {{path/to/file}}`
`cat {{[-n|--number]}} {{path/to/file}}`
- Display non-printable and whitespace characters (with `M-` prefix if non-ASCII):
`cat -v -t -e {{path/to/file}}`
`cat {{[-vte|--show-nonprinting -t -e]}} {{path/to/file}}`

View File

@@ -10,19 +10,19 @@ source: https://github.com/tldr-pages/tldr.git
- Open a given serial port:
`sudo cu --line {{/dev/ttyUSB0}}`
`sudo cu --line {{/dev/ttyXYZ}}`
- Open a given serial port with a given baud rate:
`sudo cu --line {{/dev/ttyUSB0}} --speed {{115200}}`
`sudo cu --line {{/dev/ttyXYZ}} --speed {{115200}}`
- Open a given serial port with a given baud rate and echo characters locally (half-duplex mode):
`sudo cu --line {{/dev/ttyUSB0}} --speed {{115200}} --halfduplex`
`sudo cu --line {{/dev/ttyXYZ}} --speed {{115200}} --halfduplex`
- Open a given serial port with a given baud rate, parity, and no hardware or software flow control:
`sudo cu --line {{/dev/ttyUSB0}} --speed {{115200}} --parity={{even|odd|none}} --nortscts --nostop`
`sudo cu --line {{/dev/ttyXYZ}} --speed {{115200}} --parity={{even|odd|none}} --nortscts --nostop`
- Exit the `cu` session when in connection:

View File

@@ -14,7 +14,7 @@ source: https://github.com/tldr-pages/tldr.git
- Open the man page for a command in a browser (`BROWSER` environment variable can replace `=browser_name`):
`man --html{{=browser_name}} {{command}}`
`man {{[-H|--html=]}}{{browser_name}} {{command}}`
- Display the man page for a command from section 7:
@@ -22,20 +22,20 @@ source: https://github.com/tldr-pages/tldr.git
- List all available sections for a command:
`man --whatis {{command}}`
`man {{[-f|--whatis]}} {{command}}`
- Display the path searched for manpages:
`man --path`
`man {{[-w|--path]}}`
- Display the location of a manpage rather than the manpage itself:
`man --where {{command}}`
`man {{[-w|--where]}} {{command}}`
- Display the man page using a specific locale:
`man --locale {{locale}} {{command}}`
`man {{[-L|--locale]}} {{locale}} {{command}}`
- Search for manpages containing a search string:
`man --apropos "{{search_string}}"`
`man {{[-k|--apropos]}} "{{search_string}}"`

View File

@@ -10,12 +10,16 @@ source: https://github.com/tldr-pages/tldr.git
- Open a given serial port:
`sudo minicom --device {{/dev/ttyUSB0}}`
`sudo minicom --device {{/dev/ttyXYZ}}`
- Open a given serial port with a given baud rate:
`sudo minicom --device {{/dev/ttyUSB0}} --baudrate {{115200}}`
`sudo minicom --device {{/dev/ttyXYZ}} --baudrate {{115200}}`
- Enter the configuration menu before communicating with a given serial port:
`sudo minicom --device {{/dev/ttyUSB0}} --setup`
`sudo minicom --device {{/dev/ttyXYZ}} --setup`
- Exit minicom:
`<Ctrl a><x><Enter>`

17
tldr/linux/pw-reserve Normal file
View File

@@ -0,0 +1,17 @@
---
syntax: markdown
tags: [tldr, linux]
source: https://github.com/tldr-pages/tldr.git
---
# pw-reserve
> Reserve a device for PipeWire.
> More information: <https://docs.pipewire.org/page_man_pw-reserve_1.html>.
- Reserve a device (currently only supports audio devices):
`pw-reserve {{[-n|--name]}} {{audioN}}`
- Monitor a device instead of reserving it:
`pw-reserve {{[-n|--name]}} {{audioN}} {{[-m|--monitor]}}`

13
tldr/linux/pw-v4l2 Normal file
View File

@@ -0,0 +1,13 @@
---
syntax: markdown
tags: [tldr, linux]
source: https://github.com/tldr-pages/tldr.git
---
# pw-v4l2
> Use v4l2 programs within PipeWire.
> More information: <https://docs.pipewire.org/page_man_pw-v4l2_1.html>.
- Run a program:
`pw-v4l2 {{program}}`

12
tldr/linux/trash-empty Normal file
View File

@@ -0,0 +1,12 @@
---
syntax: markdown
tags: [tldr, linux]
source: https://github.com/tldr-pages/tldr.git
---
# trash-empty
> This command has been moved to `trash`.
- View documentation for `trash-empty`:
`tldr trash`

12
tldr/linux/trash-list Normal file
View File

@@ -0,0 +1,12 @@
---
syntax: markdown
tags: [tldr, linux]
source: https://github.com/tldr-pages/tldr.git
---
# trash-list
> This command has been moved to `trash`.
- View documentation for `trash-list`:
`tldr trash`

12
tldr/linux/trash-put Normal file
View File

@@ -0,0 +1,12 @@
---
syntax: markdown
tags: [tldr, linux]
source: https://github.com/tldr-pages/tldr.git
---
# trash-put
> This command is an alias of `trash`.
- View documentation for the original command:
`tldr trash`

12
tldr/linux/trash-restore Normal file
View File

@@ -0,0 +1,12 @@
---
syntax: markdown
tags: [tldr, linux]
source: https://github.com/tldr-pages/tldr.git
---
# trash-restore
> This command has been moved to `trash`.
- View documentation for `trash-restore`:
`tldr trash`

12
tldr/linux/trash-rm Normal file
View File

@@ -0,0 +1,12 @@
---
syntax: markdown
tags: [tldr, linux]
source: https://github.com/tldr-pages/tldr.git
---
# trash-rm
> This command has been moved to `trash`.
- View documentation for `trash-rm`:
`tldr trash`

View File

@@ -10,15 +10,15 @@ source: https://github.com/tldr-pages/tldr.git
- Display power and battery information:
`upower --dump`
`upower {{[-d|--dump]}}`
- List all power devices:
`upower --enumerate`
`upower {{[-e|--enumerate]}}`
- Watch for and print power status changes:
`upower --monitor`
`upower {{[-m|--monitor]}}`
- Watch for and print detailed power status changes:
@@ -26,4 +26,4 @@ source: https://github.com/tldr-pages/tldr.git
- Display version:
`upower --version`
`upower {{[-v|--version]}}`

View File

@@ -14,23 +14,23 @@ source: https://github.com/tldr-pages/tldr.git
- Mount a device to a directory:
`mount -t {{filesystem_type}} {{path/to/device_file}} {{path/to/target_directory}}`
`mount {{[-t|--types]}} {{filesystem_type}} {{path/to/device_file}} {{path/to/target_directory}}`
- Create a specific directory if it does not exist and mount a device to it:
`mount --mkdir {{path/to/device_file}} {{path/to/target_directory}}`
`mount {{[-m|--mkdir]}} {{path/to/device_file}} {{path/to/target_directory}}`
- Mount a device to a directory for a specific user:
`mount -o uid={{user_id}},gid={{group_id}} {{path/to/device_file}} {{path/to/target_directory}}`
`mount {{[-o|--options]}} uid={{user_id}},gid={{group_id}} {{path/to/device_file}} {{path/to/target_directory}}`
- Mount a CD-ROM device (with the filetype ISO9660) to `/cdrom` (readonly):
`mount -t {{iso9660}} -o ro {{/dev/cdrom}} {{/cdrom}}`
`mount {{[-t|--types]}} {{iso9660}} {{[-o|--options]}} ro {{/dev/cdrom}} {{/cdrom}}`
- Mount all the filesystem defined in `/etc/fstab`:
`mount -a`
`mount {{[-a|--all]}}`
- Mount a specific filesystem described in `/etc/fstab` (e.g. `/dev/sda1 /my_drive ext2 defaults 0 2`):
@@ -38,4 +38,4 @@ source: https://github.com/tldr-pages/tldr.git
- Mount a directory to another directory:
`mount --bind {{path/to/old_dir}} {{path/to/new_dir}}`
`mount {{[-B|--bind]}} {{path/to/old_dir}} {{path/to/new_dir}}`

View File

@@ -8,6 +8,10 @@ source: https://github.com/tldr-pages/tldr.git
> Compile message catalog to binary format.
> More information: <https://www.gnu.org/software/gettext/manual/html_node/msgfmt-Invocation.html>.
- Compile a file to `messages.mo`:
`msgfmt {{file.po}}`
- Convert a `.po` file to a `.mo` file:
`msgfmt {{path/to/file.po}} -o {{path/to/file.mo}}`
`msgfmt {{path/to/file.po}} {{[-o|--output-file]}} {{path/to/file.mo}}`

17
tldr/msginit Normal file
View File

@@ -0,0 +1,17 @@
---
syntax: markdown
tags: [tldr, common]
source: https://github.com/tldr-pages/tldr.git
---
# msginit
> Generate language specific translation files based on Portable Object Templates.
> More information: <https://www.gnu.org/software/gettext/manual/html_node/msginit-Invocation.html>.
- Generate Portable Object files in system locale from `messages.pot`:
`msginit`
- Define locale to generate from a specific template:
`msginit {{[-l|--locale]}} {{locale}} {{[-i|--input]}} {{path/to/messages.pot}}`

13
tldr/msgmerge Normal file
View File

@@ -0,0 +1,13 @@
---
syntax: markdown
tags: [tldr, common]
source: https://github.com/tldr-pages/tldr.git
---
# Exclamation mark
> Update an existing translation file from a new template.
> More information: <https://www.gnu.org/software/gettext/manual/html_node/msgmerge-Invocation.html>.
- Update a translation file:
`msgmerge {{[-U|--update]}} {{path/to/file.po}} {{path/to/messages.pot}}`

25
tldr/o Normal file
View File

@@ -0,0 +1,25 @@
---
syntax: markdown
tags: [tldr, common]
source: https://github.com/tldr-pages/tldr.git
---
# o
> Orbiton, a simple configuration-free text editor.
> More information: <https://github.com/xyproto/orbiton>.
- Open a file in editor:
`o {{path/to/file}}`
- Open a file as read-only:
`o {{[-m|-monitor]}} {{path/to/file}}`
- Save the file:
`<Ctrl s>`
- Quit Orbiton:
`<Ctrl q>`

View File

@@ -8,10 +8,18 @@ source: https://github.com/tldr-pages/tldr.git
> Minimal program to emulate serial consoles.
> More information: <https://manned.org/picocom>.
- Connect to a serial console with the default baud rate of 9600:
`sudo picocom {{/dev/ttyXYZ}}`
- Connect to a serial console with a specified baud rate:
`picocom {{/dev/ttyXYZ}} --baud {{baud_rate}}`
`sudo picocom {{/dev/ttyXYZ}} --baud {{baud_rate}}`
- Map special characters (e.g. `LF` to `CRLF`):
`picocom {{/dev/ttyXYZ}} --imap {{lfcrlf}}`
`sudo picocom {{/dev/ttyXYZ}} --imap {{lfcrlf}}`
- Exit picocom:
`<Ctrl a><Ctrl x>`

View File

@@ -22,16 +22,16 @@ source: https://github.com/tldr-pages/tldr.git
- List all processes of the current user in extra full format:
`ps --user $(id -u) -F`
`ps {{[-u|--user]}} $(id {{[-u|--user]}}) -F`
- List all processes of the current user as a tree:
`ps --user $(id -u) f`
`ps {{[-u|--user]}} $(id {{[-u|--user]}}) {{[f|--forest]}}`
- Get the parent PID of a process:
`ps -o ppid= -p {{pid}}`
`ps {{[-o|--format]}} ppid= {{[-p|--pid]}} {{pid}}`
- Sort processes by memory consumption:
`ps --sort size`
`ps {{[k|--sort]}} size`

View File

@@ -27,7 +27,7 @@ source: https://github.com/tldr-pages/tldr.git
- Transfer directory contents, but not the directory itself:
`rsync {{[-r|--recursive]}} {{path/to/source}}/ {{path/to/destination}}`
`rsync {{[-r|--recursive]}} {{path/to/source/}} {{path/to/destination}}`
- Use archive mode, resolve symlinks, and skip files that are newer on the destination:

View File

@@ -18,8 +18,8 @@ source: https://github.com/tldr-pages/tldr.git
- Separate the output with a space instead of a newline:
`seq -s " " 5 3 20`
`seq {{[-s|--separator]}} " " 5 3 20`
- Format output width to a minimum of 4 digits padding with zeros as necessary:
`seq -f "%04g" 5 3 20`
`seq {{[-f|--format]}} "%04g" 5 3 20`

View File

@@ -14,11 +14,11 @@ source: https://github.com/tldr-pages/tldr.git
- Edit a file as the superuser with your default editor:
`sudo --edit {{/etc/fstab}}`
`sudo {{[-e|--edit]}} {{/etc/fstab}}`
- Run a command as another user and/or group:
`sudo --user={{user}} --group={{group}} {{id -a}}`
`sudo {{[-u|--user]}} {{user}} {{[-g|--group]}} {{group}} {{id -a}}`
- Repeat the last command prefixed with `sudo` (only in Bash, Zsh, etc.):
@@ -26,16 +26,16 @@ source: https://github.com/tldr-pages/tldr.git
- Launch the default shell with superuser privileges and run login-specific files (`.profile`, `.bash_profile`, etc.):
`sudo --login`
`sudo {{[-i|--login]}}`
- Launch the default shell with superuser privileges without changing the environment:
`sudo --shell`
`sudo {{[-s|--shell]}}`
- Launch the default shell as the specified user, loading the user's environment and reading login-specific files (`.profile`, `.bash_profile`, etc.):
`sudo --login --user={{user}}`
`sudo {{[-i|--login]}} {{[-u|--user]}} {{user}}`
- List the allowed (and forbidden) commands for the invoking user:
`sudo --list`
`sudo {{[-l|--list]}}`

View File

@@ -14,11 +14,11 @@ source: https://github.com/tldr-pages/tldr.git
- Use a different output filename:
`xgettext --output {{path/to/output_file}} {{path/to/input_file}}`
`xgettext {{[-o|--output]}} {{path/to/output_file}} {{path/to/input_file}}`
- Append new strings to an existing file:
`xgettext --join-existing --output {{path/to/output_file}} {{path/to/input_file}}`
`xgettext {{[-j|--join-existing]}} {{[-o|--output]}} {{path/to/output_file}} {{path/to/input_file}}`
- Don't add a header containing metadata to the output file: