Synopsis #
Many shell and UNIX concepts transfer from Linux, but the operating-system boundary does not. FreeBSD maintains a coherent base system separately from third-party packages, uses rc.d for services, documents interfaces in installed manual pages, and places locally installed software beneath /usr/local.
The safest first habit is to identify which part of the system owns a command or file before applying instructions written for another operating system.
Identify the system #
Collect the kernel and userland versions:
$ freebsd-version -kru
$ uname -a
freebsd-version distinguishes the running kernel, installed kernel, and installed userland. This matters during updates and upgrades, when a newly installed kernel may not be running until after a reboot.
Keep base and packages distinct #
The traditional FreeBSD installation contains a base system maintained with freebsd-update or from source. Third-party applications are normally installed as packages with pkg:
$ which ls
$ which nginx
$ pkg which /usr/local/sbin/nginx
Base-system programs normally live beneath /bin, /sbin, /usr/bin, or /usr/sbin. Packages install beneath /usr/local, including configuration in /usr/local/etc and rc.d scripts in /usr/local/etc/rc.d.
Pkgbase installations manage base-system components as packages and require their own repository policy. See Update, upgrade, or update packages? before selecting a maintenance command.
Use the installed documentation #
Manual pages are part of the operating system and package interface:
$ man hier
$ man rc.conf
$ man 8 service
$ apropos wireless
Section numbers matter. Section 1 contains user commands, section 5 file formats, section 8 administration commands, and section 4 device drivers. hier(7) explains the filesystem layout without relying on a Linux filesystem hierarchy description.
Manage services through rc.d #
Inspect a service before enabling it:
$ service -l
# service sshd status
$ sysrc sshd_enable
Enable a service persistently and start it separately:
# sysrc sshd_enable=YES
# service sshd start
systemctl, systemd unit files, and Linux distribution service names do not apply. Package documentation may require additional variables or configuration beneath /usr/local/etc before its rc.d service can start.
Manage users and groups #
Use pw(8) for scripted account management and adduser(8) for an interactive account:
# pw useradd operator1 -m -s /bin/sh
# pw groupmod wheel -m operator1
$ id operator1
Membership in wheel permits su to root when the root password policy allows it; it does not grant commands automatically. Install and configure doas or another privilege mechanism deliberately if direct su is not the intended model.
Find devices by driver evidence #
Linux names such as /dev/sda and tools such as lspci are not portable assumptions. FreeBSD exposes device information through facilities including:
$ dmesg
$ pciconf -lv
$ usbconfig list
$ sysctl -a | less
Device nodes and driver names lead to the applicable section 4 manual page. Preserve the output collected before making loader, kernel-module, or device-permission changes.
Locate persistent configuration #
Use the startup phase that owns the setting:
- rc.d service and host variables:
/etc/rc.confthroughsysrc; - runtime kernel parameters:
/etc/sysctl.conf; - loader-time tunables and early modules:
/boot/loader.conf; - package configuration: normally
/usr/local/etc.
See Make a system setting persistent before moving an assignment between these files.
Language, character encoding, keyboard layout, and time display cross different layers. Use Configure locale, keyboard, and time zone instead of translating a Linux distribution’s locale-generation or systemd-time procedure.