🗂️ The FreeBSD Corner Cheat Sheet: Every Command in One Place

A reading order, a "what do I want to do?" finder, a Linux-to-FreeBSD map, the file locations, the golden rules, and the cheat sheet of every page in one place

How to use this page

The FreeBSD Corner has nineteen topic pages. Each one ends with a cheat sheet, and each command in them was run for real on the page it belongs to, on FreeBSD 15.0-RELEASE. This page collects them all, plus four things that no single page has: a reading order, a finder that starts from what you want to do, a map from Linux commands, and the golden rules that kept coming back. Every item links to the page with the explanation, the real output and the traps.

If something here is marked "from the documentation", it means the page that owns it says so: we did not run it. Trust the page, not this summary, for details.

A reading order

Pick the path that matches your job. Each is a list of pages in a sensible order.

If you know Linux and are new to FreeBSD:

  1. FreeBSD vs Linux: what is different, and the map of where things are.
  2. Upgrading: patch it, undo it, and learn boot environments.
  3. ZFS in practice: pools, datasets, snapshots, and repair.
  4. Jails: your first isolated service.
  5. Hardening: what to switch off and lock down.

If you are building a server that hosts services:

  1. Jails and Containers: fence the services in.
  2. pf or ipfw: choose a firewall and learn its order of rules.
  3. Ports and poudriere: your own software, built the clean way.
  4. Hardening, Boot and tuning and Monitoring: lock it down, tune it, and watch it.
  5. ZFS backups: copy the data to another machine, and prove you can restore it.
  6. WireGuard: connect the machines with an encrypted tunnel.
  7. NFS: share a dataset with other machines.

If you want virtual machines and containers:

  1. bhyve and vm-bhyve: full virtual machines.
  2. Containers: containers from standard images.
  3. Linux compatibility: running Linux programs and images.
  4. Cloud: machines that configure themselves at first boot.

If you build software from source:

  1. Ports: the ports tree and its options.
  2. poudriere: a clean build farm with your own package repository.
  3. Containers: ship what you built as an image.

What do I want to do?

Start from the job, and go to the page:

From Linux to FreeBSD

The same job, the other tool. (The overview page has the long version with the reasons and the traps.)

The cheat sheet of every page

The cheat sheet from the end of each page, in order. Click the title for the page itself.

1. FreeBSD vs Linux: What Is Actually Different

The page: open it.

2. Upgrading FreeBSD Safely: freebsd-update, pkg and Boot Environments

The page: open it.

3. ZFS in Practice: Pools, Datasets, Snapshots and Self-Healing

The page: open it.

4. Jails: Lightweight Containers, the BSD Way

The page: open it.

5. The pf Firewall: Rules, Tables and Redirects

The page: open it.

6. The Ports Tree: Building FreeBSD Software from Source

The page: open it.

7. bhyve: Virtual Machines Built into FreeBSD

The page: open it.

8. poudriere: Build Your Own Packages, Properly

The page: open it.

9. vm-bhyve: Virtual Machines with Short Commands

The page: open it.

10. ipfw: The Other FreeBSD Firewall

The page: open it.

11. Linux Binary Compatibility: Running Linux Programs on FreeBSD

The page: open it.

12. The Boot Loader and Kernel Tuning: loader.conf, sysctl and Single-User Mode

The page: open it.

13. Hardening FreeBSD: A Tested Baseline

The page: open it.

14. Containers on FreeBSD: Podman, OCI Images and Jails

The page: open it.

15. FreeBSD in the Cloud: First-Boot Provisioning with nuageinit

The page: open it.

16. Monitoring FreeBSD: From top to Prometheus

The page: open it.

17. ZFS Backups to Another Machine: Send, Receive, Restore

The page: open it.

18. WireGuard on FreeBSD: A Private Tunnel Between Two Machines

The page: open it.

19. File Sharing with NFS: One Server, Many Machines

The page: open it.

Where things live

The golden rules

These came up on page after page. They are why the pages say "test first" so often.

  1. Make a restore point first. bectl create NAME costs almost nothing and turns a bad upgrade, a bad boot setting or a bad hardening session into a reboot.
  2. Check the syntax before you load. pfctl -nf, sshd -t, sh -n on a script, promtool check config. A typo in a firewall, an SSH setting or a loader file is how people lock themselves out.
  3. Test from a second connection, and know where the console is. Do not close the first session until the second one works.
  4. Know the order. pf: the last matching rule wins (unless quick). ipfw: the lowest number wins, first match. In sshd_config the first value wins.
  5. Boot-time and run-time settings are different things. sysctl -W NAME and sysctl -T NAME tell you which one you have.
  6. Read the error message. FreeBSD's messages are usually specific: a read only tunable, Operation not permitted, The pf kernel module must be loaded. They name the next step.
  7. Do not mix firewalls on one machine, and remember that a default-deny firewall also blocks your virtual machines and containers until you let their bridge through.
  8. Patch both halves. freebsd-update for the base system, pkg upgrade for packages, and pkg audit -F to find out what is vulnerable. A build from an old ports tree is only as fresh as the tree.
  9. Prefer drop-in files. /boot/loader.conf.d/, /etc/rc.conf.d/, your own file in a repository folder. Your changes stay visible and easy to remove.
  10. Check what is listening after you install anything. sockstat -4l -6l. Exporters, agents and daemons often listen on every address by default.
  11. A check that cannot fail proves nothing. Break something on purpose (a degraded pool, a stopped exporter) and watch the alert.
  12. A snapshot is not a backup, and a backup is not proven until you restored it. Send to another machine, then destroy and restore on purpose, and compare checksums.
  13. Say what you did not test. The pages mark "from the documentation, not run here" on purpose. Do the same in your own notes.

What the corner does not cover

Honest gaps, so you know where to look elsewhere: off-site and cloud backup copies, encrypted raw sends and backup-management tools (sanoid, zrepl), dashboards and alert routing (Grafana and Alertmanager are named but not run), mail servers, bsdinstall interactive installs in detail, desktop use, and the other BSDs. The FreeBSD Handbook and the manual pages (man) go further than these pages in every direction.

How do you know you have read the whole FreeBSD Corner?<br>
You stop typing systemctl<br>
and start typing sysrc.

🧪 Try it yourself

Use this page as a quiz:

1. Pick five rows from "What do I want to do?" and, without looking, say the command. Then check. 2. Pick one of the four reading paths and follow it on a virtual machine. Keep a boot environment before each page. 3. Choose a golden rule you broke last month, and find the page that would have saved you.

← File Sharing with NFS: One Server, Many Machines · ↑ FreeBSD Corner