Update cheatsheets

This commit is contained in:
ivuorinen
2025-03-13 00:18:34 +00:00
parent ffbd8c31db
commit 904f7fe0c1
46 changed files with 228 additions and 157 deletions

29
tldr/linux/bridge Normal file
View File

@@ -0,0 +1,29 @@
---
syntax: markdown
tags: [tldr, linux]
source: https://github.com/tldr-pages/tldr.git
---
# bridge
> Show and manipulate network bridge addresses and devices.
> More information: <https://manned.org/bridge>.
- List all bridges and their interfaces:
`bridge {{[l|link]}}`
- Show port vlan information:
`bridge {{[v|vlan]}}`
- Assign a VLAN to a port:
`sudo bridge {{[v|vlan]}} {{[a|add]}} dev {{lanX}} vid {{vlan_id}} pvid {{tagged|untagged}}`
- Remove a VLAN from a port:
`sudo bridge {{[v|vlan]}} {{[d|delete]}} dev {{lanX}} vid {{vlan_id}}`
- Watch for changes in bridge interfaces:
`bridge {{[mo|monitor]}}`

View File

@@ -18,23 +18,23 @@ source: https://github.com/tldr-pages/tldr.git
- Recursively copy a directory's contents to another location (if the destination exists, the directory is copied inside it):
`cp -r {{path/to/source_directory}} {{path/to/target_directory}}`
`cp {{[-r|--recursive]}} {{path/to/source_directory}} {{path/to/target_directory}}`
- Copy a directory recursively, in verbose mode (shows files as they are copied):
`cp -vr {{path/to/source_directory}} {{path/to/target_directory}}`
`cp {{[-vr|--verbose --recursive]}} {{path/to/source_directory}} {{path/to/target_directory}}`
- Copy multiple files at once to a directory:
`cp -t {{path/to/destination_directory}} {{path/to/file1 path/to/file2 ...}}`
`cp {{[-t|--target-directory]}} {{path/to/destination_directory}} {{path/to/file1 path/to/file2 ...}}`
- Copy all files with a specific extension to another location, in interactive mode (prompts user before overwriting):
`cp -i {{*.ext}} {{path/to/target_directory}}`
`cp {{[-i|--interactive]}} {{*.ext}} {{path/to/target_directory}}`
- Follow symbolic links before copying:
`cp -L {{link}} {{path/to/target_directory}}`
`cp {{[-L|--dereference]}} {{link}} {{path/to/target_directory}}`
- Use the full path of source files, creating any missing intermediate directories when copying:

View File

@@ -11,7 +11,7 @@ source: https://github.com/tldr-pages/tldr.git
- List all files, including hidden files:
`dir --all`
`dir {{[-a|--all]}}`
- List files including their author (`-l` is required):
@@ -19,11 +19,11 @@ source: https://github.com/tldr-pages/tldr.git
- List files excluding those that match a specified blob pattern:
`dir --hide={{pattern}}`
`dir --hide {{pattern}}`
- List subdirectories recursively:
`dir --recursive`
`dir {{[-R|--recursive]}}`
- Display help:

View File

@@ -18,8 +18,8 @@ source: https://github.com/tldr-pages/tldr.git
- Display memory in human-readable units:
`free -h`
`free {{[-h|--human]}}`
- Refresh the output every 2 seconds:
`free -s {{2}}`
`free {{[-s|--seconds]}} {{2}}`

View File

@@ -10,11 +10,11 @@ source: https://github.com/tldr-pages/tldr.git
- Define group administrators:
`sudo gpasswd -A {{user1,user2}} {{group}}`
`sudo gpasswd {{[-A|--administrators]}} {{user1,user2}} {{group}}`
- Set the list of group members:
`sudo gpasswd -M {{user1,user2}} {{group}}`
`sudo gpasswd {{[-M|--members]}} {{user1,user2}} {{group}}`
- Create a password for the named group:
@@ -22,8 +22,8 @@ source: https://github.com/tldr-pages/tldr.git
- Add a user to the named group:
`gpasswd -a {{user}} {{group}}`
`gpasswd {{[-a|--add]}} {{user}} {{group}}`
- Remove a user from the named group:
`gpasswd -d {{user}} {{group}}`
`gpasswd {{[-d|--delete]}} {{user}} {{group}}`

