Update cheatsheets

This commit is contained in:
ivuorinen
2025-06-15 00:22:52 +00:00
parent ae37c90b9f
commit 27e9052087
28 changed files with 392 additions and 15 deletions

View File

@@ -6,8 +6,9 @@ source: https://github.com/tldr-pages/tldr.git
# alias
> Create aliases - words that are replaced by a command string.
> Aliases expire with the current shell session unless defined in the shell's configuration file, e.g. `~/.bashrc`.
> More information: <https://tldp.org/LDP/abs/html/aliases.html>.
> Aliases expire with the current shell session unless defined in the shell's configuration file, e.g. `~/.bashrc` for Bash or `~/.zshrc` for Zsh.
> See also: `unalias`.
> More information: <https://manned.org/alias>.
- List all aliases:

View File

@@ -6,12 +6,13 @@ source: https://github.com/tldr-pages/tldr.git
# bg
> Resume suspended jobs (e.g. using `<Ctrl z>`), and keeps them running in the background.
> See also: `jobs`, `fg` and `disown`.
> More information: <https://manned.org/bg>.
- Resume the most recently suspended job and run it in the background:
`bg`
- Resume a specific job (use `jobs -l` to get its ID) and run it in the background:
- Resume a specific job and run it in the background (run `jobs` to find the job number):
`bg %{{job_id}}`
`bg %{{job_number}}`

View File

@@ -12,6 +12,10 @@ source: https://github.com/tldr-pages/tldr.git
`command {{ls}}`
- Find and execute a command using a default `$PATH` (`/bin:/usr/bin:/sbin:/usr/sbin:/etc:/usr/etc`) that guarantees to find all standard utilities:
`command -p {{command_name}}`
- Display the path to the executable or the alias definition of a specific command:
`command -v {{command_name}}`

View File

@@ -7,6 +7,7 @@ source: https://github.com/tldr-pages/tldr.git
> Display or manipulate the directory stack.
> The directory stack is a list of recently visited directories that can be manipulated with the `pushd` and `popd` commands.
> See also: `pushd`, `popd`.
> More information: <https://www.gnu.org/software/bash/manual/bash.html#Directory-Stack-Builtins>.
- Display the directory stack with a space between each entry:
@@ -17,10 +18,22 @@ source: https://github.com/tldr-pages/tldr.git
`dirs -p`
- Display only the `n`th entry in the directory stack, starting at 0:
- Display a numbered list of entries in the directory stack:
`dirs -v`
- Display the directory stack without the tilde-prefix (`~`):
`dirs -l`
- Display only the `n`th entry in the directory stack, starting at 0 (Bash only):
`dirs +{{n}}`
- Display only the `n`th entry in the directory stack from the last, starting at 0 (Bash only):
`dirs -{{n}}`
- Clear the directory stack:
`dirs -c`

View File

@@ -6,21 +6,21 @@ source: https://github.com/tldr-pages/tldr.git
# disown
> Allow sub-processes to live beyond the shell that they are attached to.
> See also the `jobs` command.
> See also: `jobs` for finding job numbers.
> More information: <https://www.gnu.org/software/bash/manual/bash.html#index-disown>.
- Disown the current job:
`disown`
- Disown a specific job:
- Disown a specific job (run `jobs` to find the job number):
`disown %{{job_number}}`
- Disown all jobs:
- Disown all jobs (Bash only):
`disown -a`
- Keep job (do not disown it), but mark it so that no future SIGHUP is received on shell exit:
- Keep job (do not disown it), but mark it so that no future SIGHUP is received on shell exit (Bash only):
`disown -h %{{job_number}}`

View File

@@ -6,6 +6,7 @@ source: https://github.com/tldr-pages/tldr.git
# echo
> Print given arguments.
> See also: `printf`.
> More information: <https://www.gnu.org/software/coreutils/manual/html_node/echo-invocation.html>.
- Print a text message. Note: Quotes are optional:

View File

@@ -31,3 +31,7 @@ source: https://github.com/tldr-pages/tldr.git
- Set one or more variables and run a program:
`env {{variable1=value variable2=value variable3=value ...}} {{program}}`
- Run a program under a different name:
`env {{[-a|--argv0]}} {{custom_name}} {{program}}`

View File

@@ -6,12 +6,13 @@ source: https://github.com/tldr-pages/tldr.git
# fg
> Run jobs in foreground.
> See also: `jobs`, `bg` and `disown`.
> More information: <https://manned.org/fg>.
- Bring most recently suspended or running background job to foreground:
`fg`
- Bring a specific job to foreground:
- Bring a specific job to foreground (run `jobs` to find the job number):
`fg %{{job_id}}`
`fg %{{job_number}}`

