Monitoring System Health from the Terminal

Knowing the health of your system at a glance is a fundamental skill for anyone working in a terminal. Whether you’re debugging a slow application, planning storage capacity, or investigating why a server is unresponsive, these commands give you immediate visibility into what your system is doing.

System identity with uname

Start with the basics — what system are you on?

uname -a          # All system info (kernel, hostname, architecture)
uname -r          # Kernel version only
uname -m          # Machine architecture (x86_64, arm64, etc.)

Disk usage with df and du

df shows filesystem-level disk usage (how full are your drives), while du shows directory-level usage (what’s consuming the space):

df -h             # Disk usage for all mounted filesystems (human-readable)
df -h /           # Root partition only
du -sh .          # Size of current directory
du -sh *          # Size of each item in current directory
du -sh * | sort -rh  # Sorted by size, largest first

When a disk fills up, the first step is df -h to confirm which filesystem is full, then du -sh * | sort -rh in the relevant directory to find what’s consuming the space. This two-step pattern solves most disk space investigations.

Memory with free

free displays RAM usage, including buffers and cache:

free -h           # Memory usage in human-readable format

On Linux, high memory usage is not necessarily a problem. The kernel aggressively caches disk data in free RAM. What matters is the “available” column — that’s how much memory is actually available for new applications.

Process monitoring with top and htop

top provides a real-time view of running processes sorted by resource usage. htop is its more user-friendly successor:

top               # Real-time process viewer (built-in)
htop              # Interactive process viewer (install separately)

In htop: F6 to sort by different columns, F9 to kill a process, F5 for tree view, and F4 to filter by name. It’s one of the first tools worth installing on any new system.

Key metrics to watch in top/htop:

  • Load average (1/5/15 min) — sustained values above your CPU count indicate saturation
  • %CPU per process — identifies runaway processes
  • %MEM per process — identifies memory hogs
  • Swap usage — non-zero swap usage on a server often indicates a memory problem

These commands form the diagnostic toolkit you’ll reach for every time something feels wrong with a system.


Ready to practice? Explore the project repository for the full system monitoring reference and interactive exercises.

Monitoring System Health from the Terminal
Monitoring System Health from the Terminal