NetBSD Cheatsheet
#
NetBSD is a highly portable, free, and open-source Unix-like operating system derived from the Berkeley Software Distribution (BSD). Known for its portability across a wide range of hardware platforms, NetBSD is widely used in various environments, from servers to embedded systems. Below is a comprehensive cheatsheet to help you get started with NetBSD, 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 <package_name> | Install a package |
pkg_delete <package_name> | Remove a package |
su <command> | Run a command with superuser privileges |
User and Group Management
#
Command | Description |
---|
useradd <username> | 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 |
service network restart | Restart network services |
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 |
disklabel <device> | Display or modify disk label |
newfs /dev/<device> | Create a new filesystem on a device |
System Services and Daemons
#
Command | Description |
---|
service <service> start | Start a service |
service <service> stop | Stop a service |
service <service> restart | Restart a service |
rc.d <service> on | Enable a service to start at boot |
rc.d <service> off | Disable a service from starting at boot |
service <service> status | 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 NetBSD. For detailed information on each command, refer to the NetBSD manual pages using the man <command>
command.