• Increase font size
  • Default font size
  • Decrease font size
top

 Linux / Unix Command: top

 usage:  top -hv | -bcisSH -d delay -n iterations [-u user | -U user] -p pid [,pid ...]

 NAME

top - display top CPU processes

SYNOPSIS

top [-] [d delay] [p pid] [q] [c] [C] [S] [s] [i] [n iter] [b]

DESCRIPTION

top provides an ongoing look at processor activity in real time. It displays a listing of the most CPU-intensive tasks on the system, and can provide an interactive interface for manipulating processes. It can sort the tasks by CPU usage, memory usage and runtime. can be better configured than the standard top from the procps suite. Most features can either be selected by an interactive command or by specifying the feature in the personal or system-wide configuration file. See below for more information.

COMMAND-LINE OPTIONS

-d

Specifies the delay between screen updates. You can change this with the s interactive command.

-p

Monitor only processes with given process id. This flag can be given up to twenty times. This option is neither available interactively nor can it be put into the configuration file.

 

 

#top

top - 18:36:19 up  3:23,  1 user,  load average: 0.12, 0.07, 0.02

Tasks:  53 total,   2 running,  51 sleeping,   0 stopped,   0 zombie

Cpu(s):  0.0% us,  0.0% sy,  0.0% ni, 99.7% id,  0.0% wa,  0.3% hi,  0.0% si

Mem:    384672k total,   188856k used,   195816k free,    30748k buffers

Swap:   779144k total,        0k used,   779144k free,    96652k cached

 

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                         

   42 root      15   0     0    0    0 S  0.3  0.0   0:01.88 pdflush                                                                                         

10711 root      16   0  2812  976  772 R  0.3  0.3   0:00.03 top                                                                                             

    1 root      16   0  2528  620  532 S  0.0  0.2   0:01.57 init                                                                                            

    2 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 migration/0                                                                                     

    3 root      34  19     0    0    0 S  0.0  0.0   0:00.00 ksoftirqd/0                                                                                     

    4 root       5 -10     0    0    0 S  0.0  0.0   0:00.01 events/0                                                                                        

    5 root       5 -10     0    0    0 S  0.0  0.0   0:00.09 khelper       

 

 

 

how to show the free memory on a Linux system

 

[root@HCMRTG_BY_YaoBin ~]# free

             total       used       free     shared    buffers     cached

Mem:       3500784    3345300     155484          0      66100    3044924

-/+ buffers/cache:     234276    3266508

Swap:       779112         80     779032

 

If you prefer to see information in MB

[root@HCMRTG_BY_YaoBin ~]# free -m

             total       used       free     shared    buffers     cached

Mem:          3418       3278        139          0         64       2973

-/+ buffers/cache:        240       3178

Swap:          760          0        760

 

usage: free [-b|-k|-m|-g] [-l] [-o] [-t] [-s delay] [-c count] [-V]

  -b,-k,-m,-g show output in bytes, KB, MB, or GB

  -l show detailed low and high memory statistics

  -o use old format (no -/+buffers/cache line)

  -t display total for RAM + swap

  -s update every [delay] seconds

  -c update [count] times

  -V display version information and exit

 

 

How to get the CPU usage in Linux 

type " top"

 

[root@] ]# top

top - 23:03:23 up 6 days,  3:10,  1 user,  load average: 2.25, 1.55, 1.11

Tasks:  95 total,   1 running,  94 sleeping,   0 stopped,   0 zombie

Cpu(s):  2.6%us,  0.6%sy,  0.0%ni, 75.8%id, 20.9%wa,  0.0%hi,  0.1%si,  0.0%st

Mem:   3500784k total,  3355600k used,   145184k free,    90756k buffers

Swap:   779112k total,       80k used,   779032k free,  3042252k cached

 

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                         

    1 root      15   0  2064  620  532 S    0  0.0   0:02.24 init                                                                                            

    2 root      RT  -5     0    0    0 S    0  0.0   0:00.34 migration/0                                                                                     

    3 root      34  19     0    0    0 S    0  0.0   0:00.00 ksoftirqd/0                                                                                     

    4 root      RT  -5     0    0    0 S    0  0.0   0:00.00 watchdog/0                                                                                      

    5 root      RT  -5     0    0    0 S    0  0.0   0:00.30 migration/1                                                                                     

    6 root      34  19     0    0    0 S    0  0.0   0:00.00 ksoftirqd/1                                                                                     

    7 root      RT  -5     0    0    0 S    0  0.0   0:00.00 watchdog/1                                                                                      

    8 root      RT  -5     0    0    0 S    0  0.0   0:00.36 migration/2                                                                                     

    9 root      34  19     0    0    0 S    0  0.0   0:00.00 ksoftirqd/2                                                                                     

   10 root      RT  -5     0    0    0 S    0  0.0   0:00.00 watchdog/2                                                                                      

   11 root      RT  -5     0    0    0 S    0  0.0   0:00.28 migration/3                                                                                     

   12 root      34  19     0    0    0 S    0  0.0   0:00.00 ksoftirqd/3                                                                                     

   13 root      RT  -5     0    0    0 S    0  0.0   0:00.00 watchdog/3                                                                                      

   14 root      10  -5     0    0    0 S    0  0.0   0:00.00 events/0                                                                                        

   15 root      10  -5     0    0    0 S    0  0.0   0:00.01 events/1      

 

 

Login Form