Update cheatsheets

This commit is contained in:
ivuorinen
2025-10-08 00:19:16 +00:00
parent 4102fec4f8
commit 52f5647220
45 changed files with 1002 additions and 38 deletions

39
tldr/linux/ausearch Normal file
View File

@@ -0,0 +1,39 @@
---
syntax: markdown
tags: [tldr, linux]
source: https://github.com/tldr-pages/tldr.git
---
# ausearch
> Query the Linux audit log for events.
> Part of the `audit` package.
> See also: `audit2why`, `audit2allow`, `aureport`.
> More information: <https://manned.org/ausearch>.
- Search for all SELinux AVC denial events:
`sudo ausearch {{[-m|--message]}} avc`
- Search for events related to a specific executable:
`sudo ausearch {{[-c|--comm]}} {{httpd}}`
- Search for events from a specific user:
`sudo ausearch {{[-ui|--uid]}} {{1000}}`
- Search for events in the last 10 minutes:
`sudo ausearch {{[-ts|--start]}} recent`
- Search for failed login attempts:
`sudo ausearch {{[-m|--message]}} user_login {{[-sv|--success]}} no`
- Search for events related to a specific file:
`sudo ausearch {{[-f|--file]}} {{path/to/file}}`
- Display results in raw format for further processing:
`sudo ausearch {{[-m|--message]}} avc --raw`

41
tldr/linux/grub-mkrescue Normal file
View File

@@ -0,0 +1,41 @@
---
syntax: markdown
tags: [tldr, linux]
source: https://github.com/tldr-pages/tldr.git
---
# grub-mkrescue
> Make a GRUB CD/USB/floppy bootable image.
> More information: <https://www.gnu.org/software/grub/manual/grub/grub.html#Invoking-grub_002dmkrescue>.
- Create a bootable ISO from the current directory and save it as `grub.iso`:
`grub-mkrescue --output {{grub.iso}} .`
- Create an ISO using GRUB files from a custom directory:
`grub-mkrescue --directory {{/usr/lib/grub/i386-pc}} --output {{grub.iso}} {{path/to/source}}`
- Use compression for GRUB files when building the image, setting `no` disables compression:
`grub-mkrescue --compress {{no|xz|gz|lzo}} --output {{grub.iso}} {{path/to/source}}`
- Disable the GRUB command-line interface in the generated image:
`grub-mkrescue --disable-cli --output {{grub.iso}} {{path/to/source}}`
- Preload specific GRUB modules into the image:
`grub-mkrescue --modules "{{part_gpt iso9660}}" --output {{grub.iso}} {{path/to/source}}`
- Pass additional options directly to `xorriso`:
`grub-mkrescue --output {{grub.iso}} -- {{-volid}} {{volume_name}} {{path/to/source}}`
- Display help:
`grub-mkrescue {{[-?|--help]}}`
- Display version:
`grub-mkrescue --version`

21
tldr/linux/ip-monitor Normal file
View File

@@ -0,0 +1,21 @@
---
syntax: markdown
tags: [tldr, linux]
source: https://github.com/tldr-pages/tldr.git
---
# ip monitor
> Monitor network for state changes.
> More information: <https://manned.org/ip-monitor>.
- Monitor the whole network for state changes:
`ip {{[mo|monitor]}}`
- Specify the type to monitor:
`ip {{[mo|monitor]}} {{link|address|route|neigh|rule|maddress|...}}`
- Replay an event file (can be generated with `rtmon`):
`ip {{[mo|monitor]}} {{[f|file]}} {{path/to/file}}`

33
tldr/linux/mhwd Normal file
View File

@@ -0,0 +1,33 @@
---
syntax: markdown
tags: [tldr, linux]
source: https://github.com/tldr-pages/tldr.git
---
# mhwd
> Manjaro Hardware Detection utility .
> More information: <https://wiki.manjaro.org/index.php/Manjaro_Hardware_Detection_Overview>.
- List available drivers:
`mhwd {{[-l|--list]}}`
- List installed drivers:
`mhwd {{[-li|--listinstalled]}}`
- Install a driver:
`mhwd {{[-i|--install]}} {{pci|usb}} {{driver_name}}`
- Remove a driver:
`mhwd {{[-r|--remove]}} {{pci|usb}} {{driver_name}}`
- Display detailed information about detected hardware:
`mhwd {{[-l|--list]}} {{[-d|--detail]}}`
- Automatically install best available driver for the detected graphics card:
`mhwd {{[-a|--auto]}} pci {{free|nonfree}} 0300`

37
tldr/linux/paclog Normal file
View File

@@ -0,0 +1,37 @@
---
syntax: markdown
tags: [tldr, linux]
source: https://github.com/tldr-pages/tldr.git
---
# paclog
> Filter pacman log entries.
> More information: <https://github.com/andrewgregory/pacutils/blob/master/doc/paclog.pod>.
- Display the entire pacman log:
`paclog`
- Display pacman-style logged commandline entries:
`paclog --commandline`
- Display only errors, warnings, and notes:
`paclog --warnings`
- Display package name and action type:
`paclog --package {{package_name}} --action {{install|upgrade|remove|...}}`
- Display the list of installed packages according to the log:
`paclog --pkglist`
- Display help:
`paclog --help`
- Display version:
`paclog --version`