29
tldr/k3s Normal file
View File

@@ -0,0 +1,29 @@
---
syntax: markdown
tags: [tldr, common]
source: https://github.com/tldr-pages/tldr.git
---
# k3s
> Install and manage lightweight Kubernetes clusters.
> More information: <https://docs.k3s.io/cli>.
- Run the embedded `kubectl` command:
`k3s kubectl get nodes`
- Take an etcd snapshot of the cluster:
`k3s etcd-snapshot save`
- Rotate the CA certificate:
`k3s certificate rotate-ca`
- Manage bootstrap tokens:
`k3s token list`
- Uninstall K3s and remove all components:
`k3s-uninstall.sh`

37
tldr/linux/aa-audit Normal file
View File

@@ -0,0 +1,37 @@
---
syntax: markdown
tags: [tldr, linux]
source: https://github.com/tldr-pages/tldr.git
---
# aa-audit
> Set AppArmor security profiles to audit mode.
> More information: <https://gitlab.com/apparmor/apparmor/-/wikis/manpage_aa-audit.8>.
- Set a profile to audit mode:
`sudo aa-audit {{profile_name}}`
- Set multiple profiles to audit mode:
`sudo aa-audit {{profile1 profile2 ...}}`
- Set a profile to audit mode from a specific directory:
`sudo aa-audit {{[-d|--dir]}} {{/path/to/profiles}} {{profile_name}}`
- Force audit mode even if already applied:
`sudo aa-audit --force {{profile_name}}`
- Set a profile to audit mode without reloading it:
`sudo aa-audit --no-reload {{profile_name}}`
- Remove audit mode for a profile:
`sudo aa-audit {{[-r|--remove]}} {{profile_name}}`
- Display help:
`aa-audit {{[-h|--help]}}`

33
tldr/linux/aa-cleanprof Normal file
View File

@@ -0,0 +1,33 @@
---
syntax: markdown
tags: [tldr, linux]
source: https://github.com/tldr-pages/tldr.git
---
# aa-cleanprof
> Clean AppArmor security profiles by removing unused rules.
> More information: <https://gitlab.com/apparmor/apparmor/-/wikis/manpage_aa-cleanprof.8>.
- Clean a profile to remove unused rules:
`sudo aa-cleanprof {{profile_name}}`
- Clean multiple profiles at once:
`sudo aa-cleanprof {{profile1 profile2 ...}}`
- Specify the directory containing profiles:
`sudo aa-cleanprof {{[-d|--dir]}} {{/path/to/profiles}} {{profile_name}}`
- Run silently without prompts:
`sudo aa-cleanprof {{[-s|--silent]}} {{profile_name}}`
- Prevent profile reload after cleaning:
`sudo aa-cleanprof --no-reload {{profile_name}}`
- Display help:
`aa-cleanprof {{[-h|--help]}}`

25
tldr/linux/aa-decode Normal file
View File

@@ -0,0 +1,25 @@
---
syntax: markdown
tags: [tldr, linux]
source: https://github.com/tldr-pages/tldr.git
---
# aa-decode
> Decode AppArmor audit logs into a human-readable format.
> More information: <https://gitlab.com/apparmor/apparmor/-/wikis/manpage_aa-decode.8>.
- Decode a hex string:
`aa-decode {{hexstring}}`
- Decode a log file:
`sudo aa-decode {{logfile}}`
- Decode logs from standard input (e.g., redirected file):
`sudo aa-decode - < {{logfile}}`
- Display help:
`aa-decode {{[-h|--help]}}`

25
tldr/linux/aa-genprof Normal file
View File

@@ -0,0 +1,25 @@
---
syntax: markdown
tags: [tldr, linux]
source: https://github.com/tldr-pages/tldr.git
---
# aa-genprof
> Generate AppArmor security profiles by monitoring program behavior.
> More information: <https://gitlab.com/apparmor/apparmor/-/wikis/manpage_aa-genprof.8>.
- Start generating a profile for a program:
`sudo aa-genprof {{program_path}}`
- Specify a custom directory for profiles:
`sudo aa-genprof {{[-d|--dir]}} {{/path/to/profiles}} {{program_path}}`
- Specify a custom logfile for profiling:
`sudo aa-genprof {{[-f|--file]}} {{/path/to/logfile}} {{program_path}}`
- Display help:
`aa-genprof {{[-h|--help]}}`

29
tldr/linux/aa-logprof Normal file
View File

