chore(kb): review and add articles for commands i stored somewhere else

This commit is contained in:
Michele Cereda
2025-08-30 14:50:12 +02:00
parent cdb5a8115f
commit 6fc69382aa
4 changed files with 200 additions and 8 deletions

View File

@@ -0,0 +1,74 @@
# nslookup
> TODO
Intro
<!-- Remove this line to uncomment if used
## Table of contents <!-- omit in toc -->
1. [TL;DR](#tldr)
1. [Further readings](#further-readings)
1. [Sources](#sources)
## TL;DR
<!-- Uncomment if used
<details>
<summary>Setup</summary>
```sh
```
</details>
-->
<details>
<summary>Usage</summary>
```sh
# Resolve using the default name server
nslookup 'www.google.com'
# Resolve using specific name servers
nslookup 'grafana.dev.ecs.internal' '172.31.0.2'
nslookup '172.16.43.212' '172.31.0.2'
```
</details>
<!-- Uncomment if used
<details>
<summary>Real world use cases</summary>
```sh
```
</details>
-->
## Further readings
- [Website]
- [Codebase]
### Sources
- [Documentation]
- [nslookup Cheat Sheet]
<!--
Reference
═╬═Time══
-->
<!-- In-article sections -->
<!-- Knowledge base -->
<!-- Files -->
<!-- Upstream -->
[Codebase]: https://github.com/project/
[Documentation]: https://website/docs/
[Website]: https://website/
<!-- Others -->
[nslookup Cheat Sheet]: https://www.commandinline.com/cheat-sheet/nslookup/

View File

@@ -1,14 +1,14 @@
# Pkexec
Allows an _authorized_ user to execute a command as another user. If a username is not specified, the command will be executed as `root`.
## Table of contents <!-- omit in toc -->
Allows _authorized_ users to execute commands as another user, similarly to [`sudo`][sudo].
1. [TL;DR](#tldr)
1. [Further readings](#further-readings)
## TL;DR
If one does **not** specify a username, the command will be executed as `root`.
```sh
pkexec systemctl hibernate
```
@@ -16,10 +16,18 @@ pkexec systemctl hibernate
## Further readings
- [Man page]
- [`sudo`][sudo]
<!--
References
Reference
═╬═Time══
-->
<!-- In-article sections -->
<!-- Knowledge base -->
[sudo]: sudo.md
<!-- Files -->
<!-- Upstream -->
<!-- Others -->
[man page]: https://linux.die.net/man/1/pkexec

96
knowledge base/pkill.md Normal file
View File

@@ -0,0 +1,96 @@
# pkill
> TODO
Command-line tools that sends signals to the processes of a running program based on given criteria.
1. [TL;DR](#tldr)
1. [Further readings](#further-readings)
1. [Sources](#sources)
## TL;DR
Basically a wrapper around `pgrep` and `kill`.
Part of the `procps` (or `procps-ng`) package, which is pre-installed on nearly all Linux distributions.
The processes can be specified by:
- Their **full** or **partial** name.
- A user running the process.
- Other attributes.
Returns 0 when at least one running process matched the requested pattern. Otherwise, its exit code is `1`.
<details>
<summary>Setup</summary>
```sh
apt install 'procps'
brew install 'proctools' # or brew install 'pkill'
dnf install 'procps-ng'
yum install 'procps-ng'
```
</details>
<details>
<summary>Usage</summary>
```sh
# Gracefully stop all processes of programs matching the given pattern
pkill 'pattern'
pkill -15 'pattern'
pkill -TERM 'pattern'
pkill -SIGTERM 'pattern'
pkill --signal 'TERM' 'pattern'
# Display what processes are sent signals
pkill -e …
pkill --echo …
# Only kill processes of specific users' *real* id
pkill -u 'mark'
pkill --uid 'mark,john'
```
</details>
<details>
<summary>Real world use cases</summary>
```sh
pkill -HUP 'nginx'
pkill --signal 'TERM' --exact 'yes'
pkill '^ssh$'
pkill -9 -f "ping 8.8.8.8"
pkill -KILL -u 'mike' 'gdm'
```
</details>
## Further readings
- [Website]
- [Codebase]
### Sources
- [Documentation]
- [Pkill Command in Linux]
<!--
Reference
═╬═Time══
-->
<!-- In-article sections -->
<!-- Knowledge base -->
<!-- Files -->
<!-- Upstream -->
[Codebase]: https://github.com/project/
[Documentation]: https://website/docs/
[Website]: https://website/
<!-- Others -->
[Pkill Command in Linux]: https://linuxize.com/post/pkill-command-in-linux/

View File

@@ -7,7 +7,8 @@
1. [Execute commands as a specific user](#execute-commands-as-a-specific-user)
1. [Troubleshooting](#troubleshooting)
1. [I modified a sudoers file manually, messed it up, and now I cannot use sudo anymore](#i-modified-a-sudoers-file-manually-messed-it-up-and-now-i-cannot-use-sudo-anymore)
1. [Sources](#sources)
1. [Further readings](#further-readings)
1. [Sources](#sources)
## TL;DR
@@ -25,7 +26,8 @@ Defaults:
Sudoers files use the Extended Backus-Naur Form (EBNF) grammar.
Files in included directories are loaded in sorted lexical order.<br/>
Files which name ends in `~` or contains `.` are skipped to avoid causing problems with package manager or temporary or backup files.
Files which name ends in `~` or contains `.` are skipped to avoid causing problems with package manager or temporary or
backup files.
When multiple entries match for the same user, they are applied in order.<br/>
Where there are multiple matches, the last match is used (which is not necessarily the most specific one).
@@ -99,7 +101,11 @@ try using another access method like `PolicyKit` and fix the file up:
pkexec visudo -f '/etc/sudoers.d/michael'
```
## Sources
## Further readings
- [`pkexec`][pkexec]
### Sources
- [How to modify an invalid sudoers file]
- [sudo as another user with their environment]
@@ -107,9 +113,17 @@ pkexec visudo -f '/etc/sudoers.d/michael'
- [Linux fundamentals: A to Z of a sudoers file]
<!--
References
Reference
═╬═Time══
-->
<!-- In-article sections -->
<!-- Knowledge base -->
[pkexec]: pkexec.md
<!-- Files -->
<!-- Upstream -->
<!-- Others -->
<!-- Others -->
[how to modify an invalid sudoers file]: https://askubuntu.com/questions/73864/how-to-modify-an-invalid-etc-sudoers-file
[linux fundamentals: a to z of a sudoers file]: https://medium.com/kernel-space/linux-fundamentals-a-to-z-of-a-sudoers-file-a5da99a30e7f