Update cheatsheets

This commit is contained in:
ivuorinen
2025-03-29 00:18:23 +00:00
parent a3692d638b
commit 75f807d6af
175 changed files with 1107 additions and 775 deletions

View File

@@ -14,8 +14,8 @@ source: https://github.com/tldr-pages/tldr.git
- Securely discard all blocks on a device, removing all data:
`blkdiscard --secure {{/dev/device}}`
`blkdiscard {{[-s|--secure]}} {{/dev/device}}`
- Discard the first 100 MB of a device:
`blkdiscard --length {{100MB}} {{/dev/device}}`
`blkdiscard {{[-l|--length]}} {{100MB}} {{/dev/device}}`

View File

@@ -14,4 +14,4 @@ source: https://github.com/tldr-pages/tldr.git
- List all partitions in a table, including current mountpoints:
`sudo blkid -o list`
`sudo blkid {{[-o|--output]}} list`

View File

@@ -14,4 +14,4 @@ source: https://github.com/tldr-pages/tldr.git
- Create a new partition table for a specific device and manage it:
`cfdisk --zero {{/dev/sdX}}`
`cfdisk {{[-z|--zero]}} {{/dev/sdX}}`

View File

@@ -10,8 +10,8 @@ source: https://github.com/tldr-pages/tldr.git
- Disable one or more CPUs by their IDs:
`chcpu -d {{1,3}}`
`chcpu {{[-d|--disable]}} {{1,3}}`
- Enable one or more ranges of CPUs by their IDs:
`chcpu -e {{1-3,5-7}}`
`chcpu {{[-e|--enable]}} {{1-3,5-7}}`

View File

@@ -10,12 +10,12 @@ source: https://github.com/tldr-pages/tldr.git
- Display the OOM-killer score of the process with a specific ID:
`choom -p {{pid}}`
`choom {{[-p|--pid]}} {{pid}}`
- Change the adjust OOM-killer score of a specific process:
`choom -p {{pid}} -n {{-1000..+1000}}`
`choom {{[-p|--pid]}} {{pid}} {{[-n|--adjust]}} {{-1000..+1000}}`
- Run a command with a specific adjust OOM-killer score:
`choom -n {{-1000..+1000}} {{command}} {{argument1 argument2 ...}}`
`choom {{[-n|--adjust]}} {{-1000..+1000}} {{command}} {{argument1 argument2 ...}}`

View File

@@ -10,20 +10,20 @@ source: https://github.com/tldr-pages/tldr.git
- Display attributes of a process:
`chrt --pid {{PID}}`
`chrt {{[-p|--pid]}} {{PID}}`
- Display attributes of all threads of a process:
`chrt --all-tasks --pid {{PID}}`
`chrt {{[-a|--all-tasks]}} {{[-p|--pid]}} {{PID}}`
- Display the min/max priority values that can be used with `chrt`:
`chrt --max`
`chrt {{[-m|--max]}}`
- Set the scheduling priority of a process:
`chrt --pid {{priority}} {{PID}}`
`chrt {{[-p|--pid]}} {{priority}} {{PID}}`
- Set the scheduling policy of a process:
`chrt --{{deadline|idle|batch|rr|fifo|other}} --pid {{priority}} {{PID}}`
`chrt --{{deadline|idle|batch|rr|fifo|other}} {{[-p|--pid]}} {{priority}} {{PID}}`

35
tldr/linux/column Normal file
View File

@@ -0,0 +1,35 @@
---
syntax: markdown
tags: [tldr, linux]
source: https://github.com/tldr-pages/tldr.git
---
# column
> Format `stdin` or a file into multiple columns.
> Columns are filled before rows; the default separator is a whitespace.
> More information: <https://manned.org/column>.
- Format the output of a command for a 30 characters wide display:
`printf "header1 header2
bar foo
" | column {{[-c|--output-width]}} {{30}}`
- Split columns automatically and auto-align them in a tabular format:
`printf "header1 header2
bar foo
" | column {{[-t|--table]}}`
- Specify the column delimiter character for the `--table` option (e.g. "," for CSV) (defaults to whitespace):
`printf "header1,header2
bar,foo
" | column {{[-t|--table]}} {{[-s|--separator]}} {{,}}`
- Fill rows before filling columns:
`printf "header1
bar
foobar
" | column {{[-c|--output-width]}} {{30}} {{[-x|--fillrows]}}`

View File

@@ -11,12 +11,12 @@ source: https://github.com/tldr-pages/tldr.git
- Reserve a file taking up 700 MiB of disk space:
`fallocate --length {{700M}} {{path/to/file}}`
`fallocate {{[-l|--length]}} {{700M}} {{path/to/file}}`
- Shrink an already allocated file by 200 MiB:
`fallocate --collapse-range --length {{200M}} {{path/to/file}}`
`fallocate {{[-c|--collapse-range]}} {{[-l|--length]}} {{200M}} {{path/to/file}}`
- Shrink 20 MB of space after 100 MiB in a file:
`fallocate --collapse-range --offset {{100M}} --length {{20M}} {{path/to/file}}`
`fallocate {{[-c|--collapse-range]}} {{[-o|--offset]}} {{100M}} {{[-l|--length]}} {{20M}} {{path/to/file}}`

