LPI BSD Specialist study materials
LPI BSD Specialist study resources

LPI BSD Specialist cheat sheet

LPI BSD Specialist · Keep the key ideas within reach.

Quick reference

BSD Installation and Software Management

  • FreeBSD installer (bsdinstall) offers guided ZFS-on-root, UFS, and manual partitioning; OpenBSD uses a text installer with disklabel, NetBSD uses sysinst.

  • FreeBSD pkg(8) installs binary packages from repositories defined in /etc/pkg/*.conf; pkg bootstrap -f re-downloads the pkg tool itself.

  • FreeBSD ports live in /usr/ports (installed via portsnap or git); make install clean builds and installs, make config sets options, and /var/db/ports stores saved option choices.

  • pkg info -l lists files owned by an installed package; pkg which /path finds the owning package; pkg audit -F checks known vulnerabilities.

  • OpenBSD packages use pkg_add, pkg_delete, pkg_info; PKG_PATH points at a mirror, and syspatch applies base-system binary patches while pkg_add -u updates packages.

  • NetBSD pkgin wraps pkgsrc binaries; pkgin update refreshes the index and pkgin upgrade upgrades installed packages.

  • FreeBSD base system and kernel are updated with freebsd-update fetch then freebsd-update install (binary), or by building world/kernel from source.

  • A release upgrade on FreeBSD requires freebsd-update -r upgrade; mergemaster or etcupdate reconciles /etc configuration files afterward.

Quick reference

Storage Devices and BSD Filesystems

  • GEOM is the FreeBSD disk framework; gpart create -s gpt ada0 makes a GPT scheme, gpart add -t freebsd-zfs -s 10G ada0 adds a partition.

  • FreeBSD device nodes: ada* are SATA/AHCI disks, da* are SCSI/USB disks, nvd*/nda* are NVMe, cd* are optical.

  • ZFS pools are created with zpool create pool vdev...; vdev types include mirror, raidz1, raidz2, raidz3, and stripe; zpool status shows health and resilver progress.

  • ZFS datasets are mounted by property: zfs create pool/data, zfs set mountpoint=/data pool/data, zfs set quota=50G pool/data.

  • UFS2 is the native FreeBSD/NetBSD/OpenBSD filesystem; newfs /dev/ada0p1 formats it, and tunefs adjusts parameters such as soft updates.

  • The BSD disklabel (OpenBSD disklabel, NetBSD disklabel, FreeBSD gpart) partitions a disk into lettered or numbered slices.

  • OpenBSD softraid(4) provides RAID 0/1/5/C; bioctl -c 1 -l /dev/sd0a,/dev/sd1a softraid0 creates a mirror.

  • Mounting is controlled by /etc/fstab fields: device, mountpoint, fstype, options, dump, pass; mount -a mounts all entries.

Quick reference

Basic BSD System Administration

  • FreeBSD rc.conf variables enable services: sshd_enable="YES", and service start|stop|status controls them; OpenBSD uses rcctl enable|start .

  • Users are added with adduser (interactive) or pw useradd on FreeBSD; OpenBSD uses useradd; passwords are set with passwd.

  • The superuser is root (UID 0); su switches user, and doas (OpenBSD) or sudo grants delegated privilege.

  • FreeBSD periodic(8) runs daily/weekly/monthly maintenance via /etc/periodic.conf; OpenBSD runs /etc/daily, /etc/weekly, /etc/monthly from cron.

  • Logs: FreeBSD writes to /var/log/messages and /var/log/security via syslogd; newsyslog rotates logs based on /etc/newsyslog.conf.

  • Process control: ps auxww, top, kill -TERM , kill -9 ; pgrep/pkill match by name.

  • FreeBSD jails isolate processes with a shared kernel; ezjail or iocage are common management tools; jail.conf defines jails in newer releases.

  • OpenBSD pledge(2)/unveil(2) restrict programs; systrace is deprecated. Kernel tunables live in /etc/sysctl.conf and are read with sysctl.

Quick reference

Basic BSD Network Administration

  • FreeBSD interface configuration lives in /etc/rc.conf: ifconfig_em0="inet 192.0.2.10/24", defaultrouter="192.0.2.1", and hostname.

  • OpenBSD uses /etc/hostname.if files (e.g., /etc/hostname.em0) plus /etc/mygate for the default route; rcctl restart netif reloads.

  • DNS resolver configuration is /etc/resolv.conf (nameserver lines); /etc/hosts maps static names before DNS.

  • ifconfig shows and sets interface state: ifconfig em0 up, ifconfig em0 inet 10.0.0.5/24, ifconfig em0 alias 10.0.0.6/24.

  • pf is the packet filter on OpenBSD and FreeBSD; rules load with pfctl -f /etc/pf.conf, pfctl -sr shows rules, pfctl -si shows statistics.

  • FreeBSD uses rc.conf for pf: pf_enable="YES", pflog_enable="YES"; OpenBSD enables pf via rcctl enable pf.

  • netstat -rn shows the routing table; route add default 192.0.2.1 adds a default route at runtime.

  • sshd_config controls remote access: PermitRootLogin, PasswordAuthentication, Port; service sshd reload applies changes.

