FreeBSD cheatsheet
2019-09-29 Permalink
Generate a secure password:
$ head -c 27 /dev/random | uuencode -mr -
Create then extract an encrypted backup (split into chunks):
$ tar -cf - input/ | openssl aes-256-cbc -md sha256 -pbkdf2 | split -b 100M -a 4 -d - output/backup.tar. $ cat output/backup.tar.* | openssl aes-256-cbc -md sha256 -pbkdf2 -d | tar -xfv -
To set ISO date format, go to /usr/share/locale/en_US.UTF-8/LC_TIME
(or similar) and change %m/%d/%Y
to %Y-%m-%d
. It's not respected by software that relies on their own date formatting (offender: Qt).
After tweaking the MIME Applications Associations, update the cache through
$ update-desktop-database ~/.local/share/applications/
Operate on a list of numbered files:
$ for i in $(jot "DSC%.5d.JPG" - 4000 5000); do echo $i; done
Recover partitions (including exfat):
$ testdisk /dev/disk-or-section
Packages
Display the post-install
message:
$ pkg query %M firefox
List non-automatic packages:
$ pkg query -e '%a = 0' %o
List dependencies in ports collection:
$ make build-depends-list run-depends-list | cut -c12-
Install packages as automatic (combine with above):
# pkg install -A ...
Audio
Get list of installed devices:
$ cat /dev/sndstat
Set default device:
$ sysctl hw.snd.default_unit=2