Process Monitoring Tools
Sometimes, when a process goes awry, you’ll want to find the pid
with ps aux
| grep <processname>
so that you can kill
it. Sometimes, you’ll need tools
that let you do more investigating…
You’re probably familiar with top
as a useful monitoring tool. It allows you
to see a list of processes and the resources they are using.
htop
is an improved version with a little more information.
Generally you use these tools when trying to diagnose a problem, or checking
performance. In which case, I find glances
the superior tool.
Glances shows you some very useful extra information, it colour-codes values, to highlight areas of interest or concern, and it will automatically sort processes by whichever column is most likely to be interesting to you.
deepthought.local (Darwin 11.6.8 64bit) Uptime: 4 days, 5:33:41
- 4.00/4.00GHz CPU ↑ 14.9% MEM - 57.7% SWAP - 1.2% LOAD - 8core
CPU [ 14.9%] user 9.0% total 32.0G total 1024M 1 min 3.47
MEM [ 57.7%] system 10.8% used 18.5G used 12.8M 5 min 2.82
SWAP [ 1.2%] free 13.5G free 1011M 15 min 2.57
NETWORK Rx/s Tx/s TASKS 684 (2721 thr), 684 run, 0 slp, 0 oth
awdl0 0b 0b
bridge100 0b 4Kb CPU% MEM% PID USER THR NI S
bridge101 8Kb 8Kb >89.1 4.8 14919 mark 12 0 R qemu-system-
en0 9.65Mb 124Kb 14.5 0.6 14677 mark 33 0 R Rancher Desk
en1 8Kb 0b 9.2 0.1 16607 mark 1 0 R Python /usr/
en2 0b 0b 8.2 1.3 16615 mark 20 0 R Rancher Desk
en3 0b 0b 2.1 8.0 58700 mark 80 0 R firefox
en7 0b 0b 1.4 1.0 57469 mark 31 0 R plugin-conta
llw0 0b 0b 0.6 0.1 14678 mark 10 0 R Rancher Desk
lo0 148Kb 148Kb 0.5 0.1 823 mark 7 0 R AMPLibraryAg
utun0 0b 0b 0.4 0.1 14679 mark 10 0 R Rancher Desk
utun1 0b 0b 0.3 0.1 694 mark 6 20 R Arq Agent
utun2 0b 0b 0.2 1.3 2686 mark 10 0 R AMPDevicesAg
utun4 0b 0b 0.2 0.5 14863 mark 25 0 R Rancher Desk
0.1 1.3 56006 mark 31 0 R plugin-conta
DISK I/O R/s W/s 0.1 1.1 38572 mark 31 0 R plugin-conta
disk0 12.8M 4.65M
For example, if your system is low in memory, it will sort by memory. However, if some processes are IO bound, it may sort by that instead. This makes it very useful in quickly scanning and system with all the useful information you might need, and rapidly identifying possible areas of concern. You can also regex-search processes simply by pressing enter.
Pressing Q
will show IRQ interrupt information. You can investigate further
Pressing via
cat /proc/interrupts. U
will swap the network section of the
Pressing `display from transmission rate (B/s) to total amount transmitted (MB).
Brilliant!
Bonus tool
For a more static overview of your system, everyone is using neofetch
these days. You can customise the data shown, and add a pretty logo
❯ neofetch
'c. [email protected]
,xNMM. ----------------------
.OMMMMo OS: macOS 11.6.8 20G730 x86_64
OMMM0, Host: iMac15,1
.;loddo:' loolloddol;. Kernel: 20.6.0
cKMMMMMMMMMMNWMMMMMMMMMM0: Uptime: 4 days, 5 hours, 17 mins
.KMMMMMMMMMMMMMMMMMMMMMMMWd. Packages: 248 (brew)
XMMMMMMMMMMMMMMMMMMMMMMMX. Shell: zsh 5.8
;MMMMMMMMMMMMMMMMMMMMMMMM: Resolution: 2560x1440@2x
:MMMMMMMMMMMMMMMMMMMMMMMM: DE: Aqua
.MMMMMMMMMMMMMMMMMMMMMMMMX. WM: Quartz Compositor
kMMMMMMMMMMMMMMMMMMMMMMMMWd. WM Theme: Blue (Dark)
.XMMMMMMMMMMMMMMMMMMMMMMMMMMk Terminal: tmux
.XMMMMMMMMMMMMMMMMMMMMMMMMK. CPU: Intel i7-4790K (8) @ 4.00GHz
kMMMMMMMMMMMMMMMMMMMMMMd GPU: AMD Radeon R9 M295X
;KMMMMMMMWXXWMMMMMMMk. Memory: 18175MiB / 32768MiB
.cooc,. .,coo:. GPU Driver: macOS Default Graphics Driver
CPU Usage: 4%
Disk (/): 14G / 932G (6%)
Local IP: 192.168.1.213
Public IP: xx.xx.xx.xx