From 9565d2532cef50c13ae9af22ec81f4d26ec81a0e Mon Sep 17 00:00:00 2001 From: ivuorinen Date: Wed, 27 Aug 2025 00:19:48 +0000 Subject: [PATCH] Update cheatsheets --- tldr/git-diff | 4 ++-- tldr/git-init | 4 ++-- tldr/git-mv | 2 +- tldr/greater-than | 8 ++++++++ tldr/less-than | 4 ++++ tldr/less-than-more-than | 21 +++++++++++++++++++++ tldr/linux/apachectl | 2 +- tldr/linux/aplay | 4 ++++ tldr/linux/brightnessctl | 20 ++++++++++++-------- tldr/linux/fdisk | 2 +- tldr/linux/fgconsole | 17 +++++++++++++++++ tldr/linux/pacsift | 17 +++++++++++++++++ tldr/linux/qm-create | 8 ++++---- tldr/linux/qm-set | 6 +++++- tldr/linux/rpm | 16 ++++++++-------- tldr/linux/systemctl-mask | 17 +++++++++++++++++ tldr/linux/systemd-cat | 12 ++++++++++++ tldr/linux/systemd-sysusers | 4 ++++ tldr/linux/yum | 29 ++++------------------------- tldr/lsix | 22 ++++++++++++++++++++++ tldr/wait | 2 +- 21 files changed, 167 insertions(+), 54 deletions(-) create mode 100644 tldr/less-than-more-than create mode 100644 tldr/linux/fgconsole create mode 100644 tldr/linux/pacsift create mode 100644 tldr/linux/systemctl-mask create mode 100644 tldr/lsix diff --git a/tldr/git-diff b/tldr/git-diff index 83e3dfd8..04e156e9 100644 --- a/tldr/git-diff +++ b/tldr/git-diff @@ -22,7 +22,7 @@ source: https://github.com/tldr-pages/tldr.git - Show changes from all commits since a given date/time (a date expression, e.g. "1 week 2 days" or an ISO date): -`git diff 'HEAD@{3 months|weeks|days|hours|seconds ago}'` +`git diff 'HEAD@{{{3 months|weeks|days|hours|seconds ago}}}'` - Show diff statistics, like files changed, histogram, and total line insertions/deletions: @@ -34,7 +34,7 @@ source: https://github.com/tldr-pages/tldr.git - Compare a single file between two branches or commits: -`git diff {{branch_1}}..{{branch_2}} [--] {{path/to/file}}` +`git diff {{branch_1}}..{{branch_2}} {{path/to/file}}` - Compare different files from the current branch to other branch: diff --git a/tldr/git-init b/tldr/git-init index 7785f5f0..86ffc329 100644 --- a/tldr/git-init +++ b/tldr/git-init @@ -5,7 +5,7 @@ source: https://github.com/tldr-pages/tldr.git --- # git init -> Initializes a new local Git repository. +> Initialize a new local Git repository. > More information: . - Initialize a new local repository: @@ -18,7 +18,7 @@ source: https://github.com/tldr-pages/tldr.git - Initialize a repository using SHA256 for object hashes (requires Git version 2.29+): -`git init --object-format {{sha256}}` +`git init --object-format sha256` - Initialize a barebones repository, suitable for use as a remote over SSH: diff --git a/tldr/git-mv b/tldr/git-mv index 0bab72b9..40c4786b 100644 --- a/tldr/git-mv +++ b/tldr/git-mv @@ -10,7 +10,7 @@ source: https://github.com/tldr-pages/tldr.git - Move a file inside the repo and add the movement to the next commit: -`git mv {{path/to/file}} {{new/path/to/file}}` +`git mv {{path/to/file}} {{path/to/destination}}` - Rename a file or directory and add the renaming to the next commit: diff --git a/tldr/greater-than b/tldr/greater-than index cb35e41a..a2da85df 100644 --- a/tldr/greater-than +++ b/tldr/greater-than @@ -31,3 +31,11 @@ source: https://github.com/tldr-pages/tldr.git - Redirect `stderr` to `stdout` for piping them together: `{{command1}} 2>&1 | {{command2}}` + +- Open a persistent file descriptor: + +`exec {{3}}>{{path/to/file}}` + +- Write to a custom file descriptor: + +`{{echo text}} >&{{3}}` diff --git a/tldr/less-than b/tldr/less-than index d5044108..5ea716a8 100644 --- a/tldr/less-than +++ b/tldr/less-than @@ -35,3 +35,7 @@ source: https://github.com/tldr-pages/tldr.git - Pass command output to a program as a file descriptor: `diff <({{command1}}) <({{command2}})` + +- Open a persistent file descriptor: + +`exec {{3}}<{{path/to/file}}` diff --git a/tldr/less-than-more-than b/tldr/less-than-more-than new file mode 100644 index 00000000..fb8d4bbc --- /dev/null +++ b/tldr/less-than-more-than @@ -0,0 +1,21 @@ +--- +syntax: markdown +tags: [tldr, common] +source: https://github.com/tldr-pages/tldr.git +--- +# <> + +> Open a file descriptor for read and write. +> More information: . + +- Open a file in a file descriptor for read an write: + +`exec {{3}}<>{{path/to/file}}` + +- Open a file descriptor to a remote connection: + +`exec {{3}}<>/dev/{{tcp}}/{{remote_host}}/{{port_number}}` + +- Close a file descriptor: + +`exec {{3}}<>-` diff --git a/tldr/linux/apachectl b/tldr/linux/apachectl index 1ff54ef1..a443a8ac 100644 --- a/tldr/linux/apachectl +++ b/tldr/linux/apachectl @@ -32,7 +32,7 @@ source: https://github.com/tldr-pages/tldr.git `sudo apachectl graceful` -- Print full Apache configuration: +- Print full Apache configuration (not always supported): `apachectl -S` diff --git a/tldr/linux/aplay b/tldr/linux/aplay index b047fec1..82103008 100644 --- a/tldr/linux/aplay +++ b/tldr/linux/aplay @@ -19,3 +19,7 @@ source: https://github.com/tldr-pages/tldr.git - Play the raw file as a 22050 Hz, mono, 8-bit, Mu-Law `.au` file: `aplay {{[-c|--channels]}} {{1}} {{[-t|--file-type]}} {{raw}} {{[-r|--rate]}} {{22050}} {{[-f|--format]}} {{mu_law}} {{path/to/file}}` + +- List available audio devices: + +`aplay {{[-l|--list-devices]}}` diff --git a/tldr/linux/brightnessctl b/tldr/linux/brightnessctl index 13c5df2d..bab6abb2 100644 --- a/tldr/linux/brightnessctl +++ b/tldr/linux/brightnessctl @@ -12,18 +12,22 @@ source: https://github.com/tldr-pages/tldr.git `brightnessctl {{[-l|--list]}}` -- Print the current brightness of the display backlight: +- Print the current brightness of the default device: -`brightnessctl get` +`brightnessctl {{[g|get]}}` -- Set the brightness of the display backlight to a specified percentage within range: +- Print the current brightness of a specific device (can be a wildcard): -`brightnessctl set {{50%}}` +`brightnessctl {{[g|get]}} {{[-d|--device]}} '{{device_name}}'` -- Increase brightness by a specified increment: +- Set the brightness to a specified percentage: -`brightnessctl set {{+10%}}` +`brightnessctl {{[s|set]}} {{50}}%` -- Decrease brightness by a specified decrement: +- Increase brightness by a specified percentage: -`brightnessctl set {{10%-}}` +`brightnessctl {{[s|set]}} +{{10}}%` + +- Decrease brightness by a specified percentage: + +`brightnessctl {{[s|set]}} {{10}}%-` diff --git a/tldr/linux/fdisk b/tldr/linux/fdisk index 49df6598..49405767 100644 --- a/tldr/linux/fdisk +++ b/tldr/linux/fdisk @@ -5,7 +5,7 @@ source: https://github.com/tldr-pages/tldr.git --- # fdisk -> Manage partition tables and partitions on a hard disk. +> Manage partition tables and partitions on a storage drive. > See also: `partprobe`. > More information: . diff --git a/tldr/linux/fgconsole b/tldr/linux/fgconsole new file mode 100644 index 00000000..31974738 --- /dev/null +++ b/tldr/linux/fgconsole @@ -0,0 +1,17 @@ +--- +syntax: markdown +tags: [tldr, linux] +source: https://github.com/tldr-pages/tldr.git +--- +# fgconsole + +> Print the number of the foreground virtual terminal. +> More information: . + +- Print current terminal number or `serial` if the terminal is serial: + +`fgconsole` + +- Print the next unallocated virtual terminal: + +`fgconsole {{[-n|--next-available]}}` diff --git a/tldr/linux/pacsift b/tldr/linux/pacsift new file mode 100644 index 00000000..3865d24b --- /dev/null +++ b/tldr/linux/pacsift @@ -0,0 +1,17 @@ +--- +syntax: markdown +tags: [tldr, linux] +source: https://github.com/tldr-pages/tldr.git +--- +# pacsift + +> Query and filter packages. +> More information: . + +- List all available packages: + +`pacsift` + +- Filter packages that provide a given package: + +`pacsift --satisfies {{package}}` diff --git a/tldr/linux/qm-create b/tldr/linux/qm-create index 697615d0..44c5412c 100644 --- a/tldr/linux/qm-create +++ b/tldr/linux/qm-create @@ -12,13 +12,13 @@ source: https://github.com/tldr-pages/tldr.git `qm {{[cr|create]}} {{100}}` -- Automatically start the machine after creation: +- Give the virtual machine a name and automatically start the machine after creation: -`qm {{[cr|create]}} {{100}} --start` +`qm {{[cr|create]}} {{100}} --name {{vm_name}} --start` -- Give the virtual machine a name: +- Give a virtual machine specified amount of memory and CPUs: -`qm {{[cr|create]}} {{100}} --name {{vm_name}}` +`qm {{[cr|create]}} {{100}} --memory {{8192}} --cores {{4}}` - Specify the type of operating system on the machine: diff --git a/tldr/linux/qm-set b/tldr/linux/qm-set index db1370f4..1cdf76f3 100644 --- a/tldr/linux/qm-set +++ b/tldr/linux/qm-set @@ -30,4 +30,8 @@ source: https://github.com/tldr-pages/tldr.git - Delete a device: -`qm set {{100}} --delete {{device_name0}}` +`qm set {{100}} --delete {{device_name0,device_name1,...}}` + +- Passthrough a GPU device to the guest: + +`qm set {{100}} --hostpci{{0}} {{0000:00:02}},x-vga=1 --bios ovmf` diff --git a/tldr/linux/rpm b/tldr/linux/rpm index 61b658dc..cd763539 100644 --- a/tldr/linux/rpm +++ b/tldr/linux/rpm @@ -11,32 +11,32 @@ source: https://github.com/tldr-pages/tldr.git - Show version of httpd package: -`rpm --query {{httpd}}` +`rpm {{[-q|--query]}} {{httpd}}` - List versions of all matching packages: -`rpm --query --all '{{mariadb*}}'` +`rpm {{[-qa|--query --all]}} '{{mariadb*}}'` - Forcibly install a package regardless of currently installed versions: -`rpm --upgrade {{path/to/package.rpm}} --force` +`rpm {{[-U|--upgrade]}} {{path/to/package.rpm}} --force` - Identify owner of a file and show version of the package: -`rpm --query --file {{/etc/postfix/main.cf}}` +`rpm {{[-qf|--query --file]}} {{/etc/postfix/main.cf}}` - List package-owned files: -`rpm --query --list {{kernel}}` +`rpm {{[-ql|--query --list]}} {{kernel}}` - Show scriptlets from an RPM file: -`rpm --query --package --scripts {{package.rpm}}` +`rpm {{[-qp|--query --package]}} --scripts {{package.rpm}}` - Show changed, missing and/or incorrectly installed files of matching packages: -`rpm --verify --all '{{php-*}}'` +`rpm {{[-Va|--verify --all]}} '{{php-*}}'` - Display the changelog of a specific package: -`rpm --query --changelog {{package}}` +`rpm {{[-q|--query]}} --changelog {{package}}` diff --git a/tldr/linux/systemctl-mask b/tldr/linux/systemctl-mask new file mode 100644 index 00000000..c50acf9d --- /dev/null +++ b/tldr/linux/systemctl-mask @@ -0,0 +1,17 @@ +--- +syntax: markdown +tags: [tldr, linux] +source: https://github.com/tldr-pages/tldr.git +--- +# systemctl mask + +> Link units to `/dev/null` so that they can be even started. +> More information: . + +- Mask a service: + +`systemctl mask {{service_name}}` + +- Ensure that the service is shut down while masking: + +`systemctl mask {{service_name}} --now` diff --git a/tldr/linux/systemd-cat b/tldr/linux/systemd-cat index 1bad50bc..c3d8172a 100644 --- a/tldr/linux/systemd-cat +++ b/tldr/linux/systemd-cat @@ -15,3 +15,15 @@ source: https://github.com/tldr-pages/tldr.git - Write the output of a pipeline to the journal (`stderr` stays connected to the terminal): `{{command}} | systemd-cat` + +- Use the specified identifier (default: `cat` when reading from a pipeline, executable name otherwise): + +`{{command}} | systemd-cat {{[-t|--identifier]}} {{id}}` + +- Use the specified default priority level for all logged messages: + +`systemd-cat {{[-p|--priority]}} {{emerg|alert|crit|err|warning|notice|info|debug}} {{command}}` + +- Use the specified default priority level for the logged messages from the command's `stderr`: + +`systemd-cat --stderr-priority {{emerg|alert|crit|err|warning|notice|info|debug}} {{command}}` diff --git a/tldr/linux/systemd-sysusers b/tldr/linux/systemd-sysusers index 3982b782..16273d3b 100644 --- a/tldr/linux/systemd-sysusers +++ b/tldr/linux/systemd-sysusers @@ -20,3 +20,7 @@ source: https://github.com/tldr-pages/tldr.git - Print the contents of all configuration files (before each file, its name is printed as a comment): `systemd-sysusers --cat-config` + +- Create users based on files listed in the previous command: + +`systemd-sysusers` diff --git a/tldr/linux/yum b/tldr/linux/yum index 95f489f8..d9534014 100644 --- a/tldr/linux/yum +++ b/tldr/linux/yum @@ -5,30 +5,9 @@ source: https://github.com/tldr-pages/tldr.git --- # yum -> Package management utility for RHEL, Fedora, and CentOS (for older versions). -> For equivalent commands in other package managers, see . -> More information: . +> This command is an alias of `dnf` on modern distros. +> For older distros (e.g. CentOS 7), `yum` is a distinct program from `dnf`. Some subcommands and options may be different. -- Install a new package: +- View documentation for the original command: -`yum install {{package}}` - -- Install a new package and assume yes to all questions (also works with update, great for automated updates): - -`yum {{[-y|--assumeyes]}} install {{package}}` - -- Find the package that provides a particular command: - -`yum provides {{command}}` - -- Remove a package: - -`yum remove {{package}}` - -- Display available updates for installed packages: - -`yum check-update` - -- Upgrade installed packages to the newest available versions: - -`yum upgrade` +`tldr dnf` diff --git a/tldr/lsix b/tldr/lsix new file mode 100644 index 00000000..c2caeacc --- /dev/null +++ b/tldr/lsix @@ -0,0 +1,22 @@ +--- +syntax: markdown +tags: [tldr, common] +source: https://github.com/tldr-pages/tldr.git +--- +# lsix + +> List and display images in sixel format on the terminal. +> See also: `img2sixel`. +> More information: . + +- List images in the current directory: + +`lsix` + +- List images in a specific directory: + +`lsix {{path/to/directory}}` + +- Display an image on the terminal: + +`lsix {{path/to/image}}` diff --git a/tldr/wait b/tldr/wait index 1585aa86..7c68e0b5 100644 --- a/tldr/wait +++ b/tldr/wait @@ -6,7 +6,7 @@ source: https://github.com/tldr-pages/tldr.git # wait > Wait for a process to complete before proceeding. -> See also: `ps` to view information about running processes. +> See also: `ps` to view information about running processes and `waitpid`. > More information: . - Wait for a process to finish given its process ID (PID) and return its exit status: