Linux commands
Hardware
All of these only read information. They change nothing.
The machine
| Command |
Shows |
hostnamectl |
Name, Debian version, kernel, model (e.g. MacBookPro14,1) |
cat /etc/os-release |
Exact Debian version |
uname -r |
Kernel version |
uptime |
How long since the last restart, and the load |
sudo dmidecode -s system-product-name |
Computer model |
CPU
| Command |
Shows |
lscpu |
Model, cores, threads, speed |
nproc |
Number of threads |
grep -o -w -m1 avx2 /proc/cpuinfo |
Prints avx2 if the CPU has it (fast AI) |
htop |
Live CPU and memory per program (Q quits; F6 sorts) |
top |
Same, always installed |
Load (in uptime and htop): roughly how many threads are busy. On a 4-thread CPU, a load of 4 is "fully busy".
Memory
| Command |
Shows |
free -h |
Total, used and available memory, plus swap |
swapon --show |
Swap space |
vmstat 2 |
Memory/CPU every 2 seconds (Ctrl+C stops) |
Look at available, not "free". Linux uses spare memory as cache and gives it back when needed.
Temperature and fan
sudo apt install lm-sensors
sensors
watch -n 2 sensors # refresh every 2 seconds, Ctrl+C stops
| Reading |
Normal |
| CPU at rest |
35–55 °C |
| CPU under load |
below ~85 °C |
| Fan at rest |
0 RPM is fine on many laptops |
Battery and power (laptops)
| Command |
Shows |
cat /sys/class/power_supply/ADP1/online |
1 = charger connected |
cat /sys/class/power_supply/BAT0/status |
Charging, Full, Discharging |
cat /sys/class/power_supply/BAT0/capacity |
Charge in % |
ls /sys/class/power_supply/ |
Names on your machine (may differ from ADP1/BAT0) |
Devices
| Command |
Shows |
lsusb |
Everything plugged into USB |
lsusb -t |
USB speed per device: 480M = USB 2 (slow), 5000M = USB 3 |
lspci |
Internal parts: Wi-Fi card, graphics, disk controller |
sudo dmesg -w |
Live hardware messages. Plug something in and watch (Ctrl+C stops) |
sudo dmesg | tail -30 |
The latest hardware messages |
Stress test (supervised only)
sudo apt install stress-ng
stress-ng --cpu 2 --timeout 120s
Watch sensors in another window. Stop with Ctrl+C if it goes above 90 °C.