Start here: Unix with a BSD accent
FreeBSD gives you a real Unix-like environment: a shell, a filesystem, manual pages, network tools and package management. Plenty will feel familiar from Slackware, but not every Linux command works the same way. This cheat-friendly guide shows what to type, why it matters and which tasks require root privileges.
Commands in this guide are intended for a FreeBSD 15.1 system. Most examples are read-only. Commands that change system state are clearly marked. Run ordinary commands as your own user, and use su - only when administrative permissions are needed.
How to read our examples: code blocks contain commands you can copy without a decorative prompt. In explanations, % often represents a normal user prompt and # represents root. Never paste a leading prompt character.
1 · Find out where you are
whoami
id
hostname
uname -a
freebsd-version
uptime
date
| Command | What it tells you |
|---|---|
whoami / id | Current user, numeric IDs and group membership. |
hostname | Computer name. |
uname -a | Kernel and architecture information. |
freebsd-version | FreeBSD userland release; use freebsd-version -kru for more version details. |
uptime / date | How long the box has been running; system date and time. |
Try id to check whether your account belongs to wheel (helpful if you intend to use su).
2 · Walk around the filesystem
pwd
ls
ls -lah
cd /usr/local
pwd
cd ~
ls -la
pwd prints the current directory. cd ~ returns to your home directory. On FreeBSD, much third-party software is installed below /usr/local, while the base operating system keeps its own traditional directory structure.
| Directory | Purpose |
|---|---|
/etc | Base-system configuration, including /etc/rc.conf. |
/usr/local/etc | Configuration for many third-party packages. |
/usr/local/bin | Commands installed by packages. |
/var/log | Many system and application log files. |
/home / /usr/home | User home directories; the layout and links depend on installation. |
/boot | Boot loader, kernel and related files. |
3 · Read, find and edit files
file /bin/sh
head -n 10 /etc/rc.conf
tail -n 20 /var/log/messages
less /etc/rc.conf
grep -n "hostname" /etc/rc.conf
find /etc -name "*.conf"
Press q to quit less or a manual page. grep -n prints matching lines with line numbers; find searches paths. Some log files require elevated permissions, so permission errors are normal.
You can edit your own file using vi (included in the base system). If you prefer an easier first editor, install nano later with pkg install nano.
mkdir -p ~/bsd-notes
printf "The dark side of Unix lives.\n" > ~/bsd-notes/hello.txt
cat ~/bsd-notes/hello.txt
vi ~/bsd-notes/hello.txt
In vi: press i to insert; Esc to leave insert mode; type :wq then Enter to save and exit. For an escape hatch without saving, :q! and Enter.
4 · Permissions without drama
ls -l ~/bsd-notes/hello.txt
chmod 600 ~/bsd-notes/hello.txt
ls -l ~/bsd-notes/hello.txt
stat -f "%Sp %Su %Sg %N" ~/bsd-notes/hello.txt
chmod 600 means the owner may read and write; nobody else receives permissions through the file's mode bits. FreeBSD's stat -f uses BSD syntax; it's not interchangeable with every GNU/Linux stat example.
Only run these changes on the example file in your home directory. Avoid recursively changing permissions under /etc, /usr or your entire home directory.
5 · Disk space and mounted filesystems
df -h
du -sh ~/bsd-notes
mount
swapinfo -h
gpart show
df -h shows space on mounted filesystems; du -sh estimates directory size. gpart show displays partition tables and is a handy FreeBSD equivalent for inspecting disk layout. None of these example commands changes partitions.
On a ZFS installation, you can also inspect pools and datasets:
zpool status
zfs list
Only run ZFS-specific commands on a machine using ZFS; UFS systems do not necessarily have an active pool.
6 · Packages: the mighty pkg
FreeBSD manages most additional software with pkg. Searches and queries can be run as an ordinary user; package installation and upgrades require root.
pkg search neomutt
pkg search irssi
pkg info
pkg info -l tmux
pkg info -l tmux lists files belonging to an installed tmux package; it will report an error if tmux is not installed.
Changing the system · run as root:
su -
pkg update
pkg install tmux irssi neomutt links
pkg audit -F
exit
After reviewing available updates and reading any relevant release notes, pkg upgrade upgrades installed packages; it should also be run as root.
On a classic Distribution Sets installation, update the FreeBSD base OS using freebsd-update fetch then freebsd-update install (as root). On a pkgbase installation, the base OS is managed with pkg. Check how your system was installed before following upgrade instructions. See the FreeBSD installation guide.
7 · Networking: ifconfig, routes and sockets
ifconfig
netstat -rn
route -n get default
ping -c 4 freebsd.org
sockstat -4 -l
cat /etc/resolv.conf
ifconfig shows interfaces and addresses. route -n get default inspects the route used for the default destination. sockstat -4 -l lists listening IPv4 sockets; it is useful for checking which program is accepting network connections. Some output may require root for full details.
Linux vs FreeBSD: Linux tutorials often use ip addr and ss. On a stock FreeBSD system, start with ifconfig, netstat and sockstat.
8 · Services and settings in rc.conf
FreeBSD uses traditional rc scripts and the service command. You generally won't find Linux systemctl on a stock FreeBSD machine.
service -e
service sshd status
sysrc -a
sysrc sshd_enable
service -e displays enabled services. sysrc -a lists rc configuration values. sysrc sshd_enable reads the SSH service setting; reading it does not turn SSH on.
If you intentionally need an SSH server, read the FreeBSD security handbook and secure your login first. Then, as root, sysrc sshd_enable=YES controls whether it starts at boot, and service sshd start starts it now. Do not enable remote access just because a tutorial says so.
9 · Processes, memory and troubleshooting
top
ps aux
ps aux | grep -i tmux
vmstat 1 5
sysctl hw.physmem
tail -n 40 /var/log/messages
top gives an interactive process view; press q to leave it. ps aux lists running processes, and vmstat 1 5 samples system activity five times. sysctl reads kernel and system parameters.
If you want to terminate a hung program, first identify its process carefully using ps. Avoid copying arbitrary kill -9 examples; they may stop the wrong process or discard unsaved work.
10 · Manual pages: the built-in survival kit
man intro
man hier
man pkg
man rc.conf
man service
man ifconfig
apropos network
FreeBSD's man hier explains the filesystem hierarchy. man rc.conf is the place to learn about system settings. apropos searches manual-page descriptions; if its database has not been populated, it may return limited results.
11 · Slackware → FreeBSD translation table
| Looking for… | Slackware/Linux habit | FreeBSD approach |
|---|---|---|
| Distribution release | cat /etc/slackware-version | freebsd-version |
| Interfaces | ip addr | ifconfig |
| Network listeners | ss -lnt | sockstat -4 -l |
| Disk partitions | lsblk | gpart show |
| Binary package operations | slackpkg / installpkg | pkg |
| Boot-time services | Slackware rc scripts in /etc/rc.d | service and sysrc |
| Third-party programs | Usually under /usr/bin, /usr/local, etc. | Typically under /usr/local |
| Manual page | man command | Same trusty man command |
And yes, tmux, irssi, neomutt and links feel wonderfully familiar once installed. That's the beauty of living in a terminal.
Print-worthy quick reference
# Identity and health
freebsd-version
uname -a
uptime
# Files and disk
pwd
ls -lah
df -h
gpart show
# Network
ifconfig
netstat -rn
sockstat -4 -l
# Documentation
man hier
man pkg
Most of the commands above are safe, read-only checks. For the complete installation process, read FreeBSD 15.1: From USB to Unix Prompt. For daily terminal workflows, keep the tmux guide and NeoMutt guide handy.
Official references
- The official FreeBSD Handbook
- FreeBSD package management
- FreeBSD system updates
- FreeBSD online manual pages
DarkPC guide reviewed 16 October 2026. Commands may differ on older FreeBSD releases or customised shells.