Linux server performance monitoring requires understanding key metrics—CPU utilization, memory usage, disk I/O, and network throughput—and knowing which tools to use. The most effective administrators combine built-in commands like top, vmstat, and iostat with persistent monitoring solutions.
top Commandtop is your starting point. It's interactive, real-time, and available on every Linux system. Press Shift+M to sort by memory usage.
top
top -b -n 1 # single snapshot, non-interactive
vmstat Commandvmstat reports virtual memory statistics. High wa values indicate disk I/O bottlenecks.
vmstat 5 # update every 5 seconds
iostat CommandFor disk performance, iostat shows per-disk statistics including I/O operations, throughput, and wait times.
iostat -x 1
sar Commandsar collects and reports historical performance data. Unlike top, it maintains a running log ideal for trend analysis.
sar -u 1 5 # CPU utilization
sar -r # Memory and swap
sar -n DEV # Network device stats
For MySQL, query the PROCESSLIST to monitor active connections:
SHOW PROCESSLIST;
SHOW STATUS WHERE variable_name IN ('Threads_connected', 'Threads_cached');
For PostgreSQL:
SELECT datname, count(*) FROM pg_stat_activity GROUP BY datname;
sar, Prometheus, or Netdata to maintain historical records for trend analysis.