View File

@@ -22,7 +22,7 @@ source: https://github.com/tldr-pages/tldr.git
- Find filesystems in specific type:
`findmnt -t {{ext4}}`
`findmnt {{[-t|--types]}} {{ext4}}`
- Find filesystems with specific label:
@@ -30,4 +30,4 @@ source: https://github.com/tldr-pages/tldr.git
- Check mount table content in detail and verify `/etc/fstab`:
`findmnt --verify --verbose`
`findmnt {{[-x|--verify]}} --verbose`

22
tldr/linux/flock Normal file
View File

@@ -0,0 +1,22 @@
---
syntax: markdown
tags: [tldr, linux]
source: https://github.com/tldr-pages/tldr.git
---
# flock
> Manage locks from shell scripts.
> It can be used to ensure that only one process of a command is running.
> More information: <https://manned.org/flock>.
- Run a command with a file lock as soon as the lock is not required by others:
`flock {{path/to/lock.lock}} {{[-c|--command]}} "{{command}}"`
- Run a command with a file lock, and exit if the lock doesn't exist:
`flock {{path/to/lock.lock}} {{[-n|--nonblock]}} {{[-c|--command]}} "{{command}}"`
- Run a command with a file lock, and exit with a specific error code if the lock doesn't exist:
`flock {{path/to/lock.lock}} {{[-n|--nonblock]}} {{[-E|--conflict-exit-code]}} {{error_code}} {{[-c|--command]}} "{{command}}"`

View File

@@ -11,7 +11,7 @@ source: https://github.com/tldr-pages/tldr.git
- Trim unused blocks on all mounted partitions that support it:
`sudo fstrim --all`
`sudo fstrim {{[-a|--all]}}`
- Trim unused blocks on a specified partition:
@@ -19,4 +19,4 @@ source: https://github.com/tldr-pages/tldr.git
- Display statistics after trimming:
`sudo fstrim --verbose {{/}}`
`sudo fstrim {{[-v|--verbose]}} {{/}}`

25
tldr/linux/hexdump Normal file
View File

@@ -0,0 +1,25 @@
---
syntax: markdown
tags: [tldr, linux]
source: https://github.com/tldr-pages/tldr.git
---
# hexdump
> An ASCII, decimal, hexadecimal, octal dump.
> More information: <https://manned.org/hexdump>.
- Print the hexadecimal representation of a file, replacing duplicate lines by '*':
`hexdump {{path/to/file}}`
- Display the input offset in hexadecimal and its ASCII representation in two columns:
`hexdump {{[-C|--canonical]}} {{path/to/file}}`
- Display the hexadecimal representation of a file, but interpret only n bytes of the input:
`hexdump {{[-C|--canonical]}} {{[-n|--length]}} {{number_of_bytes}} {{path/to/file}}`
- Don't replace duplicate lines with '*':
`hexdump {{[-v|--no-squeezing]}} {{path/to/file}}`

View File

@@ -14,8 +14,8 @@ source: https://github.com/tldr-pages/tldr.git
- Write the current software clock time to the hardware clock (sometimes used during system setup):
`hwclock --systohc`
`hwclock {{[-w|--systohc]}}`
- Write the current hardware clock time to the software clock:
`hwclock --hctosys`
`hwclock {{[-s|--hctosys]}}`

View File

@@ -10,28 +10,28 @@ source: https://github.com/tldr-pages/tldr.git
- Delete a shared memory segment by ID:
`ipcrm --shmem-id {{shmem_id}}`
`ipcrm {{[-m|--shmem-id]}} {{shmem_id}}`
- Delete a shared memory segment by key:
`ipcrm --shmem-key {{shmem_key}}`
`ipcrm {{[-M|--shmem-key]}} {{shmem_key}}`
- Delete an IPC queue by ID:
`ipcrm --queue-id {{ipc_queue_id}}`
`ipcrm {{[-q|--queue-id]}} {{ipc_queue_id}}`
- Delete an IPC queue by key:
`ipcrm --queue-key {{ipc_queue_key}}`
`ipcrm {{[-Q|--queue-key]}} {{ipc_queue_key}}`
- Delete a semaphore by ID:
`ipcrm --semaphore-id {{semaphore_id}}`
`ipcrm {{[-s|--semaphore-id]}} {{semaphore_id}}`
- Delete a semaphore by key:
`ipcrm --semaphore-key {{semaphore_key}}`
`ipcrm {{[-S|--semaphore-key]}} {{semaphore_key}}`
- Delete all IPC resources:
`ipcrm --all`
`ipcrm {{[-a|--all]}}`

View File

@@ -14,8 +14,8 @@ source: https://github.com/tldr-pages/tldr.git
- Display the block count and block size of an ISO file:
`isosize --sectors {{path/to/file.iso}}`
`isosize {{[-x|--sectors]}} {{path/to/file.iso}}`
- Display the size of an ISO file divided by a given number (only usable when --sectors is not given):
`isosize --divisor={{number}} {{path/to/file.iso}}`
`isosize {{[-d|--divisor]}} {{number}} {{path/to/file.iso}}`

