Linux/OpenBSD Cheatsheet

Nov 04, 2023

 

Linux and OpenBSD do share a great deal of common commands and core utilities, albeit with different implementations. However, there are some obvious differences, due to the ways these systems work. This page contains a cheatsheet for common commands, operations and files on OpenBSD and Linux (primarily Red Hat family) systems, which covers some of these differences.


 

General Commands

LinuxOpenBSD
sudodoas
sudo sudoas su
lsoffstat
lsblksysctl hw.disknames
ip aifconfig
lspcipcidump
adduser <username>useradd -m <username>
deluser <username>userdel <username>

Service Management

LinuxOpenBSD
systemctl stop <service>rcctl stop <service>
systemctl start <service>rcctl start <service>
systemctl status <service>rcctl check <service>
systemctl reload <service>rcctl reload <service>
systemctl enable <service>rcctl enable <service>
systemctl disable <service>rcctl disable <service>
systemctl restart <service>rcctl restart <service>
systemctl list-units --type=servicercctl ls all
systemctl list-units --type=service --state=runningrcctl ls started
systemctl list-units --type=service --state=enabledrcctl ls enabled

Firewall & Networking

LinuxOpenBSD
systemctl reload firewalldpfctl -f /etc/pf.conf
systemctl enable firewalldpfctl -e
systemctl disable firewalldpfctl -d
firewall-cmd --list-allpfctl -sr
firewall-cmd --add-port=...vi /etc/pf.conf
firewall-cmd --runtime-to-permanent-
systemctl restart networksh /etc/netstart
less /var/log/firewalldtcpdump -n -e -ttt -r /var/log/pflog

Packages & Upgrades

LinuxOpenBSD
yum/dnf installpkg_add
yum/dnf updatepkg_add -u
yum/dnf removepkg_delete
yum/dnf autoremovepkg_delete -a
yum/dnf searchpkg_info -Q
-syspatch -c
-syspatch
system-upgrade/dist-upgradesysupgrade

Important Files

LinuxOpenBSD
.bashrc.kshrc
/etc/sudoers/etc/doas.conf
/etc/sysconfig/network-scripts/ifcfg-<interface>/etc/hostname.<interface>
/etc/firewalld/firewalld.conf/etc/pf.conf
/var/log/nginx/var/www/logs