View File

@@ -15,8 +15,8 @@ source: https://github.com/tldr-pages/tldr.git
- Create a new system group:
`sudo groupadd --system {{group_name}}`
`sudo groupadd {{[-r|--system]}} {{group_name}}`
- Create a new group with the specific groupid:
`sudo groupadd --gid {{id}} {{group_name}}`
`sudo groupadd {{[-g|--gid]}} {{id}} {{group_name}}`

View File

@@ -11,8 +11,8 @@ source: https://github.com/tldr-pages/tldr.git
- Change the group name:
`sudo groupmod --new-name {{new_group}} {{group_name}}`
`sudo groupmod {{[-n|--new-name]}} {{new_group}} {{group_name}}`
- Change the group ID:
`sudo groupmod --gid {{new_id}} {{group_name}}`
`sudo groupmod {{[-g|--gid]}} {{new_id}} {{group_name}}`

View File

@@ -10,16 +10,16 @@ source: https://github.com/tldr-pages/tldr.git
- Output the first few lines of a file:
`head --lines {{count}} {{path/to/file}}`
`head {{[-n|--lines]}} {{count}} {{path/to/file}}`
- Output the first few bytes of a file:
`head --bytes {{count}} {{path/to/file}}`
`head {{[-c|--bytes]}} {{count}} {{path/to/file}}`
- Output everything but the last few lines of a file:
`head --lines -{{count}} {{path/to/file}}`
`head {{[-n|--lines]}} -{{count}} {{path/to/file}}`
- Output everything but the last few bytes of a file:
`head --bytes -{{count}} {{path/to/file}}`
`head {{[-c|--bytes]}} -{{count}} {{path/to/file}}`

View File

@@ -31,3 +31,7 @@ source: https://github.com/tldr-pages/tldr.git
- Change the MTU size for a network interface to use jumbo frames:
`sudo ip {{[l|link]}} {{[s|set]}} {{ethN}} mtu {{9000}}`
- Set the promisc mode status of a device:
`sudo ip {{[l|link]}} {{[s|set]}} {{ethN}} promisc {{on|off}}`

View File

@@ -14,28 +14,28 @@ source: https://github.com/tldr-pages/tldr.git
- Also list empty devices:
`lsblk -a`
`lsblk {{[-a|--all]}}`
- Print the SIZE column in bytes rather than in a human-readable format:
`lsblk -b`
`lsblk {{[-b|--bytes]}}`
- Output info about filesystems:
`lsblk -f`
`lsblk {{[-f|--fs]}}`
- Use ASCII characters for tree formatting:
`lsblk -i`
`lsblk {{[-i|--ascii]}}`
- Output info about block-device topology:
`lsblk -t`
`lsblk {{[-t|--topology]}}`
- Exclude the devices specified by the comma-separated list of major device numbers:
`lsblk -e {{1,7,...}}`
`lsblk {{[-e|--exclude]}} {{1,7,...}}`
- Display a customized summary using a comma-separated list of columns:
`lsblk --output {{NAME,SERIAL,MODEL,TRAN,TYPE,SIZE,FSTYPE,MOUNTPOINT,...}}`
`lsblk {{[-o|--output]}} {{NAME,SERIAL,MODEL,TRAN,TYPE,SIZE,FSTYPE,MOUNTPOINT,...}}`

View File

@@ -14,8 +14,8 @@ source: https://github.com/tldr-pages/tldr.git
- Display information in a table:
`lscpu --extended`
`lscpu {{[-e|--extended]}}`
- Display only information about offline CPUs in a table:
`lscpu --extended --offline`
`lscpu {{[-e|--extended]}} {{[-c|--offline]}}`

