Watching Processes
Top and ps aux.
When a computer feels slow, the first question is, what's using it? There are tools that show processes, and how much processor and memory each one uses.

- The computer feels slow
- What's using it?
- Tools that show usage
ps aux
PSAUX is another famous way to list everything. It adds two useful columns. Percent CPU, how busy the processor is with each process. And percent mem, how much memory it uses. On a busy server, this is where you'd spot the troublemaker.
ps aux USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND sam 1 0.0 0.0 4460 3236 ? Ss 09:00 0:00 bash -s sam 21 0.0 0.0 4624 3084 ? S 09:00 0:00 /bin/bash ./backup.sh sam 23 0.0 0.0 2868 1708 ? S 09:00 0:00 sleep 5000 sam 25 0.0 0.0 2868 1708 ? S 09:00 0:00 sleep 5 sam 36 0.0 0.0 8184 3908 ? R 09:00 0:00 ps aux
top: a live view
Top shows the same information, but live, updating every few seconds, with the busiest processes at the top. Press capital M to sort by memory, capital P to sort by processor, and Q to quit. Many people install H top, a friendlier, colourful version.
A snapshot of top
Top normally takes over the whole screen. Dash BN one prints a single snapshot instead, which is handy in scripts. The top lines summarise the whole system. The load average, the number of tasks, and how much memory is used.
top -bn1 | head -n 12 top - 09:00:00 up 1 day, 16:27, 0 user, load average: 1.73, 1.21, 1.46 Tasks: 6 total, 1 running, 5 sleeping, 0 stopped, 0 zombie %Cpu(s): 38.6 us, 37.3 sy, 0.0 ni, 22.9 id, 0.0 wa, 0.0 hi, 1.2 si, 0.0 st MiB Mem : 10943.3 total, 3979.6 free, 2203.5 used, 5009.8 buff/cache MiB Swap: 1024.0 total, 1024.0 free, 0.0 used. 8739.9 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 1 sam 20 0 4460 3240 2984 S 0.0 0.0 0:00.01 bash 21 sam 20 0 4624 3096 2840 S 0.0 0.0 0:00.00 backup.sh 23 sam 20 0 2868 1748 1748 S 0.0 0.0 0:00.00 sleep 27 sam 20 0 2868 1708 1708 S 0.0 0.0 0:00.00 sleep 36 sam 20 0 9216 4856 2936 R 0.0 0.0 0:00.01 top
Summary
PSAUX lists every process with its processor and memory use, and top shows them live. Q quits top. Next, running commands in the background.
Key takeaways- ps aux
- top, then q
- htop