Are you like me and forget all the awesome things you learn about FreeBSD? My solution is to write this post and collect those commands and tricks in a single place.
Linux and FreeBSD have /etc/os-release but only FreeBSD has the useful
freebsd-version. I use it as
freebsd-version -kru which shows, in order,
the installed kernel version, running kernel version, and installed userland
When you are ready to apply updates, you must use
freebsd-update. I run it in
# freebsd-update fetch # freebsd-update updatesready # freebsd-update install
Apparently by running
yes | freebsd-update it can be turned into an unattended update process.
When upgrading to new major version, e.g. from 12 to 13, use the
flag/switch. More details Updating and Upgrading FreeBSD.
sysrc command safely edits rc files. I use it extensively in the
Ansible roles I write.
Want to know if any of your packages are vulnerable? Run
pkg audit -F as root
-F flag/switch always fetches the latest vulnerabilities data.
List all installed packages and their versions with
pkg version. Add the
flag/switch for verbose output.