// NETBSD · THE DARK SIDE OF UNIX

NetBSD terminal survival guide

Old-school Unix goodness: discover the shell, packages, rc.d, networking, logs and the practical commands you will actually use.

Welcome to the NetBSD shell

NetBSD 11.0 has the familiar Unix essentials plus a few distinctly BSD tools. This survival guide covers the first commands you'll actually use: navigation, processes, packages, networking, services, and documentation. We include examples for NetBSD/amd64, but many work on other NetBSD ports.

Prompt convention: a normal user types commands without special privileges; administration requires a root session (su -). The copy buttons contain commands without prompt prefixes. Read each example before pasting anything that changes settings.

// BUILD THE HABIT

Experiment as an ordinary user, in your home directory. Leave system files and disks alone until you know precisely what a command will change.

Need a working system first? Start with Install NetBSD 11.0: USB, sysinst and first boot.

1 · What is this system?

uname -a
uname -s
uname -r
uname -m
sysctl kern.version
sysctl hw.ncpu
whoami
id
uptime

uname describes the kernel and platform, sysctl queries kernel information, id identifies your user and group memberships and uptime reports how long the system has been running.

pwd
ls -la
cd /etc
pwd
cd ~
ls /usr/pkg/bin
man hier

pwd tells you where you are, cd changes directories and ls -la lists hidden files and permissions. Third-party software commonly lives under /usr/pkg on NetBSD, unlike /usr/local on FreeBSD and OpenBSD.

3 · Read, search and practise with files

cat /etc/motd
more /etc/motd
head -n 10 /etc/passwd
grep -n "root" /etc/passwd
find /usr/pkg/bin -name "*mutt*" 2>/dev/null
mkdir -p ~/netbsd-practice
printf "Hello from NetBSD!\n" > ~/netbsd-practice/hello.txt
cat ~/netbsd-practice/hello.txt

The final three commands only touch your practice directory. find may return nothing if NeoMutt isn't installed yet. Be careful with rm: it deletes files immediately, without a recycle bin.

4 · Edit text and manage permissions

vi ~/netbsd-practice/hello.txt
ls -l ~/netbsd-practice/hello.txt
chmod 600 ~/netbsd-practice/hello.txt
stat ~/netbsd-practice/hello.txt
umask

In vi, press i to insert text, Esc to stop editing, then type :wq to save and quit. chmod 600 allows only the owner to read/write the practice file. Avoid recursive ownership or permission changes on system directories.

5 · Check disk and memory usage

df -h
du -sh ~/netbsd-practice
mount
swapctl -l
sysctl hw.physmem

df shows free space, du measures file usage, mount lists mounted filesystems, swapctl -l lists swap devices and sysctl hw.physmem gives physical memory information. These commands inspect the machine without modifying its disks.

6 · Binary packages: pkgin and pkgsrc

The packaged-software ecosystem is called pkgsrc. You can install binary packages using pkgin, a higher-level interface, or the lower-level pkg_add tool. The /usr/pkg hierarchy is common for third-party programs.

# Read-only checks
command -v pkgin
pkg_info
pkgin search tmux
pkgin search neomutt
cat /usr/pkg/etc/pkgin/repositories.conf

For intentional changes, become root using su -; your administrator account must have appropriate permissions. Only use a binary repository built for the correct OS version and architecture:

# ROOT COMMANDS — run only after inspecting your configured repo
pkgin update
pkgin install tmux irssi neomutt
pkgin upgrade

pkgin update refreshes metadata, pkgin install installs your selected applications, and pkgin upgrade proposes third-party package updates. pkgin does not upgrade the NetBSD base operating system. Read what will be installed, updated or removed before approving any package transaction.

// IF PKGIN IS MISSING

The 11.0 official INSTALL guide explains installation using pkg_add pkgin and the correct PKG_PATH. Do not paste an old pkgsrc repository URL from a different NetBSD version.

7 · Where did my installed command go?

NetBSD third-party binaries are generally in /usr/pkg/bin, and some administrator tools in /usr/pkg/sbin. Check your shell's search path:

echo "$PATH"
command -v tmux
ls /usr/pkg/bin/tmux

If a program is installed but its directory isn't in PATH, you can add the directories to the current Bourne-style shell session:

PATH="/usr/pkg/bin:/usr/pkg/sbin:$PATH"
export PATH