View File

@@ -5,11 +5,10 @@ source: https://github.com/tldr-pages/tldr.git
---
# last
> List information of last user logins.
> See also: `lastb`, `login`.
> More information: <https://manned.org/last.1>.
> View the last logged in users.
> More information: <https://manned.org/last>.
- List login information (e.g., username, terminal, boot time, kernel) of all users:
- View last login infromation (e.g., username, terminal, boot time, kernel) of all users as read from `/var/log/wtmp`:
`last`
@@ -17,26 +16,26 @@ source: https://github.com/tldr-pages/tldr.git
`last {{username}}`
- List information of a specific TTY:
- Specify how many of the last logins to show:
`last {{tty1}}`
`last {{[-n|--limit]}} {{login_count}}`
- List most recent information (by default, the newest are at the top):
- Print the full date and time for entries and then display the hostname column last to prevent truncation:
`last | tac`
`last {{[-F|--fulltimes]}} {{[-a|--hostlast]}}`
- List information of system boots:
- View all logins by a specific user and show the IP address instead of the hostname:
`last "{{system boot}}"`
`last {{username}} {{[-i|--ip]}}`
- List information with a specific [t]imestamp format:
- List information since a specific time and date:
`last --time-format {{notime|full|iso}}`
`last {{[-s|--since]}} {{-7days}}`
- List information [s]ince a specific time and date:
- View all recorded reboots (i.e., the last logins of the pseudo user "reboot"):
`last --since {{-7days}}`
`last reboot`
- List information (i.e., hostname and IP) of remote hosts:
- Display help:
`last --dns`
`last {{[-h|--help]}}`

View File

@@ -14,16 +14,16 @@ source: https://github.com/tldr-pages/tldr.git
- List all last logged in users since a given time:
`sudo lastb --since {{YYYY-MM-DD}}`
`sudo lastb {{[-s|--since]}} {{YYYY-MM-DD}}`
- List all last logged in users until a given time:
`sudo lastb --until {{YYYY-MM-DD}}`
`sudo lastb {{[-t|--until]}} {{YYYY-MM-DD}}`
- List all logged in users at a specific time:
`sudo lastb --present {{hh:mm}}`
`sudo lastb {{[-p|--present]}} {{hh:mm}}`
- List all last logged in users and translate the IP into a hostname:
`sudo lastb --dns`
`sudo lastb {{[-d|--dns]}}`

29
tldr/linux/logger Normal file
View File

@@ -0,0 +1,29 @@
---
syntax: markdown
tags: [tldr, linux]
source: https://github.com/tldr-pages/tldr.git
---
# logger
> Add messages to syslog (/var/log/syslog).
> More information: <https://manned.org/logger>.
- Log a message to syslog:
`logger {{message}}`
- Take input from `stdin` and log to syslog:
`echo {{log_entry}} | logger`
- Send the output to a remote syslog server running at a given port. Default port is 514:
`echo {{log_entry}} | logger {{[-n|--server]}} {{hostname}} {{[-P|--port]}} {{port}}`
- Use a specific tag for every line logged. Default is the name of logged in user:
`echo {{log_entry}} | logger {{[-t|--tag]}} {{tag}}`
- Log messages with a given priority. Default is `user.notice`. See `man logger` for all priority options:
`echo {{log_entry}} | logger {{[-p|--priority]}} {{user.warning}}`

View File

@@ -10,7 +10,7 @@ source: https://github.com/tldr-pages/tldr.git
- List loop devices with detailed info:
`losetup -a`
`losetup {{[-a|--all]}}`
- Attach a file to a given loop device:
@@ -18,16 +18,16 @@ source: https://github.com/tldr-pages/tldr.git
- Attach a file to a new free loop device and scan the device for partitions:
`sudo losetup --show --partscan -f /{{path/to/file}}`
`sudo losetup --show {{[-P|--partscan]}} {{[-f|--find]}} /{{path/to/file}}`
- Attach a file to a read-only loop device:
`sudo losetup --read-only {{/dev/loop}} /{{path/to/file}}`
`sudo losetup {{[-r|--read-only]}} {{/dev/loop}} /{{path/to/file}}`
- Detach all loop devices:
`sudo losetup -D`
`sudo losetup {{[-D|--detach-all]}}`
- Detach a given loop device:
`sudo losetup -d {{/dev/loop}}`
`sudo losetup {{[-d|--detach]}} {{/dev/loop}}`

View File

@@ -14,16 +14,16 @@ source: https://github.com/tldr-pages/tldr.git
- List locks with defined column headers:
`lslocks --output {{PID}},{{COMMAND}},{{PATH}}`
`lslocks {{[-o|--output]}} {{PID}},{{COMMAND}},{{PATH}}`
- List locks producing a raw output (no columns), and without column headers:
`lslocks --raw --noheadings`
`lslocks {{[-r|--raw]}} {{[-n|--noheadings]}}`
- List locks by PID input:
`lslocks --pid {{PID}}`
`lslocks {{[-p|--pid]}} {{PID}}`
- List locks with JSON output to `stdout`:
`lslocks --json`
`lslocks {{[-J|--json]}}`

