From 5fe2d21c93d3e0c68f218f198e2741bb4541b369 Mon Sep 17 00:00:00 2001 From: Michele Cereda Date: Thu, 27 Apr 2023 19:25:16 +0200 Subject: [PATCH] refactor: moved articles to the specific section --- .vscode/settings.json | 1 + .../{mac os x.md => mac os x/README.md} | 20 ++- .../{ => mac os x}/little snitch.md | 0 knowledge base/mac os x/macports.md | 160 ++++++++++++++++++ .../{ => mac os x}/openssl-osx-ca.md | 0 knowledge base/mac os x/time machine.md | 42 +++++ knowledge base/macports.md | 135 --------------- knowledge base/timemachine.md | 17 -- 8 files changed, 220 insertions(+), 155 deletions(-) rename knowledge base/{mac os x.md => mac os x/README.md} (97%) rename knowledge base/{ => mac os x}/little snitch.md (100%) create mode 100644 knowledge base/mac os x/macports.md rename knowledge base/{ => mac os x}/openssl-osx-ca.md (100%) create mode 100644 knowledge base/mac os x/time machine.md delete mode 100644 knowledge base/macports.md delete mode 100644 knowledge base/timemachine.md diff --git a/.vscode/settings.json b/.vscode/settings.json index 6d5077c..fa9e9f1 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -36,6 +36,7 @@ "flatpak", "gcloud", "getfacl", + "gettext", "gopass", "gpgconf", "gpgtools", diff --git a/knowledge base/mac os x.md b/knowledge base/mac os x/README.md similarity index 97% rename from knowledge base/mac os x.md rename to knowledge base/mac os x/README.md index 15128ed..3f85523 100644 --- a/knowledge base/mac os x.md +++ b/knowledge base/mac os x/README.md @@ -1,4 +1,6 @@ -# Mac OS X +# Mac OS X + +## Table of contents 1. [TL;DR](#tldr) 1. [Hidden settings](#hidden-settings) @@ -316,11 +318,17 @@ To use any of these key combinations, press and hold the keys immediately after ## Further readings -- [pam_reattach] -- [launchctl man page] +- [Time Machine] +- [`pam_reattach`][pam_reattach] +- [`launchctl`'s man page][launchctl man page] +- [`macports`][macports] +- [`openssl-osx-ca`][openssl-osx-ca] +- [Little Snitch] ## Sources +All the references in the [further readings] section, plus the following: + - [Boot a Mac from USB Drive] - [Mac startup key combinations] - [Xcode Command Line Tools Installation FAQ] @@ -337,6 +345,12 @@ To use any of these key combinations, press and hold the keys immediately after [mac startup key combinations]: https://support.apple.com/en-us/HT201255 + +[time machine]: time%20machine.md +[macports]: macports.md +[openssl-osx-ca]: openssl-osx-ca.md +[little snitch]: little%20snitch.md + [boot a mac from usb drive]: https://www.wikihow.com/Boot-a-Mac-from-USB-Drive [caffeinate your mac]: https://www.theapplegeek.co.uk/blog/caffeinate diff --git a/knowledge base/little snitch.md b/knowledge base/mac os x/little snitch.md similarity index 100% rename from knowledge base/little snitch.md rename to knowledge base/mac os x/little snitch.md diff --git a/knowledge base/mac os x/macports.md b/knowledge base/mac os x/macports.md new file mode 100644 index 0000000..9f0cba4 --- /dev/null +++ b/knowledge base/mac os x/macports.md @@ -0,0 +1,160 @@ +# Macports + +## Table of contents + +1. [TL;DR](#tldr) +1. [Installation](#installation) +1. [Further readings](#further-readings) +1. [Sources](#sources) + +## TL;DR + +Default ports install location is `/opt/local`. + +```sh +# Get help on commands. +port help 'install' +port help 'select' + +# Search for ports. +port search 'completion' +port search --name 'parallel' + +# Get info on specific ports. +port info 'zsh-completions' + +# Get ports' variants. +port variants 'k9s' + +# Install ports. +sudo port install 'zsh-completions' 'apple-completion' +sudo port install 'nmap' -subversion # uses a variant +sudo port install -d 'gettext' # debug mode + +# List all installed ports. +port installed +port echo installed + +# List all ports that have been explicitly installed by the user. +port echo requested + +# List all available ports. +port list + +# List all versions of specific ports only. +port list 'nmap' + +# list all files installed by ports. +# The port must be already installed for this to work. +port contents 'py38-netaddr' + +# List ports providing a specific file. +# The port must be already installed for this to work. +port provides '/opt/local/bin/envsubst' + +# Remove ports. +sudo port uninstall 'parallel' +sudo port uninstall --follow-dependencies 'fzf' + +# List available choices for groups of packages. +port select --list 'python' + +# Show the current port selection. +port select --summary + +# Set a default version. +# Symlinks the "executable"'s version to 'opt/local/bin/executable'. +sudo port select --set postgresql postgresql12 +sudo port select --set python3 python310 +sudo port select --set virtualenv virtualenv310 + +# Update `macports` itself to the latest version. +# Also syncs the latest ports definitions. +sudo port selfupdate + +# Deactivate active ports. +sudo port deactivate 'stow' + +# Activate inactive ports. +sudo port activate 'stow' + +# List all outdated ports. +port echo outdated + +# Upgrade ports. +sudo port upgrade 'tree' + +# Upgrade all outdated ports. +sudo port upgrade outdated + +# Clean out all temporary assets of ports. +sudo port clean -f --all 'parallel' + +# Clean up leftovers. +sudo port reclaim + +# List all inactive ports. +# Ports are deactivated when a newer version gets installed. +port echo inactive + +# Remove all inactive ports. +sudo port uninstall inactive + +# List ports' dependencies. +port deps 'chezmoi' + +# Recursively list all ports depending on given ports. +port rdeps 'pcre' + +# List the installed ports depending on given ports. +port dependents 'bzip2' + +# Recursively list all the installed ports that depend on given ports. +port rdependents 'libedit' + +# View ports' notes if any are available. +# Notes are displayed right after a port is installed. +# The port must be already installed for this to work. +port notes 'postgres12' + +# Get the location of ports within the ports tree. +port dir 'zlib' + +# Get the location of the tarball of ports. +# The port must be already installed for this to work. +port location 'readline' + +# Get the location of ports' portfiles. +port file 'openssl11' + +# Get the location of the working directory for ports, if it exists. +port work 'popt' +``` + +## Installation + +See the [website] for the installation instructions. + +## Further readings + +- [Website] +- Official user [guide] +- Public [ports] database +- [Mac OS X] + +## Sources + +All the references in the [further readings] section, plus the following: + +- [cheat.sh] + + +[guide]: https://guide.macports.org/ +[ports]: https://ports.macports.org/ +[website]: https://www.macports.org/ + + +[mac os x]: README.md + + +[cheat.sh]: https://cheat.sh/port diff --git a/knowledge base/openssl-osx-ca.md b/knowledge base/mac os x/openssl-osx-ca.md similarity index 100% rename from knowledge base/openssl-osx-ca.md rename to knowledge base/mac os x/openssl-osx-ca.md diff --git a/knowledge base/mac os x/time machine.md b/knowledge base/mac os x/time machine.md new file mode 100644 index 0000000..e145a46 --- /dev/null +++ b/knowledge base/mac os x/time machine.md @@ -0,0 +1,42 @@ +# Time Machine + +## Table of contents + +1. [TL;DR](#tldr) +1. [Follow logs](#follow-logs) +1. [Further readings](#further-readings) +1. [Sources](#sources) + +## TL;DR + +```sh +# Follow logs. +log stream --style 'syslog' \ + --predicate 'senderImagePath contains[cd] "TimeMachine"' \ + --info --debug + +# Add or set a destination. +sudo tmutil setdestination +``` + +## Follow logs + +- Use `stream` to keep watching "tail style". +- Use `--predicate` to filter out only relevant logs. +- Add `--style 'syslog'` to print them out like `syslog` on Linux would. + +## Further readings + +- [Mac OS X] + +## Sources + +All the references in the [further readings] section, plus the following: + + + + +[further readings]: #further-readings +[mac os x]: README.md + + diff --git a/knowledge base/macports.md b/knowledge base/macports.md deleted file mode 100644 index bb7c352..0000000 --- a/knowledge base/macports.md +++ /dev/null @@ -1,135 +0,0 @@ -# Macports - -See the [website] for the installation instructions. - -Default ports install location is `/opt/local`. - -## TL;DR - -```sh -# get help on a command -port help install -port help select - -# search for ports -port search completion -port search --name parallel - -# get info on a specific port -port info zsh-completions - -# get a port's variants -port variants k9s - -# install ports -sudo port install zsh-completions apple-completion -sudo port install nmap -subversion # use a variant -sudo port install -d gettext # debug mode - -# list all installed ports -port installed -port echo installed - -# list all ports that have been explicitly installed by the user -port echo requested - -# list all available ports -port list -port list nmap # limit to all versions of a package - -# list all files installed by a port -# the port must be installed for this to work -port contents py38-netaddr - -# list ports providing a file -# the port must be installed for this to work -port provides /opt/local/bin/envsubst - -# remove a port -sudo port uninstall --follow-dependencies fzf - -# list available choices for a group -port select --list python - -# show the current port selection -port select --summary - -# Set a default version. -# Symlinks the "executable"'s version to 'opt/local/bin/executable'. -sudo port select --set postgresql postgresql12 -sudo port select --set python3 python310 -sudo port select --set virtualenv virtualenv310 - -# update macports itself to the latest version and sync the latest ports definitions -sudo port selfupdate - -# deactivate an active port -sudo port deactivate stow -# activate an inactive port -sudo port activate stow - -# list all outdated ports -port echo outdated - -# upgrade a port -sudo port upgrade tree - -# upgrade all outdated ports -sudo port upgrade outdated - -# clean out all temporary assets of a port -sudo port clean -f --all parallel - -# clean up leftovers -sudo port reclaim - -# list all inactive ports -# ports are deactivated when a newer version gets installed -port echo inactive - -# remove all inactive ports -sudo port uninstall inactive - -# list a port's dependencies -port deps chezmoi - -# recursively list all ports depending on the given port -port rdeps pcre - -# list the installed ports depending on the given port -port dependents bzip2 - -# recursively list all the installed ports that depend on this port -port rdependents libedit - -# view a port's notes if any are available -# notes are displayed right after a port is installed -# the port must be installed for this to work -port notes postgres12 - -# get the path of a port within the ports tree -port dir zlib - -# get the path of the tarball of a port -# the port must be installed for this to work -port location readline - -# get the path to a port's portfile -port file openssl11 - -# get the path of the working directory for a port if it exists -port work popt -``` - -## Further readings - -- [Website] -- Official user [guide] -- Public [ports] database -- [cheat.sh] - -[guide]: https://guide.macports.org/ -[ports]: https://ports.macports.org/ -[website]: https://www.macports.org/ - -[cheat.sh]: https://cheat.sh/port diff --git a/knowledge base/timemachine.md b/knowledge base/timemachine.md deleted file mode 100644 index 24b8292..0000000 --- a/knowledge base/timemachine.md +++ /dev/null @@ -1,17 +0,0 @@ -# TimeMachine - -## TL;DR - -```sh -# follow logs -log stream --style syslog --predicate 'senderImagePath contains[cd] "TimeMachine"' --info --debug - -# add or set a destination -sudo tmutil setdestination -``` - -## Follow logs - -- use `stream` to keep watching "tail style" -- use `--predicate` to filter out relevant logs -- add `--style syslog` to watch them in a syslog style