For persistent changes, add the two lines to the appropriate startup file for your actual shell; ~/.profile is a common place for login sh/ksh sessions. Other shells use different files.

8 · Networking: ifconfig, routes and DNS

ifconfig -a
netstat -rn
ping -c 3 netbsd.org
cat /etc/resolv.conf
host netbsd.org

ifconfig -a lists interfaces, netstat -rn prints routing, ping checks network reachability, and /etc/resolv.conf is a common DNS configuration location. host may not be installed on minimal systems; omit it if unavailable.

For permanent networking changes, see the official networking documentation. Device names differ by driver—don't assume yours is wm0 or re0.

9 · Manage daemons with rc.d

NetBSD uses /etc/rc.conf and scripts under /etc/rc.d/. It is not systemd and not OpenBSD's rcctl. To inspect services:

ls /etc/rc.d
grep '^sshd=' /etc/defaults/rc.conf
service sshd status

To intentionally enable the SSH service on a trusted lab network, a root administrator can set sshd=YES in /etc/rc.conf using a text editor, then start it:

# ROOT ONLY; first review /etc/rc.conf and your network exposure
vi /etc/rc.conf
# Add or update the line: sshd=YES
service sshd start

Only do this if remote administration is actually wanted. Do not open router ports or expose SSH directly to the internet for this tutorial. For a one-time start of a disabled service, NetBSD also documents service SERVICE onestart. See the rc.d guide.

10 · Users and administrative access

whoami
id
groups
passwd

To carry out administrative work, use su - from an authorised account (on a typical NetBSD setup, the user must belong to wheel). The root user can create a separate account with:

# ROOT ONLY — substitute your chosen login name
useradd -m -G wheel yourname
passwd yourname

Do not work as root unnecessarily. Creating an ordinary account and knowing when privilege escalation is needed is one of the best Unix habits.

11 · Processes, hardware and logs

top
ps aux
vmstat 1 5
dmesg | tail -n 30
logger "DarkPC NetBSD lab test"
tail -n 30 /var/log/messages

Press q to leave top. Check kernel hardware detection with dmesg; use logger to send a harmless test message to the system logging facility. Some logs may require root to read. Be careful sharing logs online: they may expose device or network details.

12 · Base OS updates are different from pkgin

NetBSD base-system updates and pkgsrc application updates are separate processes. pkgin upgrade updates third-party packages only. For a NetBSD version upgrade (for example from an older release to 11.0), the supported beginner approach is to back up, boot the appropriate official installation medium and choose Upgrade in sysinst, following that release's notes.

Security advisories and critical fixes for the base system may require special patch, binary-update or build procedures; there is no universal NetBSD equivalent of OpenBSD's syspatch. See the NetBSD Security pages and formal release notes.

13 · Four systems, familiar ideas

TaskSlackware 15.0FreeBSDOpenBSDNetBSD
OS versioncat /etc/slackware-versionfreebsd-versionuname -runame -r
Network interfacesip addrifconfigifconfigifconfig -a
List installed third-party appsls /var/log/packagespkg infopkg_infopkg_info
Install binary appslackpkg install (repo setup)pkg installpkg_addpkgin install
Update app packagesslackpkg upgrade-allpkg upgradepkg_add -upkgin upgrade
Service configuration/etc/rc.d/ scriptsservice / sysrcrcctl/etc/rc.conf + service
Third-party install prefixUsually /usr/usr/local/usr/local/usr/pkg

Every system has its own conventions. In particular, Slackware's slackpkg requires mirror configuration and does not use the BSD package ecosystems.

Your first NetBSD command card

# EXPLORE WITHOUT CHANGING SYSTEM SETTINGS
uname -a
id
pwd
ls -la
df -h
ifconfig -a
netstat -rn
ps aux
man hier
# OPTIONAL WHEN PKGIN IS INSTALLED
pkgin search tmux
pkg_info
# ADMIN COMMANDS NEED ROOT — READ FIRST
# pkgin update
# pkgin install tmux

Continue with our NetBSD 11.0 installer guide and then explore tmux, NeoMutt and irssi on the wider DarkPC website.

Verified references

Guide editorial review: 16 October 2026. Commands have been checked against documentation; no NetBSD installation or package transaction was run on user hardware.

Official references and further reading