mirror of
https://github.com/ivuorinen/cheatsheet-tldr.git
synced 2026-02-03 21:43:35 +00:00
Update cheatsheets
This commit is contained in:
@@ -12,11 +12,11 @@ source: https://github.com/tldr-pages/tldr.git
|
||||
|
||||
`df`
|
||||
|
||||
- Display all filesystems and their disk usage in human-readable form:
|
||||
- Display all filesystems in human-readable form:
|
||||
|
||||
`df {{[-h|--human-readable]}}`
|
||||
|
||||
- Display the filesystem and its disk usage containing the given file or directory:
|
||||
- Display the filesystem containing the specified file or directory:
|
||||
|
||||
`df {{path/to/file_or_directory}}`
|
||||
|
||||
|
||||
@@ -37,6 +37,6 @@ source: https://github.com/tldr-pages/tldr.git
|
||||
|
||||
`iw reg get`
|
||||
|
||||
- Display help for all commands:
|
||||
- Display help:
|
||||
|
||||
`iw help`
|
||||
|
||||
31
tldr/linux/newrole
Normal file
31
tldr/linux/newrole
Normal file
@@ -0,0 +1,31 @@
|
||||
---
|
||||
syntax: markdown
|
||||
tags: [tldr, linux]
|
||||
source: https://github.com/tldr-pages/tldr.git
|
||||
---
|
||||
# newrole
|
||||
|
||||
> Run a new shell with a different SELinux role.
|
||||
> Allows users to switch to a different SELinux security context.
|
||||
> See also: `runcon`, `semanage-user`.
|
||||
> More information: <https://manned.org/newrole>.
|
||||
|
||||
- Start a new shell with a specific SELinux role:
|
||||
|
||||
`newrole {{[-r|--role]}} {{role_name}}`
|
||||
|
||||
- Start a new shell with a specific SELinux type:
|
||||
|
||||
`newrole {{[-t|--type]}} {{type_name}}`
|
||||
|
||||
- Start a new shell with a specific SELinux level (format: `s0-s0:c0.c1023` where levels range from `s0` to `s15`, `-` indicates level range, categories start with `c`, `:` separates level from categories, `.` indicates category range):
|
||||
|
||||
`newrole {{[-l|--level]}} {{s0-s0:c0.c1023}}`
|
||||
|
||||
- Display the current SELinux context:
|
||||
|
||||
`id {{[-Z|--context]}}`
|
||||
|
||||
- Start a new shell with both role and type:
|
||||
|
||||
`newrole {{[-r|--role]}} {{role_name}} {{[-t|--type]}} {{type_name}}`
|
||||
29
tldr/linux/paclock
Normal file
29
tldr/linux/paclock
Normal file
@@ -0,0 +1,29 @@
|
||||
---
|
||||
syntax: markdown
|
||||
tags: [tldr, linux]
|
||||
source: https://github.com/tldr-pages/tldr.git
|
||||
---
|
||||
# paclock
|
||||
|
||||
> Lock/unlock the libalpm database (used by `pacman`) to prevent or allow simultaneous package management operations.
|
||||
> More information: <https://github.com/andrewgregory/pacutils/blob/master/doc/paclock.pod>.
|
||||
|
||||
- Lock the database:
|
||||
|
||||
`paclock`
|
||||
|
||||
- Write the lock file path to `stdout` (without locking the database):
|
||||
|
||||
`paclock --print`
|
||||
|
||||
- Unlock the database:
|
||||
|
||||
`paclock --unlock`
|
||||
|
||||
- Display help:
|
||||
|
||||
`paclock --help`
|
||||
|
||||
- Display version:
|
||||
|
||||
`paclock --version`
|
||||
@@ -16,7 +16,7 @@ source: https://github.com/tldr-pages/tldr.git
|
||||
|
||||
`plasmashell --replace & disown`
|
||||
|
||||
- Display help on command-line options:
|
||||
- Display help:
|
||||
|
||||
`plasmashell {{[-h|--help]}}`
|
||||
|
||||
|
||||
35
tldr/linux/restorecond
Normal file
35
tldr/linux/restorecond
Normal file
@@ -0,0 +1,35 @@
|
||||
---
|
||||
syntax: markdown
|
||||
tags: [tldr, linux]
|
||||
source: https://github.com/tldr-pages/tldr.git
|
||||
---
|
||||
# restorecond
|
||||
|
||||
> Daemon that monitors file creation and automatically restores SELinux contexts.
|
||||
> Useful for directories where files are frequently created with incorrect contexts.
|
||||
> See also: `restorecon`, `semanage-fcontext`.
|
||||
> More information: <https://manned.org/restorecond>.
|
||||
|
||||
- Start the `restorecond` daemon:
|
||||
|
||||
`sudo restorecond`
|
||||
|
||||
- Run `restorecond` in [v]erbose mode to see restoration events:
|
||||
|
||||
`sudo restorecond -v`
|
||||
|
||||
- Run `restorecond` in [d]ebug mode:
|
||||
|
||||
`sudo restorecond -d`
|
||||
|
||||
- Use alternative restorecond.conf file:
|
||||
|
||||
`sudo restorecond -f restorecond_file`
|
||||
|
||||
- Check the status of the restorecond service:
|
||||
|
||||
`sudo systemctl status restorecond`
|
||||
|
||||
- Enable restorecond to start at boot:
|
||||
|
||||
`sudo systemctl enable restorecond --now`
|
||||
27
tldr/linux/run_init
Normal file
27
tldr/linux/run_init
Normal file
@@ -0,0 +1,27 @@
|
||||
---
|
||||
syntax: markdown
|
||||
tags: [tldr, linux]
|
||||
source: https://github.com/tldr-pages/tldr.git
|
||||
---
|
||||
# run_init
|
||||
|
||||
> Run init scripts in the proper SELinux context.
|
||||
> Typically used to run system service scripts with correct SELinux domains.
|
||||
> See also: `runcon`, `semanage`.
|
||||
> More information: <https://manned.org/run_init>.
|
||||
|
||||
- Run a script in the init script context:
|
||||
|
||||
`sudo run_init {{path/to/script}}`
|
||||
|
||||
- Run a script with arguments:
|
||||
|
||||
`sudo run_init {{path/to/script}} {{start|stop|restart}}`
|
||||
|
||||
- Run a script and specify the init script context explicitly:
|
||||
|
||||
`sudo run_init {{[-t|--type]}} {{context_type}} {{path/to/script}}`
|
||||
|
||||
- Display the context that would be used without running the script:
|
||||
|
||||
`sudo run_init {{[-n|--dry-run]}} {{path/to/script}}`
|
||||
27
tldr/linux/sealert
Normal file
27
tldr/linux/sealert
Normal file
@@ -0,0 +1,27 @@
|
||||
---
|
||||
syntax: markdown
|
||||
tags: [tldr, linux]
|
||||
source: https://github.com/tldr-pages/tldr.git
|
||||
---
|
||||
# sealert
|
||||
|
||||
> Analyze and explain SELinux AVC denial messages.
|
||||
> Part of the `setroubleshoot-server` package.
|
||||
> See also: `audit2why`, `ausearch`, `audit2allow`.
|
||||
> More information: <https://manned.org/sealert>.
|
||||
|
||||
- Analyze all recent SELinux denials:
|
||||
|
||||
`sudo sealert {{[-a|--analyze]}} {{/var/log/audit/audit.log}}`
|
||||
|
||||
- Analyze a specific alert ID from system logs:
|
||||
|
||||
`sudo sealert {{[-l|--lookupid]}} {{alert_id}}`
|
||||
|
||||
- Display a summary of recent SELinux alerts:
|
||||
|
||||
`sudo sealert {{[-b|--browser]}}`
|
||||
|
||||
- Monitor audit log in real-time for new alerts:
|
||||
|
||||
`sudo tail {{[-f|--follow]}} {{/var/log/audit/audit.log}} | sealert {{[-l|--lookupid]}} -`
|
||||
30
tldr/linux/semanage-interface
Normal file
30
tldr/linux/semanage-interface
Normal file
@@ -0,0 +1,30 @@
|
||||
---
|
||||
syntax: markdown
|
||||
tags: [tldr, linux]
|
||||
source: https://github.com/tldr-pages/tldr.git
|
||||
---
|
||||
# semanage interface
|
||||
|
||||
> Manage SELinux network interface type definitions.
|
||||
> See also: `semanage`, `semanage-port`.
|
||||
> More information: <https://manned.org/semanage-interface>.
|
||||
|
||||
- List all interface type definitions:
|
||||
|
||||
`sudo semanage interface {{[-l|--list]}}`
|
||||
|
||||
- Add a network interface type definition:
|
||||
|
||||
`sudo semanage interface {{[-a|--add]}} {{[-t|--type]}} {{type_name}} {{interface_name}}`
|
||||
|
||||
- Delete a network interface type definition:
|
||||
|
||||
`sudo semanage interface {{[-d|--delete]}} {{interface_name}}`
|
||||
|
||||
- Modify a network interface type definition:
|
||||
|
||||
`sudo semanage interface {{[-m|--modify]}} {{[-t|--type]}} {{type_name}} {{interface_name}}`
|
||||
|
||||
- List interface type definitions in a customized format:
|
||||
|
||||
`sudo semanage interface {{[-l|--list]}} {{[-C|--locallist]}}`
|
||||
31
tldr/linux/setfiles
Normal file
31
tldr/linux/setfiles
Normal file
@@ -0,0 +1,31 @@
|
||||
---
|
||||
syntax: markdown
|
||||
tags: [tldr, linux]
|
||||
source: https://github.com/tldr-pages/tldr.git
|
||||
---
|
||||
# setfiles
|
||||
|
||||
> Set SELinux file security contexts based on policy rules.
|
||||
> Similar to `restorecon` but reads contexts from a file_contexts file.
|
||||
> See also: `restorecon`, `semanage-fcontext`, `fixfiles`.
|
||||
> More information: <https://manned.org/setfiles>.
|
||||
|
||||
- Set file contexts according to the default policy file:
|
||||
|
||||
`sudo setfiles /etc/selinux/targeted/contexts/files/file_contexts {{path/to/directory}}`
|
||||
|
||||
- Set file contexts recursively and show changes:
|
||||
|
||||
`sudo setfiles /etc/selinux/targeted/contexts/files/file_contexts {{path/to/directory}} {{[-v|--verbose]}}`
|
||||
|
||||
- Preview what would be changed without actually modifying contexts:
|
||||
|
||||
`sudo setfiles /etc/selinux/targeted/contexts/files/file_contexts {{path/to/directory}} {{[-n|--nochange]}}`
|
||||
|
||||
- Set file contexts and verify them:
|
||||
|
||||
`sudo setfiles /etc/selinux/targeted/contexts/files/file_contexts {{path/to/directory}} {{[-v|--verbose]}} {{[-F|--force]}}`
|
||||
|
||||
- Use a specific root path for context matching:
|
||||
|
||||
`sudo setfiles /etc/selinux/targeted/contexts/files/file_contexts {{path/to/new_directory}} {{[-r|--rootpath]}} {{path/to/old_directory}}`
|
||||
@@ -18,4 +18,4 @@ source: https://github.com/tldr-pages/tldr.git
|
||||
|
||||
- Add a user-level `Requires` dependency:
|
||||
|
||||
`systemctl --user add-requires {{target}} {{unit}}`
|
||||
`systemctl add-requires {{target}} {{unit}} --user`
|
||||
|
||||
@@ -18,4 +18,4 @@ source: https://github.com/tldr-pages/tldr.git
|
||||
|
||||
- Add a user-level `Wants` dependency:
|
||||
|
||||
`systemctl --user add-wants {{target}} {{unit}}`
|
||||
`systemctl add-wants {{target}} {{unit}} --user`
|
||||
|
||||
@@ -18,8 +18,8 @@ source: https://github.com/tldr-pages/tldr.git
|
||||
|
||||
- Bind-mount a path as read-only inside the unit:
|
||||
|
||||
`systemctl bind --read-only {{unit}} /{{path/to/host_directory}}`
|
||||
`systemctl bind {{unit}} /{{path/to/host_directory}} --read-only`
|
||||
|
||||
- Create the destination path inside the unit before binding:
|
||||
|
||||
`systemctl bind --mkdir {{unit}} /{{path/to/host_directory}} /{{path/to/unit_directory}}`
|
||||
`systemctl bind {{unit}} /{{path/to/host_directory}} /{{path/to/unit_directory}} --mkdir`
|
||||
|
||||
@@ -22,4 +22,4 @@ source: https://github.com/tldr-pages/tldr.git
|
||||
|
||||
- Cancel a job in the user service manager:
|
||||
|
||||
`systemctl cancel --user {{job_id}}`
|
||||
`systemctl cancel {{job_id}} --user`
|
||||
|
||||
@@ -22,4 +22,4 @@ source: https://github.com/tldr-pages/tldr.git
|
||||
|
||||
- Show the contents of a user unit file:
|
||||
|
||||
`systemctl cat --user {{unit}}`
|
||||
`systemctl cat {{unit}} --user`
|
||||
|
||||
@@ -14,8 +14,8 @@ source: https://github.com/tldr-pages/tldr.git
|
||||
|
||||
- Stop a service from running on boot and stop its current execution:
|
||||
|
||||
`systemctl disable --now {{unit}}`
|
||||
`systemctl disable {{unit}} --now`
|
||||
|
||||
- Stop a user service from running on login:
|
||||
|
||||
`systemctl disable --user {{unit}}`
|
||||
`systemctl disable {{unit}} --user`
|
||||
|
||||
@@ -14,12 +14,12 @@ source: https://github.com/tldr-pages/tldr.git
|
||||
|
||||
- Edit an unit file:
|
||||
|
||||
`sudo systemctl edit {{[-l|--full]}} {{unit_file}}`
|
||||
`sudo systemctl edit {{unit_file}} {{[-l|--full]}}`
|
||||
|
||||
- Create a new unit file:
|
||||
|
||||
`sudo systemctl edit {{[-lf|--full --force]}} {{unit_file}}`
|
||||
`sudo systemctl edit {{unit_file}} {{[-lf|--full --force]}}`
|
||||
|
||||
- Overlay a user unit file:
|
||||
|
||||
`systemctl edit --user {{unit_file}}`
|
||||
`systemctl edit {{unit_file}} --user`
|
||||
|
||||
@@ -14,8 +14,8 @@ source: https://github.com/tldr-pages/tldr.git
|
||||
|
||||
- Enable a service to run on boot and start it now:
|
||||
|
||||
`systemctl enable --now {{unit}}`
|
||||
`systemctl enable {{unit}} --now`
|
||||
|
||||
- Enable a user unit to run on login:
|
||||
|
||||
`systemctl enable --user {{unit}}`
|
||||
`systemctl enable {{unit}} --user`
|
||||
|
||||
@@ -10,11 +10,11 @@ source: https://github.com/tldr-pages/tldr.git
|
||||
|
||||
- Exit the user service manager:
|
||||
|
||||
`systemctl --user exit`
|
||||
`systemctl exit --user`
|
||||
|
||||
- Exit the user service manager with a specific exit code:
|
||||
|
||||
`systemctl --user exit {{code}}`
|
||||
`systemctl exit {{code}} --user`
|
||||
|
||||
- Ask the container’s service manager to exit (equivalent of `systemctl poweroff` if not in a container):
|
||||
|
||||
|
||||
13
tldr/linux/systemctl-get-default
Normal file
13
tldr/linux/systemctl-get-default
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
syntax: markdown
|
||||
tags: [tldr, linux]
|
||||
source: https://github.com/tldr-pages/tldr.git
|
||||
---
|
||||
# systemctl get-default
|
||||
|
||||
> Display the default target (runlevel) that the system will boot into.
|
||||
> More information: <https://www.freedesktop.org/software/systemd/man/latest/systemctl.html#get-default>.
|
||||
|
||||
- Check the default target on your system:
|
||||
|
||||
`systemctl get-default`
|
||||
@@ -18,8 +18,8 @@ source: https://github.com/tldr-pages/tldr.git
|
||||
|
||||
- Check whether a unit is active without printing the state to `stdout`:
|
||||
|
||||
`systemctl is-active {{[-q|--quiet]}} {{unit}}`
|
||||
`systemctl is-active {{unit}} {{[-q|--quiet]}}`
|
||||
|
||||
- Check whether a user unit is active:
|
||||
|
||||
`systemctl is-active --user {{unit}}`
|
||||
`systemctl is-active {{unit}} --user`
|
||||
|
||||
17
tldr/linux/systemctl-list-jobs
Normal file
17
tldr/linux/systemctl-list-jobs
Normal file
@@ -0,0 +1,17 @@
|
||||
---
|
||||
syntax: markdown
|
||||
tags: [tldr, linux]
|
||||
source: https://github.com/tldr-pages/tldr.git
|
||||
---
|
||||
# systemctl list-jobs
|
||||
|
||||
> List of active systemd jobs that are currently queued or running on the system.
|
||||
> More information: <https://www.freedesktop.org/software/systemd/man/latest/systemctl.html#list-jobs%20PATTERN…>.
|
||||
|
||||
- List all active jobs:
|
||||
|
||||
`systemctl list-jobs`
|
||||
|
||||
- Filter jobs for a specific unit:
|
||||
|
||||
`systemctl list-jobs {{unit}}`
|
||||
@@ -14,8 +14,8 @@ source: https://github.com/tldr-pages/tldr.git
|
||||
|
||||
- Ensure that the service is shut down while masking:
|
||||
|
||||
`systemctl mask --now {{service_name}}`
|
||||
`systemctl mask {{service_name}} --now`
|
||||
|
||||
- Mask a user service:
|
||||
|
||||
`sysemctl mask --user {{service_name}}`
|
||||
`systemctl mask {{service_name}} --user`
|
||||
|
||||
@@ -19,4 +19,4 @@ source: https://github.com/tldr-pages/tldr.git
|
||||
|
||||
- Reload a service for the current user:
|
||||
|
||||
`systemctl --user reload {{pipewire}}`
|
||||
`systemctl reload {{pipewire}} --user`
|
||||
|
||||
@@ -19,4 +19,4 @@ source: https://github.com/tldr-pages/tldr.git
|
||||
|
||||
- Restart a user unit:
|
||||
|
||||
`systemctl restart --user {{unit}}`
|
||||
`systemctl restart {{unit}} --user`
|
||||
|
||||
@@ -18,4 +18,4 @@ source: https://github.com/tldr-pages/tldr.git
|
||||
|
||||
- Set an environment variable for the user service manager:
|
||||
|
||||
`systemctl --user set-environment {{var value}}`
|
||||
`systemctl set-environment {{var value}} --user`
|
||||
|
||||
@@ -22,7 +22,7 @@ source: https://github.com/tldr-pages/tldr.git
|
||||
|
||||
- Show properties of a specific user unit:
|
||||
|
||||
`systemctl show --user {{unit}}`
|
||||
`systemctl show {{unit}} --user`
|
||||
|
||||
- Include empty properties in the list:
|
||||
|
||||
@@ -30,4 +30,4 @@ source: https://github.com/tldr-pages/tldr.git
|
||||
|
||||
- Only show the specified properties:
|
||||
|
||||
`systemctl show {{[-p|--property]}} {{Wants,Conflicts,...}} {{unit}}`
|
||||
`systemctl show {{unit}} {{[-p|--property]}} {{Wants,Conflicts,...}}`
|
||||
|
||||
@@ -14,4 +14,4 @@ source: https://github.com/tldr-pages/tldr.git
|
||||
|
||||
- Start a user unit:
|
||||
|
||||
`systemctl start --user {{unit}}`
|
||||
`systemctl start {{unit}} --user`
|
||||
|
||||
@@ -34,4 +34,4 @@ source: https://github.com/tldr-pages/tldr.git
|
||||
|
||||
- Show the status of a user unit:
|
||||
|
||||
`systemctl status --user {{unit}}`
|
||||
`systemctl status {{unit}} --user`
|
||||
|
||||
@@ -14,8 +14,8 @@ source: https://github.com/tldr-pages/tldr.git
|
||||
|
||||
- Stop a service and suppress warnings:
|
||||
|
||||
`systemctl stop --no-warn {{unit}}`
|
||||
`systemctl stop {{unit}} --no-warn`
|
||||
|
||||
- Stop a user unit:
|
||||
|
||||
`systemctl stop --user {{unit}}`
|
||||
`systemctl stop {{unit}} --user`
|
||||
|
||||
@@ -18,4 +18,4 @@ source: https://github.com/tldr-pages/tldr.git
|
||||
|
||||
- Switch to a new root filesystem with verbose output:
|
||||
|
||||
`systemctl --verbose switch-root {{path/to/new_root}}`
|
||||
`systemctl switch-root {{path/to/new_root}} --verbose`
|
||||
|
||||
@@ -15,8 +15,8 @@ source: https://github.com/tldr-pages/tldr.git
|
||||
|
||||
- Unmask and start a service immediately:
|
||||
|
||||
`systemctl unmask --now {{service_name}}`
|
||||
`systemctl unmask {{service_name}} --now`
|
||||
|
||||
- Unmask a user service:
|
||||
|
||||
`systemctl unmask --user {{service_name}}`
|
||||
`systemctl unmask {{service_name}} --user`
|
||||
|
||||
@@ -19,4 +19,4 @@ source: https://github.com/tldr-pages/tldr.git
|
||||
|
||||
- Unset an environment variable in the user service manager:
|
||||
|
||||
`systemctl --user unset-environment {{var}}`
|
||||
`systemctl unset-environment {{var}} --user`
|
||||
|
||||
@@ -15,7 +15,7 @@ source: https://github.com/tldr-pages/tldr.git
|
||||
|
||||
- Show the unit of the current shell in user service manager (services managed for your login session):
|
||||
|
||||
`systemctl --user whoami`
|
||||
`systemctl whoami --user`
|
||||
|
||||
- Show the unit a specific process belongs to:
|
||||
|
||||
|
||||
@@ -24,6 +24,6 @@ source: https://github.com/tldr-pages/tldr.git
|
||||
|
||||
`vgremove --config '{{global/locking_type=1}}' {{volume_group}}`
|
||||
|
||||
- Display help text for usage information:
|
||||
- Display help:
|
||||
|
||||
`vgremove {{[-h|--help]}}`
|
||||
|
||||
Reference in New Issue
Block a user