FreeBSD cheatsheet

2019-09-29 Permalink

Generate a secure password:

$ head -c 30 /dev/random | uuencode -mr -

Recover partitions (including exfat):

$ testdisk /dev/disk-or-section

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 -

Set time in current timezone:

# date 2315

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/


Display the post-install message:

$ pkg query %M firefox

List non-automatic packages:

$ pkg query -e '%a = 0' %o


Get list of installed devices:

$ cat /dev/sndstat

Set default device:

$ sysctl hw.snd.default_unit=2

Share on