From 5905e786abfdf68308cbe1a57db6fcefbe75161e Mon Sep 17 00:00:00 2001 From: Managor <42655600+Managor@users.noreply.github.com> Date: Fri, 28 Mar 2025 16:06:49 +0200 Subject: [PATCH] util-linux: add option placeholders and properly split posix versions in common (#16037) --- pages/common/logger.md | 20 ++------------------ pages/common/renice.md | 18 +++++++----------- pages/common/whereis.md | 28 ---------------------------- pages/common/write.md | 2 +- pages/linux/blkdiscard.md | 4 ++-- pages/linux/blkid.md | 2 +- pages/linux/cfdisk.md | 2 +- pages/linux/chcpu.md | 4 ++-- pages/linux/choom.md | 6 +++--- pages/linux/chrt.md | 10 +++++----- pages/{common => linux}/column.md | 0 pages/linux/fallocate.md | 6 +++--- pages/linux/findmnt.md | 4 ++-- pages/{common => linux}/flock.md | 6 +++--- pages/linux/fstrim.md | 4 ++-- pages/{common => linux}/hexdump.md | 6 +++--- pages/linux/hwclock.md | 4 ++-- pages/linux/ipcrm.md | 14 +++++++------- pages/linux/isosize.md | 4 ++-- pages/{common => linux}/last.md | 0 pages/linux/lastb.md | 8 ++++---- pages/linux/logger.md | 24 ++++++++++++++++++++++++ pages/linux/losetup.md | 10 +++++----- pages/linux/lslocks.md | 8 ++++---- pages/linux/lsns.md | 8 ++++---- pages/linux/mcookie.md | 6 +++--- pages/linux/mkfs.md | 4 ++-- pages/linux/mkswap.md | 4 ++-- pages/{common => linux}/mount.md | 0 pages/linux/mountpoint.md | 4 ++-- pages/linux/namei.md | 8 ++++---- pages/linux/nologin.md | 2 +- pages/linux/nsenter.md | 8 ++++---- pages/linux/partx.md | 6 +++--- pages/linux/prlimit.md | 4 ++-- pages/linux/raw.md | 2 +- pages/linux/renice.md | 22 ++++++++++++++++++++++ pages/{common => linux}/rev.md | 6 +++--- pages/linux/rfkill.md | 4 ++-- pages/linux/rtcwake.md | 12 ++++++------ pages/linux/runuser.md | 10 +++++----- pages/{common => linux}/script.md | 0 pages/linux/setsid.md | 6 +++--- pages/{common => linux}/su.md | 0 pages/linux/swapoff.md | 4 ++-- pages/linux/swapon.md | 4 ++-- pages/linux/switch_root.md | 2 +- pages/linux/taskset.md | 10 +++++----- pages/linux/ul.md | 2 +- pages/linux/unshare.md | 6 +++--- pages/linux/utmpdump.md | 2 +- pages/linux/uuidgen.md | 6 +++--- pages/linux/uuidparse.md | 10 +++++----- pages/linux/vigr.md | 2 +- pages/linux/vipw.md | 2 +- pages/linux/waitpid.md | 8 ++++---- pages/linux/wdctl.md | 4 ++-- pages/linux/whereis.md | 28 ++++++++++++++++++++++++++++ pages/linux/wipefs.md | 8 ++++---- pages/linux/write.md | 17 +++++++++++++++++ pages/linux/zramctl.md | 4 ++-- 61 files changed, 236 insertions(+), 193 deletions(-) delete mode 100644 pages/common/whereis.md rename pages/{common => linux}/column.md (100%) rename pages/{common => linux}/flock.md (60%) rename pages/{common => linux}/hexdump.md (70%) rename pages/{common => linux}/last.md (100%) create mode 100644 pages/linux/logger.md rename pages/{common => linux}/mount.md (100%) create mode 100644 pages/linux/renice.md rename pages/{common => linux}/rev.md (80%) rename pages/{common => linux}/script.md (100%) rename pages/{common => linux}/su.md (100%) create mode 100644 pages/linux/whereis.md create mode 100644 pages/linux/write.md diff --git a/pages/common/logger.md b/pages/common/logger.md index 979d194a50..8b58963caa 100644 --- a/pages/common/logger.md +++ b/pages/common/logger.md @@ -1,24 +1,8 @@ # logger -> Add messages to syslog (/var/log/syslog). -> More information: . +> Add messages to syslog. +> More information: . - 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 --server {{hostname}} --port {{port}}` - -- Use a specific tag for every line logged. Default is the name of logged in user: - -`echo {{log_entry}} | logger --tag {{tag}}` - -- Log messages with a given priority. Default is `user.notice`. See `man logger` for all priority options: - -`echo {{log_entry}} | logger --priority {{user.warning}}` diff --git a/pages/common/renice.md b/pages/common/renice.md index f3951b9cff..18fe042a60 100644 --- a/pages/common/renice.md +++ b/pages/common/renice.md @@ -3,20 +3,16 @@ > Alter the scheduling priority/niceness of running processes. > Niceness values range from -20 (most favorable to the process) to 19 (least favorable to the process). > See also: `nice`. -> More information: . +> More information: . -- Set the absolute priority of a running process: +- Increase/decrease the priority of a running [p]rocess: -`renice --priority {{3}} {{[-p|--pid]}} {{pid}}` +`renice -n {{3}} -p {{pid}}` -- Increase the priority of a running process: +- Increase/decrease the priority of all processes owned by a [u]ser: -`sudo renice --relative {{-4}} {{[-p|--pid]}} {{pid}}` +`renice -n {{-4}} -u {{uid|user}}` -- Decrease the priority of all processes owned by a user: +- Increase/decrease the priority of all processes that belong to a process [g]roup: -`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}}` +`renice -n {{5}} -g {{process_group}}` diff --git a/pages/common/whereis.md b/pages/common/whereis.md deleted file mode 100644 index 1bde404218..0000000000 --- a/pages/common/whereis.md +++ /dev/null @@ -1,28 +0,0 @@ -# whereis - -> Locate the binary, source, and manual page files for a command. -> More information: . - -- Locate binary, source and man pages for SSH: - -`whereis {{ssh}}` - -- Locate binary and man pages for ls: - -`whereis -bm {{ls}}` - -- Locate source of gcc and man pages for Git: - -`whereis -s {{gcc}} -m {{git}}` - -- Locate binaries for gcc in `/usr/bin/` only: - -`whereis -b -B {{/usr/bin/}} -f {{gcc}}` - -- Locate unusual binaries (those that have more or less than one binary on the system): - -`whereis -u *` - -- Locate binaries that have unusual manual entries (binaries that have more or less than one manual installed): - -`whereis -u -m *` diff --git a/pages/common/write.md b/pages/common/write.md index 5d77cbb89e..464921d1eb 100644 --- a/pages/common/write.md +++ b/pages/common/write.md @@ -2,7 +2,7 @@ > Write a message on the terminal of a specified logged in user (`` 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: . +> More information: . - Send a message to a given user on a given terminal ID: diff --git a/pages/linux/blkdiscard.md b/pages/linux/blkdiscard.md index adc701456d..a76df47b1c 100644 --- a/pages/linux/blkdiscard.md +++ b/pages/linux/blkdiscard.md @@ -9,8 +9,8 @@ - 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}}` diff --git a/pages/linux/blkid.md b/pages/linux/blkid.md index e175122fe9..3476f17cd2 100644 --- a/pages/linux/blkid.md +++ b/pages/linux/blkid.md @@ -9,4 +9,4 @@ - List all partitions in a table, including current mountpoints: -`sudo blkid -o list` +`sudo blkid {{[-o|--output]}} list` diff --git a/pages/linux/cfdisk.md b/pages/linux/cfdisk.md index 8bf5591335..c1fb03d2f7 100644 --- a/pages/linux/cfdisk.md +++ b/pages/linux/cfdisk.md @@ -9,4 +9,4 @@ - Create a new partition table for a specific device and manage it: -`cfdisk --zero {{/dev/sdX}}` +`cfdisk {{[-z|--zero]}} {{/dev/sdX}}` diff --git a/pages/linux/chcpu.md b/pages/linux/chcpu.md index ca819d5d67..d3e34a8381 100644 --- a/pages/linux/chcpu.md +++ b/pages/linux/chcpu.md @@ -5,8 +5,8 @@ - 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}}` diff --git a/pages/linux/choom.md b/pages/linux/choom.md index bb135dba53..e7135256cc 100644 --- a/pages/linux/choom.md +++ b/pages/linux/choom.md @@ -5,12 +5,12 @@ - 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 ...}}` diff --git a/pages/linux/chrt.md b/pages/linux/chrt.md index 5d32bb5ffb..37e3084c29 100644 --- a/pages/linux/chrt.md +++ b/pages/linux/chrt.md @@ -5,20 +5,20 @@ - 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}}` diff --git a/pages/common/column.md b/pages/linux/column.md similarity index 100% rename from pages/common/column.md rename to pages/linux/column.md diff --git a/pages/linux/fallocate.md b/pages/linux/fallocate.md index a6f8637b25..1fb47e6558 100644 --- a/pages/linux/fallocate.md +++ b/pages/linux/fallocate.md @@ -6,12 +6,12 @@ - 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}}` diff --git a/pages/linux/findmnt.md b/pages/linux/findmnt.md index 7e7c8d6ff0..86f91bf0c7 100644 --- a/pages/linux/findmnt.md +++ b/pages/linux/findmnt.md @@ -17,7 +17,7 @@ - Find filesystems in specific type: -`findmnt -t {{ext4}}` +`findmnt {{[-t|--types]}} {{ext4}}` - Find filesystems with specific label: @@ -25,4 +25,4 @@ - Check mount table content in detail and verify `/etc/fstab`: -`findmnt --verify --verbose` +`findmnt {{[-x|--verify]}} --verbose` diff --git a/pages/common/flock.md b/pages/linux/flock.md similarity index 60% rename from pages/common/flock.md rename to pages/linux/flock.md index f1b4de436b..1f00325227 100644 --- a/pages/common/flock.md +++ b/pages/linux/flock.md @@ -6,12 +6,12 @@ - Run a command with a file lock as soon as the lock is not required by others: -`flock {{path/to/lock.lock}} --command "{{command}}"` +`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}} --nonblock --command "{{command}}"` +`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}} --nonblock --conflict-exit-code {{error_code}} -c "{{command}}"` +`flock {{path/to/lock.lock}} {{[-n|--nonblock]}} {{[-E|--conflict-exit-code]}} {{error_code}} {{[-c|--command]}} "{{command}}"` diff --git a/pages/linux/fstrim.md b/pages/linux/fstrim.md index 7e5a858924..47748a9cd6 100644 --- a/pages/linux/fstrim.md +++ b/pages/linux/fstrim.md @@ -6,7 +6,7 @@ - Trim unused blocks on all mounted partitions that support it: -`sudo fstrim --all` +`sudo fstrim {{[-a|--all]}}` - Trim unused blocks on a specified partition: @@ -14,4 +14,4 @@ - Display statistics after trimming: -`sudo fstrim --verbose {{/}}` +`sudo fstrim {{[-v|--verbose]}} {{/}}` diff --git a/pages/common/hexdump.md b/pages/linux/hexdump.md similarity index 70% rename from pages/common/hexdump.md rename to pages/linux/hexdump.md index da5bbb0fde..c465bff3ec 100644 --- a/pages/common/hexdump.md +++ b/pages/linux/hexdump.md @@ -9,12 +9,12 @@ - Display the input offset in hexadecimal and its ASCII representation in two columns: -`hexdump -C {{path/to/file}}` +`hexdump {{[-C|--canonical]}} {{path/to/file}}` - Display the hexadecimal representation of a file, but interpret only n bytes of the input: -`hexdump -C -n{{number_of_bytes}} {{path/to/file}}` +`hexdump {{[-C|--canonical]}} {{[-n|--length]}} {{number_of_bytes}} {{path/to/file}}` - Don't replace duplicate lines with '*': -`hexdump --no-squeezing {{path/to/file}}` +`hexdump {{[-v|--no-squeezing]}} {{path/to/file}}` diff --git a/pages/linux/hwclock.md b/pages/linux/hwclock.md index c69da41058..4bed680cbd 100644 --- a/pages/linux/hwclock.md +++ b/pages/linux/hwclock.md @@ -9,8 +9,8 @@ - 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]}}` diff --git a/pages/linux/ipcrm.md b/pages/linux/ipcrm.md index 4f252e2128..e0d9d3e1e5 100644 --- a/pages/linux/ipcrm.md +++ b/pages/linux/ipcrm.md @@ -5,28 +5,28 @@ - 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]}}` diff --git a/pages/linux/isosize.md b/pages/linux/isosize.md index cef8c32134..9dcf0efb0e 100644 --- a/pages/linux/isosize.md +++ b/pages/linux/isosize.md @@ -9,8 +9,8 @@ - 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}}` diff --git a/pages/common/last.md b/pages/linux/last.md similarity index 100% rename from pages/common/last.md rename to pages/linux/last.md diff --git a/pages/linux/lastb.md b/pages/linux/lastb.md index 9ae510c857..4bb276ef8e 100644 --- a/pages/linux/lastb.md +++ b/pages/linux/lastb.md @@ -9,16 +9,16 @@ - 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]}}` diff --git a/pages/linux/logger.md b/pages/linux/logger.md new file mode 100644 index 0000000000..1cbc7fcff9 --- /dev/null +++ b/pages/linux/logger.md @@ -0,0 +1,24 @@ +# logger + +> Add messages to syslog (/var/log/syslog). +> More information: . + +- 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}}` diff --git a/pages/linux/losetup.md b/pages/linux/losetup.md index 2bb5fbf0ee..c2b1e1df12 100644 --- a/pages/linux/losetup.md +++ b/pages/linux/losetup.md @@ -5,7 +5,7 @@ - List loop devices with detailed info: -`losetup -a` +`losetup {{[-a|--all]}}` - Attach a file to a given loop device: @@ -13,16 +13,16 @@ - 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}}` diff --git a/pages/linux/lslocks.md b/pages/linux/lslocks.md index 495d0cc1dc..93f29d9a24 100644 --- a/pages/linux/lslocks.md +++ b/pages/linux/lslocks.md @@ -9,16 +9,16 @@ - 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]}}` diff --git a/pages/linux/lsns.md b/pages/linux/lsns.md index 898709ead1..c86cd26e78 100644 --- a/pages/linux/lsns.md +++ b/pages/linux/lsns.md @@ -9,16 +9,16 @@ - 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}}` diff --git a/pages/linux/mcookie.md b/pages/linux/mcookie.md index 97b47679b6..b14c47cfcd 100644 --- a/pages/linux/mcookie.md +++ b/pages/linux/mcookie.md @@ -9,12 +9,12 @@ - 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]}}` diff --git a/pages/linux/mkfs.md b/pages/linux/mkfs.md index 83f93c46be..c08d3e14ce 100644 --- a/pages/linux/mkfs.md +++ b/pages/linux/mkfs.md @@ -10,8 +10,8 @@ - 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}}` diff --git a/pages/linux/mkswap.md b/pages/linux/mkswap.md index 02773cf532..4834933e09 100644 --- a/pages/linux/mkswap.md +++ b/pages/linux/mkswap.md @@ -10,8 +10,8 @@ - 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}}` diff --git a/pages/common/mount.md b/pages/linux/mount.md similarity index 100% rename from pages/common/mount.md rename to pages/linux/mount.md diff --git a/pages/linux/mountpoint.md b/pages/linux/mountpoint.md index 020818c3b3..918b5544e2 100644 --- a/pages/linux/mountpoint.md +++ b/pages/linux/mountpoint.md @@ -9,8 +9,8 @@ - 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}}` diff --git a/pages/linux/namei.md b/pages/linux/namei.md index f2c6035865..0abf7321c5 100644 --- a/pages/linux/namei.md +++ b/pages/linux/namei.md @@ -10,16 +10,16 @@ - 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}}` diff --git a/pages/linux/nologin.md b/pages/linux/nologin.md index 6a48bc0a2c..c90fc878c4 100644 --- a/pages/linux/nologin.md +++ b/pages/linux/nologin.md @@ -5,7 +5,7 @@ - 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`: diff --git a/pages/linux/nsenter.md b/pages/linux/nsenter.md index 7aa126e86f..963cc4f97a 100644 --- a/pages/linux/nsenter.md +++ b/pages/linux/nsenter.md @@ -6,16 +6,16 @@ - 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}}` diff --git a/pages/linux/partx.md b/pages/linux/partx.md index 50df5e0070..ff50bf9ff7 100644 --- a/pages/linux/partx.md +++ b/pages/linux/partx.md @@ -5,12 +5,12 @@ - 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}}` diff --git a/pages/linux/prlimit.md b/pages/linux/prlimit.md index 8695950ed2..729e8f4504 100644 --- a/pages/linux/prlimit.md +++ b/pages/linux/prlimit.md @@ -10,8 +10,8 @@ - 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}}` diff --git a/pages/linux/raw.md b/pages/linux/raw.md index 9b1babb72d..8c145dcb6a 100644 --- a/pages/linux/raw.md +++ b/pages/linux/raw.md @@ -13,4 +13,4 @@ - Query all bound raw devices: -`raw -qa` +`raw {{[-qa|--query --all]}}` diff --git a/pages/linux/renice.md b/pages/linux/renice.md new file mode 100644 index 0000000000..f3951b9cff --- /dev/null +++ b/pages/linux/renice.md @@ -0,0 +1,22 @@ +# renice + +> Alter the scheduling priority/niceness of running processes. +> Niceness values range from -20 (most favorable to the process) to 19 (least favorable to the process). +> See also: `nice`. +> More information: . + +- Set the absolute priority of a running process: + +`renice --priority {{3}} {{[-p|--pid]}} {{pid}}` + +- Increase the priority of a running process: + +`sudo renice --relative {{-4}} {{[-p|--pid]}} {{pid}}` + +- Decrease the priority of all processes owned by a user: + +`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}}` diff --git a/pages/common/rev.md b/pages/linux/rev.md similarity index 80% rename from pages/common/rev.md rename to pages/linux/rev.md index fdc5afed60..b3bed056c5 100644 --- a/pages/common/rev.md +++ b/pages/linux/rev.md @@ -17,12 +17,12 @@ - Use '\0' as a line separator (zero termination): -`rev -0 {{path/to/file}}` +`rev {{[-0|--zero]}} {{path/to/file}}` - Display help: -`rev -h` +`rev {{[-h|--help]}}` - Display version: -`rev -V` +`rev {{[-V|--version]}}` diff --git a/pages/linux/rfkill.md b/pages/linux/rfkill.md index 0dde9aba41..a4ad0491a1 100644 --- a/pages/linux/rfkill.md +++ b/pages/linux/rfkill.md @@ -9,7 +9,7 @@ - Filter by columns: -`rfkill -o {{ID,TYPE,DEVICE}}` +`rfkill {{[-o|--output]}} {{ID,TYPE,DEVICE}}` - Block devices by type (e.g. bluetooth, wlan): @@ -21,4 +21,4 @@ - Output in JSON format: -`rfkill -J` +`rfkill {{[-J|--json]}}` diff --git a/pages/linux/rtcwake.md b/pages/linux/rtcwake.md index c3c62c5075..5adff9b04c 100644 --- a/pages/linux/rtcwake.md +++ b/pages/linux/rtcwake.md @@ -5,24 +5,24 @@ - 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 `` to abort): -`sudo rtcwake -m on --date {{hh:ss}}` +`sudo rtcwake {{[-m|--mode]}} on --date {{hh:ss}}` diff --git a/pages/linux/runuser.md b/pages/linux/runuser.md index 414238b1f0..ee76754511 100644 --- a/pages/linux/runuser.md +++ b/pages/linux/runuser.md @@ -5,20 +5,20 @@ - 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}}'` diff --git a/pages/common/script.md b/pages/linux/script.md similarity index 100% rename from pages/common/script.md rename to pages/linux/script.md diff --git a/pages/linux/setsid.md b/pages/linux/setsid.md index 419a3d9b2f..4da02fb69d 100644 --- a/pages/linux/setsid.md +++ b/pages/linux/setsid.md @@ -14,12 +14,12 @@ - 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}}` diff --git a/pages/common/su.md b/pages/linux/su.md similarity index 100% rename from pages/common/su.md rename to pages/linux/su.md diff --git a/pages/linux/swapoff.md b/pages/linux/swapoff.md index 266c772c0c..62b1294b97 100644 --- a/pages/linux/swapoff.md +++ b/pages/linux/swapoff.md @@ -2,7 +2,7 @@ > Disable devices and files for swapping. > Note: `path/to/file` can either point to a regular file or a swap partition. -> More information: . +> More information: . - Disable a given swap area: @@ -10,7 +10,7 @@ - Disable all swap areas in `/proc/swaps`: -`swapoff --all` +`swapoff {{[-a|--all]}}` - Disable a swap partition by its label: diff --git a/pages/linux/swapon.md b/pages/linux/swapon.md index 59212e4ea3..4746419e90 100644 --- a/pages/linux/swapon.md +++ b/pages/linux/swapon.md @@ -2,7 +2,7 @@ > Enable devices and files for swapping. > Note: `path/to/file` can either point to a regular file or a swap partition. -> More information: . +> More information: . - Show swap information: @@ -14,7 +14,7 @@ - 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: diff --git a/pages/linux/switch_root.md b/pages/linux/switch_root.md index 845e8170cf..0c73d4d524 100644 --- a/pages/linux/switch_root.md +++ b/pages/linux/switch_root.md @@ -11,4 +11,4 @@ - Display help: -`switch_root -h` +`switch_root {{[-h|--help]}}` diff --git a/pages/linux/taskset.md b/pages/linux/taskset.md index 155cdeff0e..7db664275a 100644 --- a/pages/linux/taskset.md +++ b/pages/linux/taskset.md @@ -5,20 +5,20 @@ - 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}}` diff --git a/pages/linux/ul.md b/pages/linux/ul.md index f443a8affc..c1e496d542 100644 --- a/pages/linux/ul.md +++ b/pages/linux/ul.md @@ -10,4 +10,4 @@ - Display the contents of the file with underlines made of dashes `-`: -`ul -i {{file.txt}}` +`ul {{[-i|--indicated]}} {{file.txt}}` diff --git a/pages/linux/unshare.md b/pages/linux/unshare.md index 8a9be7d1e0..cd992b6e72 100644 --- a/pages/linux/unshare.md +++ b/pages/linux/unshare.md @@ -1,12 +1,12 @@ # unshare > Execute a command in new user-defined namespaces. -> More information: . +> More information: . - 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}}` diff --git a/pages/linux/utmpdump.md b/pages/linux/utmpdump.md index 96964341ae..521a554c90 100644 --- a/pages/linux/utmpdump.md +++ b/pages/linux/utmpdump.md @@ -9,4 +9,4 @@ - Load a previously dumped file into `/var/log/wtmp`: -`utmpdump -r {{dumpfile}} > {{/var/log/wtmp}}` +`utmpdump {{[-r|--reverse]}} {{dumpfile}} > {{/var/log/wtmp}}` diff --git a/pages/linux/uuidgen.md b/pages/linux/uuidgen.md index e1679eca2e..35c30e89cc 100644 --- a/pages/linux/uuidgen.md +++ b/pages/linux/uuidgen.md @@ -6,12 +6,12 @@ - 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}}` diff --git a/pages/linux/uuidparse.md b/pages/linux/uuidparse.md index 3542f4d711..74c546a464 100644 --- a/pages/linux/uuidparse.md +++ b/pages/linux/uuidparse.md @@ -14,20 +14,20 @@ - 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]}}` diff --git a/pages/linux/vigr.md b/pages/linux/vigr.md index 42501799ac..5900985257 100644 --- a/pages/linux/vigr.md +++ b/pages/linux/vigr.md @@ -9,4 +9,4 @@ - Display version: -`vigr --version` +`vigr {{[-V|--version]}}` diff --git a/pages/linux/vipw.md b/pages/linux/vipw.md index 1e34815441..9c937d5a99 100644 --- a/pages/linux/vipw.md +++ b/pages/linux/vipw.md @@ -9,4 +9,4 @@ - Display version: -`vipw --version` +`vipw {{[-V|--version]}}` diff --git a/pages/linux/waitpid.md b/pages/linux/waitpid.md index 2e54fd3da0..68262a8866 100644 --- a/pages/linux/waitpid.md +++ b/pages/linux/waitpid.md @@ -10,16 +10,16 @@ - 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]}}` diff --git a/pages/linux/wdctl.md b/pages/linux/wdctl.md index 3ea49c18f2..d895db979f 100644 --- a/pages/linux/wdctl.md +++ b/pages/linux/wdctl.md @@ -9,8 +9,8 @@ - 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}}` diff --git a/pages/linux/whereis.md b/pages/linux/whereis.md new file mode 100644 index 0000000000..bd88488ff3 --- /dev/null +++ b/pages/linux/whereis.md @@ -0,0 +1,28 @@ +# whereis + +> Locate the binary, source, and manual page files for a command. +> More information: . + +- 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 *` diff --git a/pages/linux/wipefs.md b/pages/linux/wipefs.md index a1955e44d8..61724ce05c 100644 --- a/pages/linux/wipefs.md +++ b/pages/linux/wipefs.md @@ -9,16 +9,16 @@ - 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}}` diff --git a/pages/linux/write.md b/pages/linux/write.md new file mode 100644 index 0000000000..5d77cbb89e --- /dev/null +++ b/pages/linux/write.md @@ -0,0 +1,17 @@ +# write + +> Write a message on the terminal of a specified logged in user (`` 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: . + +- 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}}` diff --git a/pages/linux/zramctl.md b/pages/linux/zramctl.md index 8177dd8493..64cc323621 100644 --- a/pages/linux/zramctl.md +++ b/pages/linux/zramctl.md @@ -6,7 +6,7 @@ - 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): @@ -18,7 +18,7 @@ - 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: