Linux Command - top

top - display dynamic real-time view of the system summary info as well as a list of tasks currently being managed by the Linux kernel.

Syntax

1
top [OPTION]

Options

Option Description
-b batch mode. could be useful for sending output from top to other programs or to a file.
-d delay update time in seconds
-n iteration number of iteration before ending
-u uid or username Monitor only processes with an effective UID or user name matching that given
-p pid Monitor only processes with specified process IDs.

Example

Use top to Show System Info

1
top
Field Description
PID Process Id
USER user name
PR Priority
NI The nice value of the task. A negative nice value means higher priority
VIRT Virtual Image(kb)
RES Resident size(kb)
SHR Shared Mem size(kb)
S Process Status. ‘D’ = uninterruptible sleep ‘R’ = running ‘S’ = sleeping ‘T’ = traced or stopped ‘Z’ = zombie
%CPU CPU usage
%MEM Memory usage
TIME+ CPU Time, hundredths
COMMAND Display the command line used to start a task or the name of the associated program.

Show root user’s process

1
top -u root

Show a process’s info

1
top -p 3241

Reference