top
Quick Reference
Command Name:
top
Category:
process management
Platform:
Linux/Unix
Basic Usage:
Common Use Cases
- 1
Process monitoring
Display dynamic information about running processes
- 2
Resource usage
Monitor CPU, memory, and I/O usage of processes
- 3
Troubleshooting
Diagnose issues with running processes
- 4
Scripting
Use in shell scripts to monitor and manage processes
Syntax
top [options]
Options
Option | Description |
---|---|
-b | Batch mode, useful for sending output to other programs or to a file |
-c | Command line/program name toggle (shows full command line) |
-d seconds | Specify delay between screen updates |
-H | Show individual threads instead of processes |
-i | Ignore idle and zombie processes |
-n iterations | Specify number of updates before exiting |
-o field | Sort on specified field (e.g., %CPU, %MEM) |
-p pid[,pid...] | Monitor only specific process IDs |
-s | Secure mode, disables interactive commands |
-u username | Show only processes owned by specified user |
-w | Wide output mode, useful for full command lines |
Examples
How to Use These Examples
The examples below show common ways to use the top
command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.
Basic Usage:
top
Launch top with default settings showing real-time process information.
top -u username
Show only processes owned by a specific user.
top -p 1234,5678
Monitor only specific processes by their PIDs.
Runtime Sorting:
top
Then press:
Interactive sorting during runtime by pressing various keys.