OpenBSD Cheatsheet
#
OpenBSD is a secure, free, and open-source Unix-like operating system based on the Berkeley Software Distribution (BSD). Known for its emphasis on security, code correctness, and comprehensive documentation, OpenBSD is widely used for building reliable and secure systems. Below is a comprehensive cheatsheet to help you get started with OpenBSD, covering various commands and their descriptions.
Command | Description |
---|
uname -a | Display all system information |
sysctl -a | Display all kernel state information |
dmesg | Show system boot messages |
top | Display real-time system information |
ps aux | List all running processes |
pkg_info | List installed packages |
pkg_add -v <package_name> | Install a package |
pkg_delete <package_name> | Remove a package |
doas <command> | Run a command with superuser privileges |
User and Group Management
#
Command | Description |
---|
adduser | Add a new user |
userdel <username> | Delete a user |
usermod -G <group> <username> | Add a user to a group |
groupadd <group> | Create a new group |
groupdel <group> | Delete a group |
passwd <username> | Change a user’s password |
Network Management
#
Command | Description |
---|
ifconfig | Display or configure network interfaces |
ping <hostname/IP> | Send ICMP ECHO_REQUEST to network hosts |
netstat -r | Display the routing table |
route add <destination> <gateway> | Add a static route |
pfctl -e | Enable the packet filter |
pfctl -d | Disable the packet filter |
pfctl -sr | Show active packet filter rules |
Disk Management
#
Command | Description |
---|
df -h | Display disk usage in a human-readable format |
du -sh <directory> | Show disk usage of a directory |
mount | Display all mounted filesystems |
mount /dev/<device> <mount_point> | Mount a filesystem |
umount <mount_point> | Unmount a filesystem |
fdisk -l | List all partitions on a disk |
newfs /dev/<device> | Create a new filesystem on a device |
System Services and Daemons
#
Command | Description |
---|
rcctl start <service> | Start a service |
rcctl stop <service> | Stop a service |
rcctl restart <service> | Restart a service |
rcctl enable <service> | Enable a service to start at boot |
rcctl disable <service> | Disable a service from starting at boot |
rcctl status <service> | Check the status of a service |
File Operations
#
Command | Description |
---|
cp <source> <destination> | Copy files or directories |
mv <source> <destination> | Move or rename files or directories |
rm <file> | Delete a file |
rm -r <directory> | Delete a directory and its contents |
chmod <permissions> <file> | Change file permissions |
chown <owner>:<group> <file> | Change file owner and group |
ln -s <target> <link> | Create a symbolic link |
This cheatsheet covers a range of essential commands for system information, user management, network management, disk management, system services, and file operations in OpenBSD. For detailed information on each command, refer to the OpenBSD manual pages using the man <command>
command.