View File

@@ -14,16 +14,16 @@ source: https://github.com/tldr-pages/tldr.git
- List namespaces in JSON format:
`lsns --json`
`lsns {{[-J|--json]}}`
- List namespaces associated with the specified process:
`lsns --task {{pid}}`
`lsns {{[-p|--task]}} {{pid}}`
- List the specified type of namespaces only:
`lsns --type {{mnt|net|ipc|user|pid|uts|cgroup|time}}`
`lsns {{[-t|--type]}} {{mnt|net|ipc|user|pid|uts|cgroup|time}}`
- List namespaces, only showing the namespace ID, type, PID, and command:
`lsns --output {{NS,TYPE,PID,COMMAND}}`
`lsns {{[-o|--output]}} {{NS,TYPE,PID,COMMAND}}`

View File

@@ -14,12 +14,12 @@ source: https://github.com/tldr-pages/tldr.git
- Generate a random number, using the contents of a file as a seed for the randomness:
`mcookie --file {{path/to/file}}`
`mcookie {{[-f|--file]}} {{path/to/file}}`
- Generate a random number, using a specific number of bytes from a file as a seed for the randomness:
`mcookie --file {{path/to/file}} --max-size {{number_of_bytes}}`
`mcookie {{[-f|--file]}} {{path/to/file}} {{[-m|--max-size]}} {{number_of_bytes}}`
- Print the details of the randomness used, such as the origin and seed for each source:
`mcookie --verbose`
`mcookie {{[-v|--verbose]}}`

View File

@@ -15,8 +15,8 @@ source: https://github.com/tldr-pages/tldr.git
- Build a filesystem of a specified type:
`mkfs -t {{ext4}} {{path/to/partition}}`
`mkfs {{[-t|--type]}} {{ext4}} {{path/to/partition}}`
- Build a filesystem of a specified type and check for bad blocks:
`mkfs -c -t {{ntfs}} {{path/to/partition}}`
`mkfs -c {{[-t|--type]}} {{ntfs}} {{path/to/partition}}`

View File

@@ -15,8 +15,8 @@ source: https://github.com/tldr-pages/tldr.git
- Check a partition for bad blocks before creating the swap area:
`sudo mkswap -c {{path/to/file}}`
`sudo mkswap {{[-c|--check]}} {{path/to/file}}`
- Specify a label for the partition (to allow `swapon` to use the label):
`sudo mkswap -L {{label}} {{/dev/sda1}}`
`sudo mkswap {{[-L|--label]}} {{label}} {{/dev/sda1}}`

41
tldr/linux/mount Normal file
View File

