From a54cd9e60d9427cbd108ee3bc1c4e0cbd25f6e09 Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Wed, 8 Feb 2023 13:46:22 +0800 Subject: [PATCH] Update notes on command-line utilities --- notebook/cli.borg.org | 8 ++++---- notebook/cli.podman.org | 2 +- notebook/cli.systemctl.org | 24 +++++++++++++++++++++++- 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/notebook/cli.borg.org b/notebook/cli.borg.org index e8c4a0f..4d5cbbe 100644 --- a/notebook/cli.borg.org +++ b/notebook/cli.borg.org @@ -3,10 +3,10 @@ :END: #+title: Command line: BorgBackup #+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 #+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. @@ -126,7 +126,7 @@ borg extract --verbose --progress ${REPO_PATH}::{hostname}-{now:%F-%T-%z} ~/Docu Better be safe than sorry. 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 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. -#+begin_src bash +#+begin_src bash :tangle (my/concat-assets-folder "fzf-interactive-extract") export BORG_PASSPHRASE="oral hygiene" export BORG_REPO="${REPO_PATH}" diff --git a/notebook/cli.podman.org b/notebook/cli.podman.org index 6da7ffe..3d3e4b4 100644 --- a/notebook/cli.podman.org +++ b/notebook/cli.podman.org @@ -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]]? -#+begin_src bash +#+begin_src bash :tangle (my/concat-assets-folder "fzf-podman-image-rm") podman image list --format "{{.ID}} {{.Repository}} {{.Tag}}" \ | fzf --multi --prompt "Choose images to remove > " \ | awk '{print $1}' \ diff --git a/notebook/cli.systemctl.org b/notebook/cli.systemctl.org index 4ace79a..785f048 100644 --- a/notebook/cli.systemctl.org +++ b/notebook/cli.systemctl.org @@ -3,7 +3,7 @@ :END: #+title: Command line: systemctl #+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 #+property: header_args :eval no @@ -32,11 +32,31 @@ systemctl [OPTIONS...] COMMAND [COMMAND_ARGS...] [COMMAND_OPTIONS...] - =--help= is an obvious one. 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 +- =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. 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. - =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.