top command

LINUX-Frequently used commands

top command Real-time display of running processes.
Syntax
top   [Option]
The top command displays the currently running processes in order of increasing CPU utilization.
The display will be updated in real time.
Enter “q” to exit.
Frequently used options
-d  <interval> Specify the interval to update in “ss.tt seconds”.
-n <Number of times>Specify the number of times to repeat the display
-b Batch mode
The key operation is not accepted and execution continues until the number of times specified by “-n” or until it is killed by “CTRL+C”.
Useful for saving top results to a file, for example.
-s Operates in secure mode(Does not accept “d” etc. during startup )
-U <user>,
-u <user> 
Specify the user to monitor by name or ID
-p  <Process ID>Specify the process ID to monitor
You can specify more than one, as in “-p number -p number” or “-p number, number”.(Spaces can be omitted)
-c Toggle the COMMAND column (far right) to show the program name or the command line(After starting up, use “c” to switch)
-i Toggles between showing and not showing idle processes that are not running(Switch with “i” after launch
-S  Specify the items to be used to sort the output(Default is CPU usage)
The names of the items that can be specified are confirmed by using “top -O
-w <Number of digits> Output width
Example: View file details.
$ su –  
Password:
#  top

top - 11:29:12 up 41 days, 23:11,  1 user,  load average: 0.00, 0.01, 0.05
Tasks:  79 total,   1 running,  78 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.0 us,  0.2 sy,  0.0 ni, 99.8 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem:   1026932 total,   868020 used,   158912 free,   172824 buffers
KiB Swap:  2094076 total,        0 used,  2094076 free,   549148 cached

  PID USER      PR  NI  VIRT  RES  SHR S  %CPU %MEM    TIME+  COMMAND                               
    1 root      20   0 10644  820  688 S   0.0  0.1   0:45.88 init                                  
    2 root      20   0     0    0    0 S   0.0  0.0   0:00.10 kthreadd                              
    3 root      20   0     0    0    0 S   0.0  0.0   0:05.73 ksoftirqd/0                           
    5 root      20   0     0    0    0 S   0.0  0.0   0:00.00 kworker/u:0                           
    6 root      rt   0     0    0    0 S   0.0  0.0   0:00.83 migration/0                           
    7 root      rt   0     0    0    0 S   0.0  0.0   0:21.80 watchdog/0                            
    8 root      rt   0     0    0    0 S   0.0  0.0   0:00.53 migration/1                           
   10 root      20   0     0    0    0 S   0.0  0.0   0:35.34 ksoftirqd/1                           
   11 root      20   0     0    0    0 S   0.0  0.0   2:11.60 kworker/0:1                           
   12 root      rt   0     0    0    0 S   0.0  0.0   0:21.28 watchdog/1                            
…  …
PIDProcess ID
USERUser name
PRProcess priority
NIProcess priority in nice values
VIRTMemory usage size (kb)
RESActual memory usage size (kb)
SHRShared memory size (kb)
SProcess status
R:Operation
S:Sleep
D:Sleep (not available)
T:Stop in progress
Z:Zombies
%CPUCPU usage
%MEMMemory usage
TIME+Process uptime
COMMANDProcess commands
タイトルとURLをコピーしました