# FreeBSD version
freebsd-version
uname -a
# Hardware info
sysctl hw.model hw.ncpu hw.physmem
dmesg | head -50
# Disk information
geom disk list
camcontrol devlist
# Memory usage
top -b -d1 | head -10
vmstat
# CPU usage
top -P
File System Operations
# Disk usage
df -h
du -sh /var/*
# Mount/unmount
mount
mount /dev/da1p1 /mnt
umount /mnt
# File permissions (same as Linux)
ls -la
chmod 755 file
chown user:group file
Package Management (pkg)
# Update package repository
pkg update
# Upgrade all packages
pkg upgrade
# Search packages
pkg search nginx
# Install package
pkg install nginx
# Remove package
pkg delete nginx
# List installed packages
pkg info
# Package details
pkg info nginx
Service Management
# List all services
service -l
# Start/stop/restart service
service nginx start
service nginx stop
service nginx restart
# Check service status
service nginx status
# Enable service at boot
sysrc nginx_enable="YES"
# View all enabled services
sysrc -a | grep enable
# Service configuration file
cat /etc/rc.conf
Network Commands
# Interface configuration
ifconfig
ifconfig em0
# Routing table
netstat -rn
# Active connections
netstat -an
sockstat -4
# DNS lookup
host google.com
drill google.com
# Network statistics
netstat -s
Process Management
# List processes
ps aux
ps auxww # Wide output
# Process tree
ps -auxd
# Interactive process viewer
top
htop # After: pkg install htop
# Kill process
kill PID
kill -9 PID
# Find process by name
pgrep nginx
pkill nginx
User Management
# Add user (interactive)
adduser
# Add user to group
pw groupmod wheel -m username
# User information
id username
finger username
# Switch user
su - username
# Lock/unlock account
pw lock username
pw unlock username
System Logs
# View logs
less /var/log/messages
tail -f /var/log/messages
# Authentication log
cat /var/log/auth.log
# Dmesg (boot messages)
dmesg
dmesg | tail
# Log rotation
newsyslog
ZFS Commands
# Pool status
zpool status
zpool list
# Dataset list
zfs list
# Snapshots
zfs list -t snapshot
zfs snapshot tank/data@snap1
zfs rollback tank/data@snap1
Useful Shortcuts
# FreeBSD manual pages
man command
man 5 rc.conf # Section 5 (file formats)
apropos keyword
# Command location
which command
whereis command
# Shutdown/reboot
shutdown -h now
shutdown -r now
reboot
beginner | Getting Started | Updated 2025-01-15
- freebsd
- commands
- cli
- terminal
- reference