@@ -0,0 +1,29 @@
---
syntax: markdown
tags: [tldr, linux]
source: https://github.com/tldr-pages/tldr.git
---
# aa-logprof
> Interactively update AppArmor security profiles based on logged violations.
> More information: <https://gitlab.com/apparmor/apparmor/-/wikis/manpage_aa-logprof.8>.
- Interactively review and update profiles based on system logs:
`sudo aa-logprof`
- Use a specific directory for AppArmor profiles:
`sudo aa-logprof {{[-d|--dir]}} {{/path/to/profiles}}`
- Use a specific log file instead of the default:
`sudo aa-logprof {{[-f|--file]}} {{/path/to/logfile}}`
- Ignore all log entries before the specified mark:
`sudo aa-logprof {{[-m|--logmark]}} "{{log_marker_text}}"`
- Display help:
`aa-logprof {{[-h|--help]}}`

21
tldr/linux/aa-mergeprof Normal file
View File

@@ -0,0 +1,21 @@
---
syntax: markdown
tags: [tldr, linux]
source: https://github.com/tldr-pages/tldr.git
---
# aa-mergeprof
> Merge AppArmor security profile files into the profile directory.
> More information: <https://gitlab.com/apparmor/apparmor/-/wikis/manpage_aa-mergeprof.8>.
- Merge one or more profile files into the default profile directory:
`sudo aa-mergeprof {{file1 file2 ...}}`
- Merge profile files into a specific directory:
`sudo aa-mergeprof {{[-d|--dir]}} {{/path/to/profiles}} {{file1 file2 ...}}`
- Display help:
`aa-mergeprof {{[-h|--help]}}`

View File

@@ -0,0 +1,21 @@
---
syntax: markdown
tags: [tldr, linux]
source: https://github.com/tldr-pages/tldr.git
---
# aa-remove-unknown
> Remove AppArmor profiles that are no longer present in the configuration directory.
> More information: <https://gitlab.com/apparmor/apparmor/-/wikis/manpage_aa-remove-unknown.8>.
- Perform a dry run to see which profiles would be removed:
`sudo aa-remove-unknown -n`
- Actually remove the profiles:
`sudo aa-remove-unknown`
- Display help:
`aa-remove-unknown {{[-h|--help]}}`

17
tldr/linux/aa-teardown Normal file
View File

@@ -0,0 +1,17 @@
---
syntax: markdown
tags: [tldr, linux]
source: https://github.com/tldr-pages/tldr.git
---
# aa-teardown
> Tear down all AppArmor profiles and disable AppArmor enforcement.
> More information: <https://gitlab.com/apparmor/apparmor/-/wikis/manpage_aa-teardown.8>.
- Disable all AppArmor profiles and stop enforcement:
`sudo aa-teardown`
- Display help:
`aa-teardown {{[-h|--help]}}`

25
tldr/linux/aa-unconfined Normal file
View File

@@ -0,0 +1,25 @@
---
syntax: markdown
tags: [tldr, linux]
source: https://github.com/tldr-pages/tldr.git
---
# aa-unconfined
> List processes with open TCP/UDP ports that do not have AppArmor profiles loaded.
> More information: <https://gitlab.com/apparmor/apparmor/-/wikis/manpage_aa-unconfined.8>.
- List unconfined processes using the `ss` command (default):
`sudo aa-unconfined`
- Use `netstat` instead of `ss` to detect open network sockets:
`sudo aa-unconfined --with-netstat`
- Show all processes from /proc with TCP/UDP ports and no AppArmor profiles (more detailed):
`sudo aa-unconfined --paranoid`
- Display help:
`aa-unconfined {{[-h|--help]}}`

View File

