mirror of
https://github.com/tldr-pages/tldr.git
synced 2025-03-28 21:16:20 +01:00
util-linux: add option placeholders and properly split posix versions in common (#16037)
This commit is contained in:
parent
bdf3762819
commit
5905e786ab
61 changed files with 236 additions and 193 deletions
|
@ -1,24 +1,8 @@
|
|||
# logger
|
||||
|
||||
> Add messages to syslog (/var/log/syslog).
|
||||
> More information: <https://manned.org/logger>.
|
||||
> Add messages to syslog.
|
||||
> More information: <https://manned.org/logger.1p>.
|
||||
|
||||
- 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}}`
|
||||
|
|
|
@ -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: <https://manned.org/renice>.
|
||||
> More information: <https://manned.org/renice.1p>.
|
||||
|
||||
- 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}}`
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
# 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 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 *`
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
> 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>.
|
||||
> More information: <https://manned.org/write.1p>.
|
||||
|
||||
- Send a message to a given user on a given terminal ID:
|
||||
|
||||
|
|
|
@ -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}}`
|
||||
|
|
|
@ -9,4 +9,4 @@
|
|||
|
||||
- List all partitions in a table, including current mountpoints:
|
||||
|
||||
`sudo blkid -o list`
|
||||
`sudo blkid {{[-o|--output]}} list`
|
||||
|
|
|
@ -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}}`
|
||||
|
|
|
@ -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}}`
|
||||
|
|
|
@ -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 ...}}`
|
||||
|
|
|
@ -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}}`
|
||||
|
|
|
@ -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}}`
|
||||
|
|
|
@ -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`
|
||||
|
|
|
@ -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}}"`
|
|
@ -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]}} {{/}}`
|
||||
|
|
|
@ -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}}`
|
|
@ -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]}}`
|
||||
|
|
|
@ -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]}}`
|
||||
|
|
|
@ -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}}`
|
||||
|
|
|
@ -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]}}`
|
||||
|
|
24
pages/linux/logger.md
Normal file
24
pages/linux/logger.md
Normal file
|
@ -0,0 +1,24 @@
|
|||
# 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}}`
|
|
@ -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}}`
|
||||
|
|
|
@ -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]}}`
|
||||
|
|
|
@ -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}}`
|
||||
|
|
|
@ -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]}}`
|
||||
|
|
|
@ -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}}`
|
||||
|
|
|
@ -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}}`
|
||||
|
|
|
@ -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}}`
|
||||
|
|
|
@ -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}}`
|
||||
|
|
|
@ -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`:
|
||||
|
||||
|
|
|
@ -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}}`
|
||||
|
|
|
@ -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}}`
|
||||
|
|
|
@ -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}}`
|
||||
|
|
|
@ -13,4 +13,4 @@
|
|||
|
||||
- Query all bound raw devices:
|
||||
|
||||
`raw -qa`
|
||||
`raw {{[-qa|--query --all]}}`
|
||||
|
|
22
pages/linux/renice.md
Normal file
22
pages/linux/renice.md
Normal file
|
@ -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: <https://manned.org/renice>.
|
||||
|
||||
- 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}}`
|
|
@ -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]}}`
|
|
@ -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]}}`
|
||||
|
|
|
@ -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 `<Ctrl c>` to abort):
|
||||
|
||||
`sudo rtcwake -m on --date {{hh:ss}}`
|
||||
`sudo rtcwake {{[-m|--mode]}} on --date {{hh:ss}}`
|
||||
|
|
|
@ -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}}'`
|
||||
|
|
|
@ -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}}`
|
||||
|
|
|
@ -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: <https://manned.org/swapoff>.
|
||||
> More information: <https://manned.org/swapoff.8>.
|
||||
|
||||
- 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:
|
||||
|
||||
|
|
|
@ -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: <https://manned.org/swapon>.
|
||||
> More information: <https://manned.org/swapon.8>.
|
||||
|
||||
- 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:
|
||||
|
||||
|
|
|
@ -11,4 +11,4 @@
|
|||
|
||||
- Display help:
|
||||
|
||||
`switch_root -h`
|
||||
`switch_root {{[-h|--help]}}`
|
||||
|
|
|
@ -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}}`
|
||||
|
|
|
@ -10,4 +10,4 @@
|
|||
|
||||
- Display the contents of the file with underlines made of dashes `-`:
|
||||
|
||||
`ul -i {{file.txt}}`
|
||||
`ul {{[-i|--indicated]}} {{file.txt}}`
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
# 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}}`
|
||||
|
|
|
@ -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}}`
|
||||
|
|
|
@ -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}}`
|
||||
|
|
|
@ -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]}}`
|
||||
|
|
|
@ -9,4 +9,4 @@
|
|||
|
||||
- Display version:
|
||||
|
||||
`vigr --version`
|
||||
`vigr {{[-V|--version]}}`
|
||||
|
|
|
@ -9,4 +9,4 @@
|
|||
|
||||
- Display version:
|
||||
|
||||
`vipw --version`
|
||||
`vipw {{[-V|--version]}}`
|
||||
|
|
|
@ -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]}}`
|
||||
|
|
|
@ -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}}`
|
||||
|
|
28
pages/linux/whereis.md
Normal file
28
pages/linux/whereis.md
Normal file
|
@ -0,0 +1,28 @@
|
|||
# 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 *`
|
|
@ -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}}`
|
||||
|
|
17
pages/linux/write.md
Normal file
17
pages/linux/write.md
Normal file
|
@ -0,0 +1,17 @@
|
|||
# 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}}`
|
|
@ -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:
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue