FreeBSD Cheatsheet
#
FreeBSD is a powerful, free, and open-source Unix-like operating system derived from the Berkeley Software Distribution (BSD). It is known for its advanced networking, security features, and performance. FreeBSD is widely used in servers, desktops, and embedded platforms. Below is a comprehensive cheatsheet to help you get started with FreeBSD, 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 install <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 |
---|
adduser | Add a new user |
rmuser <username> | Delete a user |
pw usermod <username> -G <group> | Add a user to a group |
pw groupadd <group> | Create a new group |
pw 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 netif restart | Restart network interfaces |
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 |
gpart show | Show partition layout |
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 |
sysrc <service>_enable="YES" | Enable a service to start at boot |
sysrc <service>_enable="NO" | 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 FreeBSD. For detailed information on each command, refer to the FreeBSD manual pages using the man <command>
command.