Terminal Commands I Keep Looking Up
I started fiddling with Raspberry Pis more often. I had a cooling fan that wouldn’t fire up, an SD card slot that turned out to be fried, and a newly bought board I needed to verify was actually working.
Every time, I’d end up googling or asking AI the same vcgencmd flags or dmesg grep patterns. So I’m putting them all here mostly for myself. So I can come back and take what I need without memorizing any of this.
These cover Raspberry Pi OS, general Linux, and macOS. Where a command doesn’t exist on macOS, I’ve listed the equivalent. Hope this list is helpful for anyone. Even though I find it easier, Asking an AI would be easier..
Compatibility key: Y = works as-is | D = different syntax, see macOS column | N = not available
System Information
| Command | What it does | Linux | macOS | macOS equivalent |
|---|---|---|---|---|
uname -a | Kernel, architecture, hostname | Y | Y | |
hostname | Current hostname | Y | Y | |
cat /etc/os-release | OS name, version, codename | Y | N | sw_vers |
cat /proc/cpuinfo | CPU model, cores, revision | Y | N | sysctl -n machdep.cpu.brand_string |
free -h | RAM usage | Y | N | vm_stat or top -l 1 | head -n 10 |
uptime | Uptime and load averages | Y | Y | |
df -h | Disk usage per filesystem | Y | Y | |
lsblk | Block devices and partitions | Y | N | diskutil list |
du -sh * | Size of items in current dir | Y | Y | |
ncdu | Interactive disk usage | Y | Y | install via brew install ncdu |
Temperature, Voltage & Throttling
If your Pi is acting up, start here. Fan not spinning, board throttling under load, random reboots. These commands tell you what’s going on.
| Command | What it does | Linux | macOS | macOS equivalent |
|---|---|---|---|---|
vcgencmd measure_temp | SoC temperature (Pi only) | N | N | — |
vcgencmd measure_volts | Core voltage (Pi only) | N | N | — |
vcgencmd measure_clock arm | ARM clock speed (Pi only) | N | N | — |
vcgencmd get_throttled | Throttling flags (Pi only) | N | N | — |
vcgencmd get_mem arm | Memory split, ARM (Pi only) | N | N | — |
vcgencmd get_mem gpu | Memory split, GPU (Pi only) | N | N | — |
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq | CPU freq in kHz | Y | N | sysctl hw.cpufrequency |
cat /sys/class/thermal/thermal_zone0/temp | SoC temp in millidegrees | Y | N | sudo powermetrics --samplers smc -n 1 |
Decoding get_throttled
vcgencmd get_throttled returns a hex value. 0x0 means everything is fine. Anything else, check against this table:
| Bit | Hex | Meaning |
|---|---|---|
| 0 | 0x1 | Under-voltage detected |
| 1 | 0x2 | ARM frequency capped |
| 2 | 0x4 | Currently throttled |
| 3 | 0x8 | Soft temperature limit active |
| 16 | 0x10000 | Under-voltage has occurred (since boot) |
| 17 | 0x20000 | ARM frequency capping has occurred |
| 18 | 0x40000 | Throttling has occurred |
| 19 | 0x80000 | Soft temperature limit has occurred |
Bits 0-3 tell you what’s happening right now. Bits 16-19 tell you what happened at some point since boot. If you see 0x50000, your Pi has been both throttled and under-voltage. Check your power supply and cooling.
Hardware & Peripherals
These help you figure out if the system actually sees your hardware. When my SD card slot was fried, dmesg | grep -i mmc returning nothing was how I found out.
| Command | What it does | Linux | macOS | macOS equivalent |
|---|---|---|---|---|
lsusb | List USB devices | Y | N | system_profiler SPUSBDataType |
lspci | List PCIe devices | Y | N | system_profiler SPPCIDataType |
lsmod | Loaded kernel modules | Y | N | kextstat |
i2cdetect -y 1 | Scan I2C bus 1 | Y | N | — |
pinout | GPIO pinout diagram (Pi only) | N | N | — |
gpio readall | GPIO pin states, wiringpi (Pi only) | N | N | — |
v4l2-ctl --list-devices | List camera devices | Y | N | system_profiler SPCameraDataType |
aplay -l | Audio playback devices | Y | N | system_profiler SPAudioDataType |
arecord -l | Audio capture devices | Y | N | system_profiler SPAudioDataType |
sudo fdisk -l | Detailed disk/partition info | Y | N | diskutil list |
dmesg — your best friend for hardware issues
dmesg dumps the kernel ring buffer. Hardware detection, disconnects, errors, it all ends up here. Pipe it through grep to narrow things down:
| Command | What to look for |
|---|---|
dmesg | tail -50 | Last 50 kernel messages |
dmesg -w | Live stream — plug something in and watch |
dmesg | grep -i usb | USB device detection and errors |
dmesg | grep -i nvme | NVMe drive detection and init |
dmesg | grep -i pci | All PCIe device enumeration |
dmesg | grep -i voltage | Under-voltage warnings (weak PSU or cable) |
dmesg | grep -i eth|wlan | Network interface init, link up/down |
dmesg | grep -i hailo | Hailo AI accelerator PCIe detection (Pi only) |
dmesg | grep -i error | Quick scan for kernel-level errors |
dmesg | grep -i fail|warn | Failures and warnings across all subsystems |
On macOS,
dmesgrequiressudoand the output is more limited. Uselog stream --source kernelfor live kernel events.
Networking
| Command | What it does | Linux | macOS | macOS equivalent |
|---|---|---|---|---|
ip a | All interfaces and IPs | Y | N | ifconfig |
ip route | Routing table | Y | N | netstat -rn |
ss -tulnp | Open ports / listening services | Y | N | lsof -iTCP -sTCP:LISTEN -nP |
ping -c 4 <host> | Test connectivity | Y | Y | |
curl ifconfig.me | Public IP address | Y | Y | |
iwconfig | Wi-Fi details | Y | N | airport -I |
nmcli device status | NetworkManager summary | Y | N | networksetup -listallhardwareports |
nmcli connection show | Saved network profiles | Y | N | networksetup -listpreferredwirelessnetworks en0 |
cat /etc/resolv.conf | DNS resolver config | Y | Y | |
nmap -sn 192.168.1.0/24 | Scan local network | Y | Y | install via brew install nmap |
traceroute <host> | Trace packet route | Y | Y | |
sudo iftop | Live bandwidth monitor | Y | Y | install via brew install iftop |
Processes & Services
| Command | What it does | Linux | macOS | macOS equivalent |
|---|---|---|---|---|
htop | Interactive process viewer | Y | Y | install via brew install htop |
top | Basic process viewer | Y | Y | |
ps aux | All running processes | Y | Y | |
ps aux | grep <name> | Find a specific process | Y | Y | |
kill <pid> | Terminate process by PID | Y | Y | |
kill -9 <pid> | Force kill | Y | Y | |
systemctl status <svc> | Service status and logs | Y | N | launchctl list |
systemctl list-units --type=service | All loaded services | Y | N | launchctl list |
journalctl -u <svc> -f | Follow live service logs | Y | N | log stream --predicate 'subsystem == "<svc>"' |
journalctl -b | Logs since last boot | Y | N | log show --last boot |
Package Management
| Command | What it does | Linux | macOS | macOS equivalent |
|---|---|---|---|---|
sudo apt update | Refresh package index | Y | N | brew update |
sudo apt upgrade | Upgrade installed packages | Y | N | brew upgrade |
sudo apt install <pkg> | Install a package | Y | N | brew install <pkg> |
sudo apt remove <pkg> | Remove a package | Y | N | brew uninstall <pkg> |
sudo apt autoremove | Clean unused dependencies | Y | N | brew autoremove |
apt list --installed | All installed packages | Y | N | brew list |
apt search <keyword> | Search packages | Y | N | brew search <keyword> |
apt show <pkg> | Package details | Y | N | brew info <pkg> |
dpkg -l | List installed .deb packages | Y | N | — |
dpkg -L <pkg> | Files installed by a package | Y | N | brew list <pkg> |
apt/dpkgis Debian-based. If you’re on Fedora, Arch, or openSUSE you wantdnf,pacman, orzypperrespectively.
File & Directory Operations
| Command | What it does | Linux | macOS | macOS equivalent |
|---|---|---|---|---|
ls -lah | Detailed listing with hidden files | Y | Y | |
find / -name "filename" | Search by filename | Y | Y | |
find . -name "*.log" -mtime -7 | Files modified in last 7 days | Y | Y | |
file <filename> | Identify file type | Y | Y | |
stat <filename> | Detailed file metadata | Y | D | output format differs |
tree -L 2 | Directory tree, 2 levels deep | Y | Y | install via brew install tree |
tail -f /var/log/syslog | Follow system log live | Y | N | log stream |
cat, less, head, tail | View file contents | Y | Y | |
chmod, chown | Change permissions / ownership | Y | Y | |
rsync -avz <src> <dst> | Sync files (local or remote) | Y | Y |
Pi Configuration
| Command | What it does |
|---|---|
sudo raspi-config | Interactive config tool (interfaces, boot, display, etc.) |
cat /boot/firmware/config.txt | Boot and hardware config |
cat /boot/firmware/cmdline.txt | Kernel boot parameters |
sudo rpi-update | Update firmware — use with caution, can break things |
sudo reboot | Reboot (works everywhere) |
sudo shutdown -h now | Shutdown immediately (works everywhere) |
Stress Testing with stress-ng
Not a built-in command, but worth installing. Good for testing if a new board can handle sustained load without throttling or crashing. sudo apt install stress-ng on Debian/Pi OS, brew install stress-ng on macOS.
| Command | What it does |
|---|---|
stress-ng --cpu 4 --timeout 60s | Hammer all 4 CPU cores for 60 seconds |
stress-ng --cpu 4 --cpu-method matrixprod --timeout 5m | Heavier CPU load using matrix multiplication |
stress-ng --vm 2 --vm-bytes 512M --timeout 60s | Stress test memory (2 workers, 512MB each) |
stress-ng --hdd 1 --timeout 60s | Stress test disk I/O |
stress-ng --cpu 4 --vm 2 --vm-bytes 256M --hdd 1 --timeout 5m | Hit CPU, memory, and disk all at once |
Run vcgencmd measure_temp and vcgencmd get_throttled in another terminal while this runs to see how the board handles it. If the fan doesn’t spin up during a full CPU stress test, something is wrong.
Quick Diagnostics
Paste these one-liners to get a quick health check.
Pi / Linux
echo "--- OS ---" && cat /etc/os-release | grep PRETTY && \
echo "--- Kernel ---" && uname -r && \
echo "--- Temp ---" && vcgencmd measure_temp && \
echo "--- Throttle ---" && vcgencmd get_throttled && \
echo "--- CPU MHz ---" && echo "$(($(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq)/1000)) MHz" && \
echo "--- RAM ---" && free -h | grep Mem && \
echo "--- Disk ---" && df -h / | tail -1 && \
echo "--- Uptime ---" && uptime -p
macOS
echo "--- OS ---" && sw_vers && \
echo "--- Kernel ---" && uname -r && \
echo "--- CPU ---" && sysctl -n machdep.cpu.brand_string && \
echo "--- RAM ---" && top -l 1 | head -n 10 | grep PhysMem && \
echo "--- Disk ---" && df -h / | tail -1 && \
echo "--- Uptime ---" && uptime