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

  1. Run top to see a real-time process list
  2. Press Shift+M to sort by memory usage
  3. Press Shift+P to sort by CPU usage
  4. Install htop: sudo apt install htop
  5. Run htop and use arrow keys and F-keys to navigate and manage processes

Tips

  • htop allows mouse interaction and easier process killing
  • Use vmstat and iostat for deeper resource analysis
  • If a process is writing to disk unexpectedly, check how to manage file permissions