Lesson 9.2: Monitoring the system: top, uptime and free
Load average and what it means relative to the number of CPUs, free memory versus available memory, and top: its summary lines, its process table, sorting by CPU and memory, and using it non-interactively in scripts.
18 min
You will learn to
- Read uptime and the three load averages
- Compare load with the number of CPUs (nproc)
- Read free -h and explain 'available'
- Read top's summary and process table
- Sort top by CPU and memory and leave it
- Use top -b and ps --sort in scripts
Key terms
- CPU core
- One processing unit; each core runs one process at a time. nproc prints how many the system has.
- Load average
- The average number of processes running or waiting to run (plus those waiting for disk) over the last 1, 5 and 15 minutes. Compare it with the number of cores.
- RAM, used, free, available
- used is memory held by programs; free is completely unused; available is what programs could get right now, including cache Linux can give back.
- Swap
- Disk space used as overflow when RAM is full. Much slower than RAM; heavy swapping makes a system crawl.
- top
- An interactive, live process viewer. Keys: P sort by CPU, M by memory, k send a signal, u filter by user, q quit.
← Processes and ps · All lessons · Signals: kill, killall and pkill →