View File

@@ -14,15 +14,15 @@ source: https://github.com/tldr-pages/tldr.git
- List the USB hierarchy as a tree:
`lsusb -t`
`lsusb {{[-t|--tree]}}`
- List verbose information about USB devices:
`lsusb --verbose`
`lsusb {{[-V|--verbose]}}`
- List detailed information about a USB device:
`lsusb --verbose -s {{bus}}:{{device number}}`
`lsusb {{[-V|--verbose]}} -s {{bus}}:{{device number}}`
- List devices with a specified vendor and product ID only:

View File

@@ -10,12 +10,12 @@ source: https://github.com/tldr-pages/tldr.git
- Create a container interactively in `/var/lib/lxc/`:
`sudo lxc-create --name {{container}} --template download`
`sudo lxc-create {{[-n|--name]}} {{container}} {{[-t|--template]}} download`
- Create a container in a target directory:
`sudo lxc-create --lxcpath {{/path/to/directory/}} --name {{container}} --template download`
`sudo lxc-create {{[-P|--lxcpath]}} {{/path/to/directory/}} {{[-n|--name]}} {{container}} {{[-t|--template]}} download`
- Create a container passing options to a template:
`sudo lxc-create --name {{name}} --template download -- --dist {{distro-name}} --release {{release-version}} --arch {{arch}}`
`sudo lxc-create {{[-n|--name]}} {{name}} {{[-t|--template]}} download -- {{[-d|--dist]}} {{distro-name}} {{[-r|--release]}} {{release-version}} {{[-a|--arch]}} {{arch}}`

View File

@@ -26,4 +26,4 @@ source: https://github.com/tldr-pages/tldr.git
- List containers in a fancy, column-based output:
`sudo lxc-ls --fancy`
`sudo lxc-ls {{[-f|--fancy]}}`

17
tldr/linux/nstat Normal file
View File

@@ -0,0 +1,17 @@
---
syntax: markdown
tags: [tldr, linux]
source: https://github.com/tldr-pages/tldr.git
---
# nstat
> View network statistics.
> More information: <https://manned.org/nstat>.
- View network statistics since last time `nstat` was run:
`nstat`
- View all-time network statistics:
`nstat {{[-a|--ignore]}}`

View File

@@ -22,8 +22,8 @@ source: https://github.com/tldr-pages/tldr.git
- Shut down immediately without contacting the system manager:
`poweroff --force`
`poweroff {{[-f|--force]}}`
- Write the wtmp shutdown entry without shutting down the system:
`poweroff --wtmp-only`
`poweroff {{[-w|--wtmp-only]}}`

View File

@@ -17,11 +17,11 @@ source: https://github.com/tldr-pages/tldr.git
- Dry-run - display which renames would occur without performing them:
`rename -vn {{foo}} {{bar}} {{*}}`
`rename {{[-vn|--verbose --no-act]}} {{foo}} {{bar}} {{*}}`
- Do not overwrite existing files:
`rename -o {{foo}} {{bar}} {{*}}`
`rename {{[-o|--no-overwrite]}} {{foo}} {{bar}} {{*}}`
- Change file extensions:

View File

@@ -15,24 +15,24 @@ source: https://github.com/tldr-pages/tldr.git
- Replace all `apple` (extended regex) occurrences with `APPLE` (extended regex) in all input lines and print the result to `stdout`:
`{{command}} | sed -E 's/(apple)/\U\1/g'`
`{{command}} | sed {{[-E|--regexp-extended]}} 's/(apple)/\U\1/g'`
- Replace all `apple` (basic regex) occurrences with `mango` (basic regex) in a specific file and overwrite the original file in place:
`sed -i 's/apple/mango/g' {{path/to/file}}`
`sed {{[-i|--in-place]}} 's/apple/mango/g' {{path/to/file}}`
- Execute a specific script [f]ile and print the result to `stdout`:
- Execute a specific script file and print the result to `stdout`:
`{{command}} | sed -f {{path/to/script.sed}}`
`{{command}} | sed {{-f|--file}} {{path/to/script.sed}}`
- Print just the first line to `stdout`:
`{{command}} | sed -n '1p'`
`{{command}} | sed {{[-n|--quiet]}} '1p'`
- [d]elete the first line of a file:
`sed -i 1d {{path/to/file}}`
`sed {{[-i|--in-place]}} 1d {{path/to/file}}`
- [i]nsert a new line at the first line of a file:
`sed -i '1i\your new line text\' {{path/to/file}}`
`sed {{[-i|--in-place]}} '1i\your new line text\' {{path/to/file}}`