33
tldr/linux/pacrepairdb Normal file
View File

@@ -0,0 +1,33 @@
---
syntax: markdown
tags: [tldr, linux]
source: https://github.com/tldr-pages/tldr.git
---
# pacrepairdb
> Fix corrupted database entries in libalpm database.
> More information: <https://github.com/andrewgregory/pacutils/blob/master/doc/pacrepairdb.pod>.
- Perform a basic repair on a specific package:
`pacrepairdb {{package_name}}`
- Update the database entries without extracting or removing any packages:
`pacrepairdb {{package_name}} --dbonly`
- Display the packages to be repaired and the cache packages to be used without making any changes:
`pacrepairdb {{package_name}} --print-only`
- Display additional progress and debug information:
`pacrepairdb {{package_name}} --verbose`
- Display help:
`pacrepairdb --help`
- Display version:
`pacrepairdb --version`

17
tldr/linux/rtmon Normal file
View File

@@ -0,0 +1,17 @@
---
syntax: markdown
tags: [tldr, linux]
source: https://github.com/tldr-pages/tldr.git
---
# rtmon
> Save network state changes to a file.
> More information: <https://manned.org/rtmon>.
- Save all network state changes to a file:
`sudo rtmon {{[f|file]}} {{path/to/file}}`
- Specify the type of change to log:
`sudo rtmon {{[f|file}} {{link|address|route}}`

23
tldr/linux/selinuxenabled Normal file
View File

@@ -0,0 +1,23 @@
---
syntax: markdown
tags: [tldr, linux]
source: https://github.com/tldr-pages/tldr.git
---
# selinuxenabled
> Check whether SELinux is enabled.
> Returns exit code 0 if SELinux is enabled, and 1 if it is not.
> See also: `getenforce`, `setenforce`, `sestatus`.
> More information: <https://manned.org/selinuxenabled>.
- Check if SELinux is enabled (no output; check exit code with `echo $?`):
`selinuxenabled`
- Check if SELinux is enabled and print the result:
`selinuxenabled && echo "SELinux is enabled" || echo "SELinux is disabled"`
- Use in a shell script to conditionally execute commands:
`if selinuxenabled; then echo "SELinux is running"; fi`

38
tldr/linux/semodule Normal file
View File

@@ -0,0 +1,38 @@
---
syntax: markdown
tags: [tldr, linux]
source: https://github.com/tldr-pages/tldr.git
---
# semodule
> Manage SELinux policy modules.
> See also: `audit2allow`, `semanage`.
> More information: <https://manned.org/semodule>.
- List all installed policy modules:
`sudo semodule {{[-l|--list]}}`
- Install a new policy module:
`sudo semodule {{[-i|--install]}} {{path/to/module.pp}}`
- Remove a policy module:
`sudo semodule {{[-r|--remove]}} {{module_name}}`
- Enable a policy module:
`sudo semodule {{[-e|--enable]}} {{module_name}}`
- Disable a policy module:
`sudo semodule {{[-d|--disable]}} {{module_name}}`
- Reload all policy modules:
`sudo semodule {{[-R|--reload]}}`
- Display the version of installed policy modules:
`sudo semodule {{[-l|--list]}} {{[-v|--verbose]}}`

View File

@@ -0,0 +1,34 @@
---
syntax: markdown
tags: [tldr, linux]
source: https://github.com/tldr-pages/tldr.git
---
# systemctl list-unit-files
> List installed unit files and their enablement states.
> See also: `systemctl list-units` for listing units currently loaded in memory.
> More information: <https://www.freedesktop.org/software/systemd/man/latest/systemctl.html#list-unit-files%20PATTERN%E2%80%A6>.
- List installed unit files and their states:
`systemctl list-unit-files`
- Filter by state:
`systemctl list-unit-files --state {{enabled|disabled|static|...}}`
- Filter by unit type:
`systemctl list-unit-files {{[-t|--type]}} {{service|socket|timer|...}}`
- Filter by a name pattern:
`systemctl list-unit-files '{{sshd*}}'`
- Print output directly to `stdout`:
`systemctl list-unit-files --no-pager`
- Print output without headers or footers:
`systemctl list-unit-files --no-legend`

View File

@@ -0,0 +1,26 @@
---
syntax: markdown
tags: [tldr, linux]
source: https://github.com/tldr-pages/tldr.git
---
# systemctl preset
> Reset the enablement state of unit files to the defaults specified in preset policy files.
> See also: `systemctl preset-all`, `systemctl list-unit-files`.
> More information: <https://www.freedesktop.org/software/systemd/man/latest/systemctl.html#preset%20UNIT%E2%80%A6>.
- Reset the enablement state to preset defaults:
`systemctl preset {{unit1 unit2 ...}}`
- Enable only if marked as enabled in the preset policy:
`systemctl preset {{unit}} --preset-mode enable-only`
- Disable only if marked as disabled in the preset policy:
`systemctl preset {{unit}} --preset-mode disable-only`
- Suppress output and return only the exit code:
`systemctl preset {{unit}} {{[-q|--quiet]}}`