Linux command
top 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Example
top
Example
top -i
Example
top -u [username]
Sort
top -o %MEM
Example
top -Hp [process_id]
Example
top -p [1234],[5678]
Example
top -b -n 1
Example
top -d 5
Example
top -c
说明
top provides a dynamic real-time view of a running system. It displays system summary information and a list of processes or threads currently being managed by the Linux kernel. The display is updated periodically and can be customized interactively.
参数
- -b, --batch
- Run in batch mode (non-interactive), useful for piping output.
- -c, --cmdline-toggle
- Toggle between command line and program name display.
- -d _SECS_, --delay=SECS
- Set the delay between screen updates (default: 3.0 seconds).
- -e, --scale-task-mem
- Scale task memory values (k/m/g/t/p).
- -E, --scale-summary-mem
- Scale summary memory values (k/m/g/t/p/e).
- -H, --threads-show
- Display individual threads instead of processes.
- -i, --idle-toggle
- Hide idle and zombie processes.
- -n _NUMBER_, --iterations=NUMBER
- Set maximum number of iterations before exit.
- -o _FIELD_, --sort-override=FIELD
- Override the default sort field. Prefix with + or - for ascending/descending.
- -p _PIDLIST_, --pid=PIDLIST
- Monitor only specified process IDs (comma-separated).
- -S, --accum-time-toggle
- Toggle cumulative time mode, showing CPU time used by each process and its dead children.
- -s, --secure-mode
- Start top in secure mode, disabling potentially dangerous interactive commands.
- -u _USER_, --filter-only-euser=USER
- Show only processes for specified effective user.
- -U _USER_, --filter-any-user=USER
- Show processes for specified user (real, effective, saved, filesystem).
- -w _WIDTH_, --width=WIDTH
- Override screen width in batch mode (minimum 80 characters).
FAQ
What is the top command used for?
top provides a dynamic real-time view of a running system. It displays system summary information and a list of processes or threads currently being managed by the Linux kernel. The display is updated periodically and can be customized interactively.
How do I run a basic top example?
Run `top` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -b, --batch do in top?
Run in batch mode (non-interactive), useful for piping output.