@@ -0,0 +1,41 @@
---
syntax: markdown
tags: [tldr, linux]
source: https://github.com/tldr-pages/tldr.git
---
# apparmor_parser
> Load, compile, and manage AppArmor security profiles.
> More information: <https://gitlab.com/apparmor/apparmor/-/wikis/manpage_apparmor_parser.8>.
- Load a profile into the kernel:
`sudo apparmor_parser {{[-a|--add]}} {{profile_file}}`
- Replace an existing profile:
`sudo apparmor_parser {{[-r|--replace]}} {{profile_file}}`
- Remove a profile from the kernel:
`sudo apparmor_parser {{[-R|--remove]}} {{profile_name}}`
- Load a profile in complain mode (logs violations but doesn't block):
`sudo apparmor_parser {{[-C|--complain]}} {{[-r|--replace]}} {{path/to/profile}}`
- Preprocess a profile (resolve includes) and write binary cache to file:
`apparmor_parser {{[-p|--preprocess]}} {{[-o|--ofile]}} {{path/to/output.cache}} {{[-Q|--skip-kernel-load]}} {{path/to/profile}}`
- Preprocess and print binary profile to stdout without loading:
`apparmor_parser {{[-p|--preprocess]}} {{[-S|--stdout]}} {{[-Q|--skip-kernel-load]}} {{path/to/profile}}`
- Replace a profile while skipping cache reads:
`sudo apparmor_parser {{[-r|--replace]}} {{[-T|--skip-read-cache]}} {{path/to/profile}}`
- Replace a profile, rebuild cache, and write it to a custom directory:
`sudo apparmor_parser {{[-r|--replace]}} {{[-W|--write-cache]}} {{[-L|--cache-loc]}} {{/path/to/cache}} {{path/to/profile}}`

View File

@@ -6,7 +6,7 @@ source: https://github.com/tldr-pages/tldr.git
# local
> Declare local variables and give them attributes.
> See also: `declare`.
> See also: `declare` and `export`.
> More information: <https://www.gnu.org/software/bash/manual/bash.html#index-local>.
- Declare a string variable with the specified value:

View File

@@ -20,3 +20,7 @@ source: https://github.com/tldr-pages/tldr.git
- Replay a saved traffic file:
`mitmdump {{[-nc|--no-server --client-replay]}} {{path/to/file}}`
- Intercept DNS traffic (starts an intercepting DNS server on 127.0.0.1:53):
`sudo mitmdump {{[-m|--mode]}} dns`

38
tldr/mtm Normal file
View File

@@ -0,0 +1,38 @@
---
syntax: markdown
tags: [tldr, common]
source: https://github.com/tldr-pages/tldr.git
---
# mtm
> Minimal terminal multiplexer.
> See also: `tmux`, `screen`.
> More information: <https://github.com/deadpixi/mtm>.
- Start the program with default command chord (`<Ctrl g>`):
`mtm`
- Use `<Ctrl q>` as the command chord:
`mtm -c {{q}}`
- Split and stack horizontally:
`<Ctrl g><h>`
- Split and stack vertically:
`<Ctrl g><v>`
- View scrollback buffer:
`<Ctrl g><PageUp>`
- Switch terminals:
`<Ctrl g><ArrowKeys>`
- Close current terminal:
`<Ctrl g><w>`

View File

@@ -6,7 +6,7 @@ source: https://github.com/tldr-pages/tldr.git
# popd
> Remove a directory placed on the directory stack via the pushd shell built-in.
> See also `pushd` to place a directory on the stack and `dirs` to display directory stack contents.
> See also: `pushd` to place a directory on the stack and `dirs` to display directory stack contents.
> More information: <https://www.gnu.org/software/bash/manual/html_node/Directory-Stack-Builtins.html#index-popd>.
- Remove the top directory from the stack and cd to it:

View File

@@ -6,6 +6,7 @@ source: https://github.com/tldr-pages/tldr.git
# printf
> Format and print text.
> See also: `echo`.
> More information: <https://www.gnu.org/software/coreutils/manual/html_node/printf-invocation.html>.
- Print a text message:

View File

@@ -6,7 +6,7 @@ source: https://github.com/tldr-pages/tldr.git
# pushd
> Place a directory on a stack so it can be accessed later.
> See also `popd` to switch back to original directory and `dirs` to display directory stack contents.
> See also: `popd` to switch back to original directory and `dirs` to display directory stack contents.
> More information: <https://www.gnu.org/software/bash/manual/html_node/Directory-Stack-Builtins.html#index-pushd>.
- Switch to directory and push it on the stack:

View File

@@ -28,3 +28,7 @@ source: https://github.com/tldr-pages/tldr.git
- If A is true, then do B, or C in the case of an error (notice that C may run even if A fails):
`test {{condition}} && {{echo "true"}} || {{echo "false"}}`
- Use `test` in a conditional statement:
`if test -f "{{path/to/file}}"; then echo "File exists"; else echo "File does not exist"; fi`

View File

@@ -6,6 +6,7 @@ source: https://github.com/tldr-pages/tldr.git
# unalias
> Remove aliases.
> See also: `alias`.
> More information: <https://manned.org/unalias>.
- Remove an alias:

View File

@@ -6,6 +6,7 @@ source: https://github.com/tldr-pages/tldr.git
# wait
> Wait for a process to complete before proceeding.
> See also: `ps` to view information about running processes.
> More information: <https://manned.org/wait>.
- Wait for a process to finish given its process ID (PID) and return its exit status:
@@ -16,7 +17,7 @@ source: https://github.com/tldr-pages/tldr.git
`wait`
- Wait for a job to finish:
- Wait for a job to finish (run `jobs` to find the job number):
`wait %{{job_number}}`