How to monitor system resources with top and htop
· Category: Linux
Short answer
Run top for a built-in process viewer or install htop for an interactive, colorized interface. Both show CPU, memory, and process details. For managing services consuming resources, see how to use systemd. For finding large files using disk space, see how to use find command.
Steps
- Run
topto see a real-time process list - Press
Shift+Mto sort by memory usage - Press
Shift+Pto sort by CPU usage - Install htop:
sudo apt install htop - Run
htopand use arrow keys and F-keys to navigate and manage processes
Tips
- htop allows mouse interaction and easier process killing
- Use
vmstatandiostatfor deeper resource analysis - If a process is writing to disk unexpectedly, check how to manage file permissions