As a tinkerer with soft routing systems, one must know how to use OpenWrt commands. It's easy to haphazardly install plugins for mips, aarch64, and X86 without distinguishing between architectures. At this point, commands to check the CPU architecture come in handy. Below are the OpenWrt query and maintenance commands organized by 彧繎,mainly related to hardware, system, disk, installation, and other commonly used commands.
Hardware Related#
cat /proc/cpuinfo
# View CPU information
uname -m
# View CPU architecture
cat /proc/meminfo
# View memory usage
df -h
# View disk usage
System Related#
uname -a
# View kernel information
opkg print-architecture
# Acceptable architectures
dmesg
# Read kernel logs
logread
# Read system logs
ps -w
# List processes
uptime
# Display uptime and CPU load
vi etc/config/network
# Modify backend address or bind network port
/etc/init.d/uhttpd restart
# Luci restart command
/etc/init.d/uhttpd enable
# Enable auto-start on boot
/etc/init.d/uhttpd start
# Start uhttpd
/etc/init.d/firewall restart
# Restart firewall
/etc/init.d/network restart
# Restart network service
/etc/config/dhcp restart
# Restart DHCP
reboot
# Reboot device
Installation Management#
opkg update
# Update package list
opkg install ***
# Install package
opkg remove ***
# Uninstall package
opkg install *.ipk
# Batch install packages
opkg [install/remove] [package name] --force-depends
# Force install and uninstall
opkg list | grep ***
# Search for package
opkg list-installed
# List all installed packages
opkg info ***
# View package information
opkg files ***
# View package files
rm /***/[filename]
# Clean up specified directory files
rm -f /var/lock/opkg.lock
# Clean up opkg update cache files
Disk Management#
fdisk -l
# List all partition tables "-u" used with "-l" to show partition count
fdisk -m
# Display menu and help information
fdisk -a
# Mark active partition/boot partition
fdisk -d
# Delete partition
fdisk -l
# Display partition types
fdisk -n
# Create new partition
fdisk -p
# Display partition information
fdisk -q
# Exit without saving
fdisk -t
# Set partition number
fdisk -v
# Perform partition check
fdisk -w
# Save changes
fdisk -x
# Extended application, advanced features
fdisk -s
# Specify partition
fdisk -v
# Version information
mount –t ntfs-3g /dev/sdb1 /mnt/usb
# Mount NTFS hard drive
sleep 30 && mount -t ntfs-3g /dev/sdb1 /mnt/sdb1
# Mount disk to folder
Wireless Related#
iwinfo wlan0 info
# View wireless network card information
wifi down
wifi up
# Restart wireless service
iw dev wlan0 scan
# Scan for hotspots
iwinfo wlan0 assoclist
iw dev wlan0 station dump
# View connected clients
Other Commands#
passwd
# Change login password
firstboot
# Reset command
chmod +x ***
# Grant script permissions
nslookup www.baidu.com 202.96.69.38
# DNS query test
du -s /root/* | sort -nr
# View file directory size
ifconfig eth0 down
ifconfig eth0 hw ether XX:XX:XX:XX:XX:XX // Changed MAC address
ifconfig eth0 up
# Change MAC address
opkg install vsftpd openssh-sftp-server
/etc/init.d/vsftpd enable
/etc/init.d/vsftpd start
# Install SFTP file transfer