Process and System Monitoring Commands
Linux Mastery: Essential Linux Tools and Techniques : Part 2 of 6
Monitoring your system is important. Through system monitoring we can find problems on the server, hopefully before they impact performance. Today we will examine the following tools:
- top
- htop
- ps
- kill
- nice / renice
- uptime
- vmstat
top
top is a real-time system monitoring tool.
Basic Usage:
top
top has several flags which alter output; be sure to become familar with them.
Top will show the follwing information:
- CPU
- memory usage
- active processes
Key Interactions:
- q to quit
- k to kill a process
- 1 to display per-core CPU usage
htop
Htop is like top, but is more visual & interactive. It allows scrolling, and color coded resource tracking.
Basic Usage:
htop
Key Features:
- Navigate with arrow keys
- Press F9 to kill a process
- Press F6 to sort columns
ps
Ps displays a snapshot of currently running processes.
Basic Usage:
ps aux
You can filter by username:
ps aux -u username
You can also search by process name:
ps aux | grep process_name
kill
Kill terminates processes by PID:
kill PID
To force kill a process:
kill -9 PID
You can find the PID with the ps command:
ps aux | grep process_name
nice & renice
Adjusts process priority (lower = higher priority)
Start a process with priority:
nice -n 10 command
Change priority of an existing process:
renice 5 -p PID
uptime
Displays system uptime, number of users, and load averages
Usage:
uptime
vmstat
Reports system performance metrics (CPU, memory, I/O)
Usage:
vmstat 2 5
(updates every 2 seconds, 5 times)
Final Thoughts
Use htop over top for a more intuitive process view
If kill doesn’t work, escalate to kill -9 PID
Monitor load averages in uptime—high values indicate potential slowdowns
Use vmstat to detect memory swapping and disk I/O bottlenecks
Always check ps aux before terminating processes to avoid killing critical system tasks
Regular use of these commands hones your ability to react swiftly and effectively.