The OpenBSD Cheatsheet

Managing packages.

Installing packages

pkg_add [pkgname(s)]

Uninstalling packages

pkg_delete [pkgname(s)]

Do not forget to also wipe the dependencies.

pkg_delete -a

Updating all packages

pkg_add -u

Searching package(s) by name

pkg_info -Q [name]

Getting package info

pkg_info [pkgname]

Getting list of installed files of certain package

pkg_info -L [pkgname]

Also read: man pkg_add

System Upgrade

Non-free Firmware update

fw_update

Updating firmwares with different mirror

fw_update -p https://otherhost.com/path

Receiving patches

syspatch

Receiving new system update.

sysupgrade

Managing Users

Adding user (yes. execute without any args)

adduser

Deleting user

userdel -r user
groupdel user

Adding user to group

usermod -G groupname user

Changing password

passwd

Changing certain user password

passwd user

Adding user to login class (Example: staff)

usermod -L staff user

Changing username

usermod -ml newname oldname

Changing user shell

usermod -s /path/to/new/sh user

Also read: man usermod

Managing services

Starting service

rcctl start servicename

Checking service

rcctl check servicename

Enabling service to start during boot

rcctl enable servicename

Disabling service to start during boot

rcctl disable servicename

Stopping service

rcctl stop servicename

Restarting service

rcctl restart servicename

Also read man rcctl

Managing network

Do this first:

ifconfig

Read the output.. Say, You want to connect to internet with re0 interface with DHCP.

doas ifconfig re0 autoconf

Making interface up

doas ifconfig re0 up

Making interface down

doas ifconfig re0 down

Also read: man ifconfig