🧾 OpenWrt SSH Command Cheat Sheet
This cheat sheet summarizes the most commonly used and useful SSH commands for managing OpenWrt routers via terminal access.
🔧 System Management
passwd # Set or change root password
reboot # Reboot the router
uptime # Show how long the system has been running
df -h # Show disk usage
top # Show running processes (press q to quit)
htop # Enhanced process viewer (install separately)
logread # View system logs
logread -f # Follow system log (like tail -f)
🧱 Package Management
opkg update # Update package list
opkg install <pkg> # Install a package
opkg remove <pkg> # Remove a package
opkg list-installed # List installed packages
🌐 Network Management
ip a # Show network interfaces and IPs
ifconfig # Alternative interface info (install net-tools)
ping openwrt.org # Test internet connectivity
/etc/init.d/network restart # Restart network services
🔌 Wireless & Wi-Fi
iw dev # List wireless interfaces
iw dev wlan1 station dump # Show connected clients (2.4GHz)
iw dev wlan0 station dump # Show connected clients (5GHz)
wifi reload # Reload Wi-Fi settings
uci show wireless # Display wireless settings
⚙️ UCI Configuration System
uci show # Show full config
uci show <config> # Show specific (e.g., uci show wireless)
uci set ... # Set a config value
uci delete ... # Delete a config value
uci commit # Save changes
Example:
uci set wireless.radio1.channel='6'
uci commit wireless
wifi reload
🔥 Firewall & Port Redirection
/etc/init.d/firewall restart # Restart firewall
nft list ruleset # View current firewall rules (OpenWrt ≥22.03)
🧪 DNS & DHCP
/etc/init.d/dnsmasq restart # Restart DNS/DHCP service
cat /tmp/dhcp.leases # View active DHCP leases
🗂️ File Management
cd /etc/config # Where config files are stored
vi <file> # Edit file using vi editor
scp user@host:/path . # Copy file from remote machine
sysupgrade -b /tmp/backup.tar.gz # Create backup of config
🔒 Admin & Recovery
firstboot # Reset to factory defaults
mount_root # Make root filesystem writable in failsafe
Use these only if you understand the consequences.
🧠 Tips
tab
autocompletes commands and file names- Use
&&
to run multiple commands:opkg update && opkg install htop
logread -f
is your friend for debugging
📌 Essential Directories
Path | Purpose |
---|---|
/etc/config/ | Main configuration files |
/tmp/ | Temporary runtime files |
/overlay/ | Persistent writable root |
/etc/init.d/ | Service startup scripts |