@@ -0,0 +1,41 @@
---
syntax: markdown
tags: [tldr, linux]
source: https://github.com/tldr-pages/tldr.git
---
# mount
> Get access to an entire filesystem in one directory.
> More information: <https://manned.org/mount.8>.
- Show all mounted filesystems:
`mount`
- Mount a device to a 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 {{[-m|--mkdir]}} {{path/to/device_file}} {{path/to/target_directory}}`
- Mount a device to a directory for a specific user:
`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|--types]}} {{iso9660}} {{[-o|--options]}} ro {{/dev/cdrom}} {{/cdrom}}`
- Mount all the filesystem defined in `/etc/fstab`:
`mount {{[-a|--all]}}`
- Mount a specific filesystem described in `/etc/fstab` (e.g. `/dev/sda1 /my_drive ext2 defaults 0 2`):
`mount {{/my_drive}}`
- Mount a directory to another directory:
`mount {{[-B|--bind]}} {{path/to/old_dir}} {{path/to/new_dir}}`

View File

@@ -14,8 +14,8 @@ source: https://github.com/tldr-pages/tldr.git
- Check if a directory is a mountpoint without showing any output:
`mountpoint -q {{path/to/directory}}`
`mountpoint {{[-q|--quiet]}} {{path/to/directory}}`
- Show major/minor numbers of a mountpoint's filesystem:
`mountpoint --fs-devno {{path/to/directory}}`
`mountpoint {{[-d|--fs-devno]}} {{path/to/directory}}`

View File

@@ -15,16 +15,16 @@ source: https://github.com/tldr-pages/tldr.git
- Display the results in a long-listing format:
`namei --long {{path/to/a}} {{path/to/b}} {{path/to/c}}`
`namei {{[-l|--long]}} {{path/to/a}} {{path/to/b}} {{path/to/c}}`
- Show the mode bits of each file type in the style of `ls`:
`namei --modes {{path/to/a}} {{path/to/b}} {{path/to/c}}`
`namei {{[-m|--modes]}} {{path/to/a}} {{path/to/b}} {{path/to/c}}`
- Show owner and group name of each file:
`namei --owners {{path/to/a}} {{path/to/b}} {{path/to/c}}`
`namei {{[-o|--owners]}} {{path/to/a}} {{path/to/b}} {{path/to/c}}`
- Don't follow symlinks while resolving:
`namei --nosymlinks {{path/to/a}} {{path/to/b}} {{path/to/c}}`
`namei {{[-n|--nosymlinks]}} {{path/to/a}} {{path/to/b}} {{path/to/c}}`

View File

@@ -10,7 +10,7 @@ source: https://github.com/tldr-pages/tldr.git
- Set a user's login shell to `nologin` to prevent the user from logging in:
`chsh -s {{user}} nologin`
`chsh {{[-s|--shell]}} {{user}} nologin`
- Customize message for users with the login shell of `nologin`:

View File

@@ -11,16 +11,16 @@ source: https://github.com/tldr-pages/tldr.git
- Run a specific command using the same namespaces as an existing process:
`nsenter --target {{pid}} --all {{command}} {{command_arguments}}`
`nsenter {{[-t|--target]}} {{pid}} {{[-a|--all]}} {{command}} {{command_arguments}}`
- Run a specific command in an existing process's mount|UTS|IPC|network|PID|user|cgroup|time namespace:
`nsenter --target {{pid}} --{{mount|uts|ipc|net|pid|user|cgroup}} {{command}} {{command_arguments}}`
`nsenter {{[-t|--target]}} {{pid}} --{{mount|uts|ipc|net|pid|user|cgroup}} {{command}} {{command_arguments}}`
- Run a specific command in an existing process's UTS, time, and IPC namespaces:
`nsenter --target {{pid}} --uts --time --ipc -- {{command}} {{command_arguments}}`
`nsenter {{[-t|--target]}} {{pid}} {{[-u|--uts]}} {{[-T|--time]}} {{[-i|--ipc]}} -- {{command}} {{command_arguments}}`
- Run a specific command in an existing process's namespace by referencing procfs:
`nsenter --pid=/proc/{{pid}}/pid/net -- {{command}} {{command_arguments}}`
`nsenter {{[-p|--pid=]}}/proc/{{pid}}/pid/net -- {{command}} {{command_arguments}}`

View File

@@ -10,12 +10,12 @@ source: https://github.com/tldr-pages/tldr.git
- List the partitions on a block device or disk image:
`sudo partx --list {{path/to/device_or_disk_image}}`
`sudo partx {{[-l|--list]}} {{path/to/device_or_disk_image}}`
- Add all the partitions found in a given block device to the kernel:
`sudo partx --add --verbose {{path/to/device_or_disk_image}}`
`sudo partx {{[-a|--add]}} {{[-v|--verbose]}} {{path/to/device_or_disk_image}}`
- Delete all the partitions found from the kernel (does not alter partitions on disk):
`sudo partx --delete {{path/to/device_or_disk_image}}`
`sudo partx {{[-d|--delete]}} {{path/to/device_or_disk_image}}`

View File

@@ -15,8 +15,8 @@ source: https://github.com/tldr-pages/tldr.git
- Display limit values for all current resources of a specified process:
`prlimit --pid {{pid_number}}`
`prlimit {{[-p|--pid]}} {{pid_number}}`
- Run a command with a custom number of open files limit:
`prlimit --nofile={{10}} {{command}}`
`prlimit {{[-n|--nofile=]}}{{10}} {{command}}`

View File

@@ -18,4 +18,4 @@ source: https://github.com/tldr-pages/tldr.git
- Query all bound raw devices:
`raw -qa`
`raw {{[-qa|--query --all]}}`

View File

@@ -10,14 +10,18 @@ source: https://github.com/tldr-pages/tldr.git
> See also: `nice`.
> More information: <https://manned.org/renice>.
- Set the absolute priority of a running [p]rocess:
- Set the absolute priority of a running process:
`renice {{+3}} -p {{pid}}`
`renice --priority {{3}} {{[-p|--pid]}} {{pid}}`
- Increase/decrease the priority of all processes owned by a [u]ser:
- Increase the priority of a running process:
`renice --relative {{-4}} -u {{uid|user}}`
`sudo renice --relative {{-4}} {{[-p|--pid]}} {{pid}}`
- Set the priority of all processes that belong to a process [g]roup:
- Decrease the priority of all processes owned by a user:
`renice --absolute {{5}} -g {{process_group}}`
`renice --relative {{4}} {{[-u|--user]}} {{uid|user}}`
- Set the priority of all processes that belong to a process group:
`sudo renice {{-5}} {{[-g|--pgrp]}} {{process_group}}`

BIN
tldr/linux/rev Normal file

Binary file not shown.

View File

@@ -14,7 +14,7 @@ source: https://github.com/tldr-pages/tldr.git
- Filter by columns:
`rfkill -o {{ID,TYPE,DEVICE}}`
`rfkill {{[-o|--output]}} {{ID,TYPE,DEVICE}}`
- Block devices by type (e.g. bluetooth, wlan):
@@ -26,4 +26,4 @@ source: https://github.com/tldr-pages/tldr.git
- Output in JSON format:
`rfkill -J`
`rfkill {{[-J|--json]}}`

View File

@@ -10,24 +10,24 @@ source: https://github.com/tldr-pages/tldr.git
- Show whether an alarm is set or not:
`sudo rtcwake -m show -v`
`sudo rtcwake {{[-m|--mode]}} show {{[-v|--verbose]}}`
- Suspend to RAM and wakeup after 10 seconds:
`sudo rtcwake -m mem -s {{10}}`
`sudo rtcwake {{[-m|--mode]}} mem {{[-s|--seconds]}} {{10}}`
- Suspend to disk (higher power saving) and wakeup 15 minutes later:
`sudo rtcwake -m disk --date +{{15}}min`
`sudo rtcwake {{[-m|--mode]}} disk --date +{{15}}min`
- Freeze the system (more efficient than suspend-to-RAM but version 3.9 or newer of the Linux kernel is required) and wakeup at a given date and time:
`sudo rtcwake -m freeze --date {{YYYYMMDDhhmm}}`
`sudo rtcwake {{[-m|--mode]}} freeze --date {{YYYYMMDDhhmm}}`
- Disable a previously set alarm:
`sudo rtcwake -m disable`
`sudo rtcwake {{[-m|--mode]}} disable`
- Perform a dry run to wakeup the computer at a given time. (Press `<Ctrl c>` to abort):
`sudo rtcwake -m on --date {{hh:ss}}`
`sudo rtcwake {{[-m|--mode]}} on --date {{hh:ss}}`

View File

@@ -10,20 +10,20 @@ source: https://github.com/tldr-pages/tldr.git
- Run command as a different user:
`runuser {{user}} -c '{{command}}'`
`runuser {{user}} {{[-c|--command]}} '{{command}}'`
- Run command as a different user and group:
`runuser {{user}} -g {{group}} -c '{{command}}'`
`runuser {{user}} {{[-g|--group]}} {{group}} {{[-c|--command]}} '{{command}}'`
- Start a login shell as a specific user:
`runuser {{user}} -l`
`runuser {{user}} {{[-l|--login]}}`
- Specify a shell for running instead of the default shell (also works for login):
`runuser {{user}} -s {{/bin/sh}}`
`runuser {{user}} {{[-s|--shell]}} {{/bin/sh}}`
- Preserve the entire environment of root (only if `--login` is not specified):
`runuser {{user}} --preserve-environment -c '{{command}}'`
`runuser {{user}} {{[-p|--preserve-environment]}} {{[-c|--command]}} '{{command}}'`

View File

@@ -5,25 +5,37 @@ source: https://github.com/tldr-pages/tldr.git
---
# script
> Record all terminal output to file.
> Record all terminal output to a typescript file.
> More information: <https://manned.org/script>.
- Record a new session to a file named `typescript` in the current directory:
`script`
- Stop recording:
`exit`
- Record a new session to a custom filepath:
`script {{path/to/session.out}}`
- Record a new session, appending to an existing file:
- Append to an existing file:
`script -a {{path/to/session.out}}`
`script {{[-a|--append]}} {{logfile.log}}`
- Record timing information (data is outputted to `stderr`):
`script -t 2> {{path/to/timing_file}}`
`script {{[-t|--timing]}} 2> {{path/to/timing_file}}`
- Write out data as soon as it happens:
`script -f {{path/to/file}}`
`script {{[-f|--flush]}} {{path/to/file}}`
- Execute quietly without start and done messages:
`script {{[-q|--quiet]}} {{logfile.log}}`
- Display help:
`script {{[-h|--help]}}`

View File

@@ -19,12 +19,12 @@ source: https://github.com/tldr-pages/tldr.git
- Run a program creating a new process:
`setsid --fork {{program}}`
`setsid {{[-f|--fork]}} {{program}}`
- Return the exit code of a program as the exit code of setsid when the program exits:
`setsid --wait {{program}}`
`setsid {{[-w|--wait]}} {{program}}`
- Run a program in a new session setting the current terminal as the controlling terminal:
`setsid --ctty {{program}}`
`setsid {{[-c|--ctty]}} {{program}}`

25
tldr/linux/su Normal file
View File

@@ -0,0 +1,25 @@
---
syntax: markdown
tags: [tldr, linux]
source: https://github.com/tldr-pages/tldr.git
---
# su
> Switch shell to another user.
> More information: <https://manned.org/su>.
- Switch to superuser (requires the root password):
`su`
- Switch to a given user (requires the user's password):
`su {{username}}`
- Switch to a given user and simulate a full login shell:
`su - {{username}}`
- Execute a command as another user:
`su - {{username}} {{[-c|--command]}} "{{command}}"`

View File

@@ -7,7 +7,7 @@ source: https://github.com/tldr-pages/tldr.git
> Disable devices and files for swapping.
> Note: `path/to/file` can either point to a regular file or a swap partition.
> More information: <https://manned.org/swapoff>.
> More information: <https://manned.org/swapoff.8>.
- Disable a given swap area:
@@ -15,7 +15,7 @@ source: https://github.com/tldr-pages/tldr.git
- Disable all swap areas in `/proc/swaps`:
`swapoff --all`
`swapoff {{[-a|--all]}}`
- Disable a swap partition by its label:

View File

@@ -7,7 +7,7 @@ source: https://github.com/tldr-pages/tldr.git
> Enable devices and files for swapping.
> Note: `path/to/file` can either point to a regular file or a swap partition.
> More information: <https://manned.org/swapon>.
> More information: <https://manned.org/swapon.8>.
- Show swap information:
@@ -19,7 +19,7 @@ source: https://github.com/tldr-pages/tldr.git
- Enable all swap areas specified in `/etc/fstab` except those with the `noauto` option:
`swapon --all`
`swapon {{[-a|--all]}}`
- Enable a swap partition by its label:

View File

@@ -16,4 +16,4 @@ source: https://github.com/tldr-pages/tldr.git
- Display help:
`switch_root -h`
`switch_root {{[-h|--help]}}`

View File

@@ -10,20 +10,20 @@ source: https://github.com/tldr-pages/tldr.git
- Get a running process' CPU affinity by PID:
`taskset --pid --cpu-list {{pid}}`
`taskset {{[-p|--pid]}} {{[-c|--cpu-list]}} {{pid}}`
- Set a running process' CPU affinity by PID:
`taskset --pid --cpu-list {{cpu_id}} {{pid}}`
`taskset {{[-p|--pid]}} {{[-c|--cpu-list]}} {{cpu_id}} {{pid}}`
- Start a new process with affinity for a single CPU:
`taskset --cpu-list {{cpu_id}} {{command}}`
`taskset {{[-c|--cpu-list]}} {{cpu_id}} {{command}}`
- Start a new process with affinity for multiple non-sequential CPUs:
`taskset --cpu-list {{cpu_id_1}},{{cpu_id_2}},{{cpu_id_3}}`
`taskset {{[-c|--cpu-list]}} {{cpu_id_1}},{{cpu_id_2}},{{cpu_id_3}}`
- Start a new process with affinity for CPUs 1 through 4:
`taskset --cpu-list {{cpu_id_1}}-{{cpu_id_4}}`
`taskset {{[-c|--cpu-list]}} {{cpu_id_1}}-{{cpu_id_4}}`

View File

@@ -15,4 +15,4 @@ source: https://github.com/tldr-pages/tldr.git
- Display the contents of the file with underlines made of dashes `-`:
`ul -i {{file.txt}}`
`ul {{[-i|--indicated]}} {{file.txt}}`

View File

@@ -6,12 +6,12 @@ source: https://github.com/tldr-pages/tldr.git
# unshare
> Execute a command in new user-defined namespaces.
> More information: <https://www.kernel.org/doc/html/latest/userspace-api/unshare.html>.
> More information: <https://manned.org/unshare>.
- Execute a command without sharing access to connected networks:
`unshare --net {{command}} {{command_arguments}}`
`unshare {{[-n|--net]}} {{command}} {{command_arguments}}`
- Execute a command as a child process without sharing mounts, processes, or networks:
`unshare --mount --pid --net --fork {{command}} {{command_arguments}}`
`unshare {{[-m|--mount]}} {{[-i|--pid]}} {{[-n|--net]}} {{[-f|--fork]}} {{command}} {{command_arguments}}`

View File

@@ -14,4 +14,4 @@ source: https://github.com/tldr-pages/tldr.git
- Load a previously dumped file into `/var/log/wtmp`:
`utmpdump -r {{dumpfile}} > {{/var/log/wtmp}}`
`utmpdump {{[-r|--reverse]}} {{dumpfile}} > {{/var/log/wtmp}}`

View File

@@ -11,12 +11,12 @@ source: https://github.com/tldr-pages/tldr.git
- Create a random UUIDv4:
`uuidgen --random`
`uuidgen {{[-r|--random]}}`
- Create a UUIDv1 based on the current time:
`uuidgen --time`
`uuidgen {{[-t|--time]}}`
- Create a UUIDv5 of the name with a specified namespace prefix:
`uuidgen --sha1 --namespace {{@dns|@url|@oid|@x500}} --name {{object_name}}`
`uuidgen {{[-s|--sha1]}} {{[-n|--namespace]}} {{@dns|@url|@oid|@x500}} {{[-N|--name]}} {{object_name}}`

View File

@@ -19,20 +19,20 @@ source: https://github.com/tldr-pages/tldr.git
- Use the JSON output format:
`uuidparse --json {{uuid1 uuid2 ...}}`
`uuidparse {{[-J|--json]}} {{uuid1 uuid2 ...}}`
- Do not print a header line:
`uuidparse --noheadings {{uuid1 uuid2 ...}}`
`uuidparse {{[-n|--noheadings]}} {{uuid1 uuid2 ...}}`
- Use the raw output format:
`uuidparse --raw {{uuid1 uuid2 ...}}`
`uuidparse {{[-r|--raw]}} {{uuid1 uuid2 ...}}`
- Specify which of the four output columns to print:
`uuidparse --output {{UUID,VARIANT,TYPE,TIME}}`
`uuidparse {{[-o|--output]}} {{UUID,VARIANT,TYPE,TIME}}`
- Display help:
`uuidparse -h`
`uuidparse {{[-h|--help]}}`

View File

@@ -14,4 +14,4 @@ source: https://github.com/tldr-pages/tldr.git
- Display version:
`vigr --version`
`vigr {{[-V|--version]}}`

View File

@@ -14,4 +14,4 @@ source: https://github.com/tldr-pages/tldr.git
- Display version:
`vipw --version`
`vipw {{[-V|--version]}}`

View File

@@ -15,16 +15,16 @@ source: https://github.com/tldr-pages/tldr.git
- Sleep for at most `n` seconds:
`waitpid --timeout {{n}} {{pid1 pid2 ...}}`
`waitpid {{[-t|--timeout]}} {{n}} {{pid1 pid2 ...}}`
- Do not error if specified PIDs have already exited:
`waitpid --exited {{pid1 pid2 ...}}`
`waitpid {{[-e|--exited]}} {{pid1 pid2 ...}}`
- Sleep until `n` of the specified processes have exited:
`waitpid --count {{n}} {{pid1 pid2 ...}}`
`waitpid {{[-c|--count]}} {{n}} {{pid1 pid2 ...}}`
- Display help:
`waitpid -h`
`waitpid {{[-h|--help]}}`

View File

@@ -14,8 +14,8 @@ source: https://github.com/tldr-pages/tldr.git
- Display the watchdog status in a single line in key-value pairs:
`wdctl --oneline`
`wdctl {{[-O|--oneline]}}`
- Display only specific watchdog flags (list is driver specific):
`wdctl --flags {{flag_list}}`
`wdctl {{[-f|--flags]}} {{flag_list}}`

33
tldr/linux/whereis Normal file
View File

@@ -0,0 +1,33 @@
---
syntax: markdown
tags: [tldr, linux]
source: https://github.com/tldr-pages/tldr.git
---
# whereis
> Locate the binary, source, and manual page files for a command.
> More information: <https://manned.org/whereis>.
- Locate binary, source and man pages for SSH:
`whereis {{ssh}}`
- Locate [b]inary and [m]an pages for ls:
`whereis -bm {{ls}}`
- Locate [s]ource of gcc and [m]an pages for Git:
`whereis -s {{gcc}} -m {{git}}`
- Locate [b]inaries for gcc in `/usr/bin/` only:
`whereis -b -B {{/usr/bin/}} -f {{gcc}}`
- Locate [u]nusual binaries (those that have more or less than one binary on the system):
`whereis -u *`
- Locate binaries that have [u]nusual [m]anual entries (binaries that have more or less than one manual installed):
`whereis -u -m *`

View File

@@ -14,16 +14,16 @@ source: https://github.com/tldr-pages/tldr.git
- Wipe all available signature types for a specific device with no recursion into partitions:
`sudo wipefs --all {{/dev/sdX}}`
`sudo wipefs {{[-a|--all]}} {{/dev/sdX}}`
- Wipe all available signature types for the device and partitions using a glob pattern:
`sudo wipefs --all {{/dev/sdX}}*`
`sudo wipefs {{[-a|--all]}} {{/dev/sdX}}*`
- Perform dry run:
`sudo wipefs --all --no-act {{/dev/sdX}}`
`sudo wipefs {{[-a|--all]}} {{[-n|--no-act]}} {{/dev/sdX}}`
- Force wipe, even if the filesystem is mounted:
`sudo wipefs --all --force {{/dev/sdX}}`
`sudo wipefs {{[-a|--all]}} {{[-f|--force]}} {{/dev/sdX}}`

22
tldr/linux/write Normal file
View File

@@ -0,0 +1,22 @@
---
syntax: markdown
tags: [tldr, linux]
source: https://github.com/tldr-pages/tldr.git
---
# write
> Write a message on the terminal of a specified logged in user (`<Ctrl c>` to stop writing messages).
> Use the `who` command to find out all terminal_ids of all active users active on the system. See also `mesg`.
> More information: <https://manned.org/write>.
- Send a message to a given user on a given terminal ID:
`write {{username}} {{terminal_id}}`
- Send message to "testuser" on terminal `/dev/tty/5`:
`write {{testuser}} {{tty/5}}`
- Send message to "johndoe" on pseudo terminal `/dev/pts/5`:
`write {{johndoe}} {{pts/5}}`

View File

@@ -11,7 +11,7 @@ source: https://github.com/tldr-pages/tldr.git
- Check if zram is enabled:
`lsmod | grep -i zram`
`lsmod | grep {{[-i|--ignore-case]}} zram`
- Enable zram with a dynamic number of devices (use `zramctl` to configure devices further):
@@ -23,7 +23,7 @@ source: https://github.com/tldr-pages/tldr.git
- Find and initialize the next free zram device to a 2 GB virtual drive using LZ4 compression:
`sudo zramctl --find --size {{2GB}} --algorithm {{lz4}}`
`sudo zramctl {{[-f|--find]}} {{[-s|--size]}} {{2GB}} {{[-a|--algorithm]}} {{lz4}}`
- List currently initialized devices: