diff --git a/tldr/alias b/tldr/alias index b69b89e3..92b3d6db 100644 --- a/tldr/alias +++ b/tldr/alias @@ -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: . +> 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: . - List all aliases: diff --git a/tldr/bg b/tldr/bg index 241d74d4..b2d1952c 100644 --- a/tldr/bg +++ b/tldr/bg @@ -6,12 +6,13 @@ source: https://github.com/tldr-pages/tldr.git # bg > Resume suspended jobs (e.g. using ``), and keeps them running in the background. +> See also: `jobs`, `fg` and `disown`. > More information: . - 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}}` diff --git a/tldr/command b/tldr/command index 4007605c..0e30321a 100644 --- a/tldr/command +++ b/tldr/command @@ -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}}` diff --git a/tldr/dirs b/tldr/dirs index e16096af..936721c0 100644 --- a/tldr/dirs +++ b/tldr/dirs @@ -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: . - 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` diff --git a/tldr/disown b/tldr/disown index 51b2816d..c8eb1199 100644 --- a/tldr/disown +++ b/tldr/disown @@ -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: . - 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}}` diff --git a/tldr/echo b/tldr/echo index e3a7fb02..98dfeccb 100644 --- a/tldr/echo +++ b/tldr/echo @@ -6,6 +6,7 @@ source: https://github.com/tldr-pages/tldr.git # echo > Print given arguments. +> See also: `printf`. > More information: . - Print a text message. Note: Quotes are optional: diff --git a/tldr/env b/tldr/env index 0ededaf5..7d01e544 100644 --- a/tldr/env +++ b/tldr/env @@ -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}}` diff --git a/tldr/fg b/tldr/fg index e96c79e3..39cb15dc 100644 --- a/tldr/fg +++ b/tldr/fg @@ -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: . - 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}}` diff --git a/tldr/k3s b/tldr/k3s new file mode 100644 index 00000000..69a5e07e --- /dev/null +++ b/tldr/k3s @@ -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: . + +- 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` diff --git a/tldr/linux/aa-audit b/tldr/linux/aa-audit new file mode 100644 index 00000000..c2187c47 --- /dev/null +++ b/tldr/linux/aa-audit @@ -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: . + +- 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]}}` diff --git a/tldr/linux/aa-cleanprof b/tldr/linux/aa-cleanprof new file mode 100644 index 00000000..c285b7a7 --- /dev/null +++ b/tldr/linux/aa-cleanprof @@ -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: . + +- 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]}}` diff --git a/tldr/linux/aa-decode b/tldr/linux/aa-decode new file mode 100644 index 00000000..cd8cbae2 --- /dev/null +++ b/tldr/linux/aa-decode @@ -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: . + +- 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]}}` diff --git a/tldr/linux/aa-genprof b/tldr/linux/aa-genprof new file mode 100644 index 00000000..3772eef4 --- /dev/null +++ b/tldr/linux/aa-genprof @@ -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: . + +- 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]}}` diff --git a/tldr/linux/aa-logprof b/tldr/linux/aa-logprof new file mode 100644 index 00000000..3aa5705d --- /dev/null +++ b/tldr/linux/aa-logprof @@ -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: . + +- 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]}}` diff --git a/tldr/linux/aa-mergeprof b/tldr/linux/aa-mergeprof new file mode 100644 index 00000000..8de58375 --- /dev/null +++ b/tldr/linux/aa-mergeprof @@ -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: . + +- 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]}}` diff --git a/tldr/linux/aa-remove-unknown b/tldr/linux/aa-remove-unknown new file mode 100644 index 00000000..6ce62135 --- /dev/null +++ b/tldr/linux/aa-remove-unknown @@ -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: . + +- 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]}}` diff --git a/tldr/linux/aa-teardown b/tldr/linux/aa-teardown new file mode 100644 index 00000000..b0f3c681 --- /dev/null +++ b/tldr/linux/aa-teardown @@ -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: . + +- Disable all AppArmor profiles and stop enforcement: + +`sudo aa-teardown` + +- Display help: + +`aa-teardown {{[-h|--help]}}` diff --git a/tldr/linux/aa-unconfined b/tldr/linux/aa-unconfined new file mode 100644 index 00000000..12b43ee7 --- /dev/null +++ b/tldr/linux/aa-unconfined @@ -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: . + +- 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]}}` diff --git a/tldr/linux/apparmor_parser b/tldr/linux/apparmor_parser new file mode 100644 index 00000000..3a28d94c --- /dev/null +++ b/tldr/linux/apparmor_parser @@ -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: . + +- 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}}` diff --git a/tldr/local b/tldr/local index 8381f156..05b48d72 100644 --- a/tldr/local +++ b/tldr/local @@ -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: . - Declare a string variable with the specified value: diff --git a/tldr/mitmdump b/tldr/mitmdump index f7a3de2e..40317e67 100644 --- a/tldr/mitmdump +++ b/tldr/mitmdump @@ -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` diff --git a/tldr/mtm b/tldr/mtm new file mode 100644 index 00000000..1abb52eb --- /dev/null +++ b/tldr/mtm @@ -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: . + +- Start the program with default command chord (``): + +`mtm` + +- Use `` as the command chord: + +`mtm -c {{q}}` + +- Split and stack horizontally: + +`` + +- Split and stack vertically: + +`` + +- View scrollback buffer: + +`` + +- Switch terminals: + +`` + +- Close current terminal: + +`` diff --git a/tldr/popd b/tldr/popd index 801a40d4..83960b3c 100644 --- a/tldr/popd +++ b/tldr/popd @@ -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: . - Remove the top directory from the stack and cd to it: diff --git a/tldr/printf b/tldr/printf index 61c43aa8..0f541507 100644 --- a/tldr/printf +++ b/tldr/printf @@ -6,6 +6,7 @@ source: https://github.com/tldr-pages/tldr.git # printf > Format and print text. +> See also: `echo`. > More information: . - Print a text message: diff --git a/tldr/pushd b/tldr/pushd index e859c72b..3f90cbbc 100644 --- a/tldr/pushd +++ b/tldr/pushd @@ -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: . - Switch to directory and push it on the stack: diff --git a/tldr/test b/tldr/test index c1a48cf6..bd1c0f85 100644 --- a/tldr/test +++ b/tldr/test @@ -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` diff --git a/tldr/unalias b/tldr/unalias index 539b657d..0a70439f 100644 --- a/tldr/unalias +++ b/tldr/unalias @@ -6,6 +6,7 @@ source: https://github.com/tldr-pages/tldr.git # unalias > Remove aliases. +> See also: `alias`. > More information: . - Remove an alias: diff --git a/tldr/wait b/tldr/wait index da46e7b0..0121a87e 100644 --- a/tldr/wait +++ b/tldr/wait @@ -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: . - 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}}`