Quick reference

Basic Unix Skills

  • File permissions are rwx for user, group, other; chmod 755 file sets rwxr-xr-x; chown user:group file changes ownership.

  • Directory permissions: read lists entries, write creates/deletes entries, execute allows traversal into the directory.

  • Pipes and redirection: cmd > file (overwrite), cmd >> file (append), cmd 2>&1 (merge stderr), cmd1 | cmd2 (pipe).

  • find searches by attribute: find /var -name '*.log' -mtime +7 -delete removes old logs.

  • grep -r searches recursively; grep -i ignores case; grep -v inverts the match.

  • tar creates archives: tar -czf archive.tgz dir/ creates gzip archive, tar -xzf archive.tgz extracts it.

  • Environment: env lists variables, export VAR=value sets for child processes, PATH determines command lookup.

  • Process and job control: & backgrounds, jobs lists, fg/bg resume, Ctrl-Z suspends; nohup keeps a job after logout.

Quick reference

BSD Installation and Software Management

  • FreeBSD pkg repositories are configured in /etc/pkg/FreeBSD.conf; pkg update refreshes metadata before pkg upgrade.

  • OpenBSD's pkg_add reads PKG_PATH; the default mirror is set in /etc/installurl, and pkg_add -u updates all packages.

  • NetBSD pkgin requires an initial pkgin update to fetch the package index; pkgin search and pkgin install manage packages.

  • FreeBSD ports: cd /usr/ports//; make install clean; make config sets per-port options stored in /var/db/ports.

  • freebsd-update fetch downloads base-system patches; freebsd-update install applies them; a reboot is needed after kernel updates.

  • OpenBSD syspatch applies security patches to the base system; sysupgrade upgrades to a new release.

  • pkg audit -F checks installed FreeBSD packages for known CVEs; pkg check -d verifies dependency integrity.

Quick reference

Storage Devices and BSD Filesystems

  • FreeBSD gpart: gpart create -s gpt ada0, gpart add -t freebsd-ufs -s 50G ada0, gpart show lists partitions.

  • ZFS pool creation: zpool create tank mirror ada0 ada1; raidz2 requires at least 4 disks.

  • ZFS snapshots: zfs snapshot tank/data@snap, zfs list -t snapshot lists them, zfs rollback tank/data@snap restores.

  • newfs /dev/ada0p1 formats a UFS2 filesystem; newfs_msdos formats FAT.

  • /etc/fstab fields: device, mountpoint, fstype, options, dump, pass; pass=1 means fsck first.

  • OpenBSD disklabel -E sd0 edits the disklabel interactively; partitions are lettered a-p.

  • df -h shows mounted filesystem usage; du -sh dir shows directory size.

Quick reference

Basic BSD System Administration

  • FreeBSD rc.conf: sshd_enable="YES"; service sshd start; sysrc sshd_enable=YES edits rc.conf safely.

  • OpenBSD rcctl enable sshd; rcctl start sshd; rcctl ls on lists enabled services.

  • adduser creates a user interactively; pw useradd -n bob -m -s /bin/sh creates non-interactively on FreeBSD.

  • doas (OpenBSD) reads /etc/doas.conf; sudo reads /etc/sudoers; both delegate root privilege.

  • periodic(8) runs daily/weekly/monthly scripts; FreeBSD stores output in /var/log/; OpenBSD uses /etc/daily.local for custom tasks.

  • newsyslog.conf controls log rotation by size and time; syslogd writes to /var/log/messages.

  • jail(8) on FreeBSD isolates processes; jail.conf defines jails; jexec enters a running jail.

Quick reference

Basic BSD Network Administration

  • FreeBSD /etc/rc.conf: ifconfig_em0="inet 192.0.2.10/24", defaultrouter="192.0.2.1", hostname="host.example.com".

  • OpenBSD /etc/hostname.em0 holds 'inet 192.0.2.10 255.255.255.0'; /etc/mygate holds the default route.

  • resolv.conf nameserver lines set DNS; /etc/hosts takes precedence for static names.

  • ifconfig em0 inet 10.0.0.5/24 sets an address; ifconfig em0 alias adds a secondary address.

  • pfctl -f /etc/pf.conf loads rules; pfctl -sr lists rules; pfctl -si shows statistics.

  • netstat -rn shows routes; route add default 192.0.2.1 adds a runtime default route.

  • sshd_config: PermitRootLogin no, PasswordAuthentication no, Port 22; service sshd reload applies.

Quick reference

Basic Unix Skills

  • chmod 755 file = rwxr-xr-x; chmod u+x file adds execute for the owner.

  • chown user:group file changes owner and group; only root may change ownership.

  • cmd > file overwrites; cmd >> file appends; cmd 2>&1 merges stderr into stdout.

  • find /var -name '*.log' -mtime +7 -delete removes logs older than 7 days.

  • tar -czf archive.tgz dir/ creates a gzip archive; tar -xzf archive.tgz extracts it.

  • grep -r pattern dir searches recursively; grep -v pattern inverts the match.

  • export VAR=value sets a variable for child processes; env lists variables; PATH determines command lookup.