Update notes on command-line utilities

This commit is contained in:
Gabriel Arazas 2023-02-08 13:46:22 +08:00
parent c8bac90384
commit a54cd9e60d
3 changed files with 28 additions and 6 deletions

View File

@ -3,10 +3,10 @@
:END: :END:
#+title: Command line: BorgBackup #+title: Command line: BorgBackup
#+date: "2021-05-30 21:40:24 +08:00" #+date: "2021-05-30 21:40:24 +08:00"
#+date_modified: "2021-07-13 22:54:32 +08:00" #+date_modified: "2022-11-23 17:52:38 +08:00"
#+language: en #+language: en
#+property: header_args :eval no #+property: header_args :eval no
#+property: header_args:bash :results silent :exports code #+property: header_args:bash :results silent :exports code :shebang "#!/usr/bin/env bash"
BorgBackup is a deduplicating archiver with compression and encryption. BorgBackup is a deduplicating archiver with compression and encryption.
@ -126,7 +126,7 @@ borg extract --verbose --progress ${REPO_PATH}::{hostname}-{now:%F-%T-%z} ~/Docu
Better be safe than sorry. Better be safe than sorry.
Here's the safe backup in all of its glory in Bash. Here's the safe backup in all of its glory in Bash.
#+begin_src bash :tangle (my/concat-assets-folder "safe-borg-backup") :shebang "#/usr/bin/env bash" #+begin_src bash :tangle (my/concat-assets-folder "safe-borg-backup")
if $# -eq 1; then echo "No directories and files to be saved." && exit 1; fi if $# -eq 1; then echo "No directories and files to be saved." && exit 1; fi
locations=$@ locations=$@
@ -149,7 +149,7 @@ BORG_REPO="$HOME/backups" BORG_PASSCOMMAND='gopass show misc/personal-borgbackup
All-time favorite fzf (see [[id:4eb1f8b1-bc12-4a6c-8fa4-20e4c3542cf2][Command line: fzf]]) is required. All-time favorite fzf (see [[id:4eb1f8b1-bc12-4a6c-8fa4-20e4c3542cf2][Command line: fzf]]) is required.
#+begin_src bash #+begin_src bash :tangle (my/concat-assets-folder "fzf-interactive-extract")
export BORG_PASSPHRASE="oral hygiene" export BORG_PASSPHRASE="oral hygiene"
export BORG_REPO="${REPO_PATH}" export BORG_REPO="${REPO_PATH}"

View File

@ -89,7 +89,7 @@ podman push foodogsquared/python-helloworld
What would be an example script without something like [[id:4eb1f8b1-bc12-4a6c-8fa4-20e4c3542cf2][fzf]]? What would be an example script without something like [[id:4eb1f8b1-bc12-4a6c-8fa4-20e4c3542cf2][fzf]]?
#+begin_src bash #+begin_src bash :tangle (my/concat-assets-folder "fzf-podman-image-rm")
podman image list --format "{{.ID}} {{.Repository}} {{.Tag}}" \ podman image list --format "{{.ID}} {{.Repository}} {{.Tag}}" \
| fzf --multi --prompt "Choose images to remove > " \ | fzf --multi --prompt "Choose images to remove > " \
| awk '{print $1}' \ | awk '{print $1}' \

View File

@ -3,7 +3,7 @@
:END: :END:
#+title: Command line: systemctl #+title: Command line: systemctl
#+date: 2021-07-27 13:47:34 +08:00 #+date: 2021-07-27 13:47:34 +08:00
#+date_modified: 2021-07-27 14:06:35 +08:00 #+date_modified: 2022-12-06 18:25:19 +08:00
#+language: en #+language: en
#+property: header_args :eval no #+property: header_args :eval no
@ -32,11 +32,31 @@ systemctl [OPTIONS...] COMMAND [COMMAND_ARGS...] [COMMAND_OPTIONS...]
- =--help= is an obvious one. - =--help= is an obvious one.
It prints a detailed help section of the command. It prints a detailed help section of the command.
- =--host= controls a remote system.
Meaning, you can manage services and timers remotely.
Will not work on certain subcommands such as =edit=.
- =--container= is similar to =--host= but operates on a local container.
- =--with-dependencies= will show the output of the unit specified along with its dependencies.
This is only effective on certain subcommands such as =status=, =list-units=, =cat=, and =list-unit-files=.
- =-p PROPERTIES= shows only the listed properties.
Very useful for filtering the properties for =systemctl show= subcommand.
Take note =PROPERTIES= can be a list of properties to show delimited with a comma.
- =-P PROPERTIES= shows the value of the listed properies.
Similar to =-p=, =PROPERTIES= can be a comma-delimited list of properties to be shown.
* Subcommands * Subcommands
- =show PATTERN= shows the properties of the matched units.
It can also show with multiple units with a helpful label and proper formatting (which is very nice).
This is the go-to subcommand for debugging a service.
- =enable UNIT= and =disable UNIT= enables and disables units. - =enable UNIT= and =disable UNIT= enables and disables units.
It mainly adds the unit activation at startup. It mainly adds the unit activation at startup.
@ -59,3 +79,5 @@ systemctl [OPTIONS...] COMMAND [COMMAND_ARGS...] [COMMAND_OPTIONS...]
- =list-units [PATTERN...]= is self-explanatory ;p. - =list-units [PATTERN...]= is self-explanatory ;p.
- =is-active PATTERN...= prints the status of the matched unit and exits successfully if it's active. - =is-active PATTERN...= prints the status of the matched unit and exits successfully if it's active.
- =cat PATTERN...= shows contents of the given units in a neat formatted page.