top (watch system resource usage)
This command provides a real-time view of the programs running on your system along with their CPU and memory usage. It's mostly used without any options:
You'll see a table of processes that is updated every few seconds. They are sorted by their CPU usage, so the most CPU-intensive processes appear at the top of the table. That's how top got its name. The most important table columns are:
- PID: The process ID number
- %CPU: The percentage of CPU utilization caused by the process
- %MEM: The percentage of working memory that the process occupies
When your graphical desktop environment responds slowly and you suspect that a process has gone wild, fire up top. Often the first table entry will show a process that's eating up 90% or more of your CPU's calculating time. You can then quit top (by pressing q) and terminate the process, for example by invoking →kill with the PID from top's table.