top command (Linux / bash / sh / zsh)
What it does
Monitor processes and system resource use in real time. When people search for the top command linux monitoring, they usually want top's everyday flags, safe examples, and how it differs from related tools. Below you'll find syntax, options, and copyable examples for Bash/sh/zsh.
Monitor processes and system resource use in real time.
Syntax
top [OPTION]...
Common options
| Flag / option | Meaning |
|---|---|
| -p PID | Monitor only selected process IDs. |
| -u USER | Show processes for one user. |
| -d SECONDS | Set the refresh delay. |
| -b | Use batch mode for redirected output. |
Practical examples
Open monitor
top
Starts the interactive process display.
Watch a process
top -p 4242
Limits updates to PID 4242.
Capture snapshot
top -b -n 1 > top.txt
Writes one noninteractive snapshot.
Common mistakes
- Reading load average as CPU percentage; they measure different things.
- Redirecting interactive top without enabling batch mode.
Related commands
- psDisplay a snapshot of running processes.
- killSend a signal to one or more processes.
- dfReport free and used space for mounted filesystems.
- Get-ProcessRetrieve local or remote process objects and resource metrics.
- tasklistList local or remote running processes with selectable fields and filters.
- Stop-ProcessStop one or more local processes by name, ID, or pipeline input.
- taskkillEnd processes by process ID or executable image name.
FAQ
What does top do in Linux?
Monitor processes and system resource use in real time.
How do I use top from the terminal?
Start with `top [OPTION]...`, then choose only the options needed for the task.
What is a practical top example?
Try `top` — Starts the interactive process display.
Can I use top in a shell script?
Yes. top works in Bash, sh, and Zsh, but scripts should handle quoting, errors, and command output explicitly.
Browse the full Linux and Windows command reference to search more bash, CMD, PowerShell, Conda, and GitHub CLI commands.