View File

@@ -14,23 +14,23 @@ source: https://github.com/tldr-pages/tldr.git
- Do not show any idle or zombie processes:
`top -i`
`top {{[-i|--idle-toggle]}}`
- Show only processes owned by given user:
`top -u {{username}}`
`top {{[-u|--filter-only-euser]}} {{username}}`
- Sort processes by a field:
`top -o {{field_name}}`
`top {{[-o|--sort-override]}} {{field_name}}`
- Show the individual threads of a given process:
`top -Hp {{process_id}}`
`top {{[-Hp|--threads-show --pid]}} {{process_id}}`
- Show only the processes with the given PID(s), passed as a comma-separated list. (Normally you wouldn't know PIDs off hand. This example picks the PIDs from the process name):
`top -p $(pgrep -d ',' {{process_name}})`
`top {{[-p|--pid]}} $(pgrep {{[-d|--delimiter]}} ',' {{process_name}})`
- Display help about interactive commands:

View File

@@ -19,12 +19,12 @@ source: https://github.com/tldr-pages/tldr.git
- When an unmount fails, try to remount the filesystem read-only:
`umount --read-only {{path/to/mounted_directory}}`
`umount {{[-r|--read-only]}} {{path/to/mounted_directory}}`
- Recursively unmount each specified directory:
`umount --recursive {{path/to/mounted_directory}}`
`umount {{[-R|--recursive]}} {{path/to/mounted_directory}}`
- Unmount all mounted filesystems (except the `proc` filesystem):
`umount -a`
`umount {{[-a|--all]}}`

View File

@@ -11,28 +11,28 @@ source: https://github.com/tldr-pages/tldr.git
- Add files/directories to a specific archive:
`zip -r {{path/to/compressed.zip}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}`
`zip {{[-r|--recurse-paths}} {{path/to/compressed.zip}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}`
- Remove files/directories from a specific archive:
`zip --delete {{path/to/compressed.zip}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}`
`zip {{[-d|--delete]}} {{path/to/compressed.zip}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}`
- Archive files/directories e[x]cluding specified ones:
- Archive files/directories excluding specified ones:
`zip {{path/to/compressed.zip}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}} --exclude {{path/to/excluded_files_or_directories}}`
`zip {{path/to/compressed.zip}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}} {{-x|--exclude}} {{path/to/excluded_files_or_directories}}`
- Archive files/directories with a specific compression level (`0` - the lowest, `9` - the highest):
`zip -r -{{0..9}} {{path/to/compressed.zip}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}`
`zip {{[-r|--recurse-paths]}} -{{0..9}} {{path/to/compressed.zip}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}`
- Create an encrypted archive with a specific password:
`zip -r --encrypt {{path/to/compressed.zip}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}`
`zip {{[-r|--recurse-paths]}} {{[-e|--encrypt]}} {{path/to/compressed.zip}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}`
- Archive files/directories to a multi-part [s]plit Zip archive (e.g. 3 GB parts):
`zip -r -s {{3g}} {{path/to/compressed.zip}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}`
`zip {{[-r|--recurse-paths]}} {{[-s|--split-size]}} {{3g}} {{path/to/compressed.zip}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}`
- Print a specific archive contents:
`zip -sf {{path/to/compressed.zip}}`
`zip {{[-sf|--split-size --freshen]}} {{path/to/compressed.zip}}`