something about top command -
The top program provides a dynamic real-time view of a running system. It can display system summary information as well as a
list of processes or threads currently being managed by the kernel. The types of system summary information shown and the types,
order and size of information displayed for tasks are all user-configurable.
Sorting with -O (Uppercase Letter ‘O’).
Press (Shift+O) to Sort field via field letter, for example press ‘a‘ letter to sort process with PID (Process ID).
Type any key to return to main top window with sorted PID order as shown in below screen. Press ‘q‘ to quit exit the window.
Current Sort Field: K for window 1:Def
Select sort field via field letter, type any other key to return
a: PID = Process Id not those in column display. Thus,
b: PPID = Parent Process Pid the TTY & WCHAN fields will violate
c: RUSER = Real user name strict ASCII collating sequence.
d: UID = User Id (shame on you if WCHAN is chosen)
e: USER = User Name
f: GROUP = Group Name
g: TTY = Controlling Tty
h: PR = Priority
2-. Display Specific User Process
Use top command with ‘u‘ option will display specific User process details.
[oracle@swati_test ~]$ top
top - 11:13:29 up 124 days, 23:27, 2 users, load average: 0.00, 0.00, 0.00
Tasks: 391 total, 1 running, 390 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.0%us, 0.0%sy, 0.0%ni,100.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 8098892k total, 8050776k used, 48116k free, 113992k buffers
Swap: 16217580k total, 241316k used, 15976264k free, 6870532k cached
Which user (blank for all): U
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2366 oracle 15 0 12996 1340 812 R 0.3 0.0 0:00.04 top
1 root 15 0 10348 628 568 S 0.0 0.0 0:03.12 init
2 root RT -5 0 0 0 S 0.0 0.0 0:00.56 migration/0
3 root 34 19 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/0
4 root RT -5 0 0 0 S 0.0 0.0 0:00.00 watchdog/0
3- Highlight Running Process in Top
Press ‘z‘ option in running top command will display running process in color which may help you to identified running process
easily.
[oracle@swati_test ~]$ top
top - 11:15:38 up 124 days, 23:29, 2 users, load average: 0.00, 0.00, 0.00
Tasks: 391 total, 2 running, 389 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.0%us, 0.0%sy, 0.0%ni,100.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 8098892k total, 8052064k used, 46828k free, 114832k buffers
Swap: 16217580k total, 241316k used, 15976264k free, 6870516k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2369 oracle 15 0 12996 1344 816 R 0.3 0.0 0:00.14 top
1 root 15 0 10348 628 568 S 0.0 0.0 0:03.12 init
2 root RT -5 0 0 0 S 0.0 0.0 0:00.56 migration/0
3 root 34 19 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/0
4 root RT -5 0 0 0 S 0.0 0.0 0:00.00 watchdog/0
5 root RT -5 0 0 0 S 0.0 0.0 0:00.70 migration/1
4- Shows Absolute Path of Processes
Press ‘c‘ option in running top command, it will display absolute path of running process.
top - 11:17:22 up 43 days, 8:45, 2 users, load average: 8.21, 8.77, 8.92
Tasks: 904 total, 9 running, 895 sleeping, 0 stopped, 0 zombie
Cpu(s): 15.1%us, 2.1%sy, 0.0%ni, 81.9%id, 0.7%wa, 0.0%hi, 0.2%si, 0.0%st
Mem: 16226808k total, 14786320k used, 1440488k free, 18980k buffers
Swap: 37758728k total, 920880k used, 36837848k free, 11425508k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
157616 oracle 20 0 4246m 2.6g 2.5g R 49.8 16.5 108:58.69 oracletest (LOCAL=NO)
172755 oracle 20 0 4528m 1.9g 1.6g S 32.7 12.3 78:40.91 oracletest (LOCAL=NO)
172753 oracle 20 0 4304m 1.7g 1.7g D 30.4 11.3 66:19.20 oracletest (LOCAL=NO)
155644 oracle 20 0 4246m 2.0g 2.0g R 20.8 13.0 9:12.19 oracletest (LOCAL=NO)
156643 oracle 20 0 4262m 2.1g 2.1g R 19.8 13.5 128:06.64 oracletest (LOCAL=NO)
5-
Change Delay or Set ‘Screen Refresh Interval’ in Top
By default screen refresh interval is 3.0 seconds, same can be change pressing ‘d‘ option in running top command and change
it as desired as shown below.
top - 11:20:50 up 43 days, 8:49, 2 users, load average: 8.96, 8.72, 8.85
Tasks: 906 total, 5 running, 901 sleeping, 0 stopped, 0 zombie
Cpu(s): 21.9%us, 2.6%sy, 0.0%ni, 74.8%id, 0.6%wa, 0.0%hi, 0.2%si, 0.0%st
Mem: 16226808k total, 14889092k used, 1337716k free, 20340k buffers
Swap: 37758728k total, 920880k used, 36837848k free, 11522528k cached
Change delay from 10.0 to:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
157616 oracle 20 0 4246m 2.6g 2.5g R 84.7 16.5 111:27.25 oracle
172755 oracle 20 0 4528m 1.9g 1.6g D 68.0 12.3 80:23.74 oracle
172753 oracle 20 0 4304m 1.8g 1.7g S 57.4 11.3 67:47.44 oracle
6-Kill running process with argument ‘k’
You can kill a process after finding PID of process by pressing ‘k‘ option in running top command without
exiting from top window as shown below.
7-Sort by CPU Utilisation
Press (Shift+P) to sort processes as per CPU utilization. See screenshot below.
Tasks: 913 total, 6 running, 907 sleeping, 0 stopped, 0 zombie
Cpu(s): 14.3%us, 1.5%sy, 0.0%ni, 82.6%id, 1.3%wa, 0.0%hi, 0.2%si, 0.0%st
Mem: 16226808k total, 15050824k used, 1175984k free, 21284k buffers
Swap: 37758728k total, 920880k used, 36837848k free, 11679112k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
157616 oracle 20 0 4246m 2.6g 2.5g R 71.5 16.5 112:56.40 oracle
156862 oracle 20 0 4245m 2.6g 2.6g R 69.6 16.5 108:25.97 oracle
172753 oracle 20 0 4304m 1.8g 1.7g R 18.0 11.3 68:37.61 oracle
172755 oracle 20 0 4528m 1.9g 1.6g R 17.4 12.3 81:22.37 oracle
8- Renice a Process
You can use ‘r‘ option to change the priority of the process also called Renice.
9-Save Top Command Results
Press (Shift+W) to save the running top command results under /root/.toprc.
10- Getting Top Command Help
Press ‘h‘ option to obtain the top command help.
Help for Interactive Commands - procps version 3.2.8
Window 1:Def: Cumulative mode Off. System: Delay 3.0 secs; Secure mode Off.
Z,B Global: 'Z' change color mappings; 'B' disable/enable bold
l,t,m Toggle Summaries: 'l' load avg; 't' task/cpu stats; 'm' mem info
1,I Toggle SMP view: '1' single/separate states; 'I' Irix/Solaris mode
f,o . Fields/Columns: 'f' add or remove; 'o' change display order
F or O . Select sort field
<,> . Move sort field: '<' next col left; '>' next col right
R,H . Toggle: 'R' normal/reverse sort; 'H' show threads
c,i,S . Toggle: 'c' cmd name/line; 'i' idle tasks; 'S' cumulative time
x,y . Toggle highlights: 'x' sort field; 'y' running tasks
z,b . Toggle: 'z' color/mono; 'b' bold/reverse (only if 'x' or 'y')
u . Show specific user only
n or # . Set maximum tasks displayed
k,r Manipulate tasks: 'k' kill; 'r' renice
d or s Set update interval
W Write configuration file
q Quit
( commands shown with '.' require a visible task display window )
Press 'h' or '?' for help with Windows,
any other key to continue
11-. Exit Top Command After Specific repetition
Top output keep refreshing until you press ‘q‘. With below command top command will automatically exit after 10 number of repetition
The top program provides a dynamic real-time view of a running system. It can display system summary information as well as a
list of processes or threads currently being managed by the kernel. The types of system summary information shown and the types,
order and size of information displayed for tasks are all user-configurable.
Sorting with -O (Uppercase Letter ‘O’).
Press (Shift+O) to Sort field via field letter, for example press ‘a‘ letter to sort process with PID (Process ID).
Type any key to return to main top window with sorted PID order as shown in below screen. Press ‘q‘ to quit exit the window.
Current Sort Field: K for window 1:Def
Select sort field via field letter, type any other key to return
a: PID = Process Id not those in column display. Thus,
b: PPID = Parent Process Pid the TTY & WCHAN fields will violate
c: RUSER = Real user name strict ASCII collating sequence.
d: UID = User Id (shame on you if WCHAN is chosen)
e: USER = User Name
f: GROUP = Group Name
g: TTY = Controlling Tty
h: PR = Priority
2-. Display Specific User Process
Use top command with ‘u‘ option will display specific User process details.
[oracle@swati_test ~]$ top
top - 11:13:29 up 124 days, 23:27, 2 users, load average: 0.00, 0.00, 0.00
Tasks: 391 total, 1 running, 390 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.0%us, 0.0%sy, 0.0%ni,100.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 8098892k total, 8050776k used, 48116k free, 113992k buffers
Swap: 16217580k total, 241316k used, 15976264k free, 6870532k cached
Which user (blank for all): U
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2366 oracle 15 0 12996 1340 812 R 0.3 0.0 0:00.04 top
1 root 15 0 10348 628 568 S 0.0 0.0 0:03.12 init
2 root RT -5 0 0 0 S 0.0 0.0 0:00.56 migration/0
3 root 34 19 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/0
4 root RT -5 0 0 0 S 0.0 0.0 0:00.00 watchdog/0
3- Highlight Running Process in Top
Press ‘z‘ option in running top command will display running process in color which may help you to identified running process
easily.
[oracle@swati_test ~]$ top
top - 11:15:38 up 124 days, 23:29, 2 users, load average: 0.00, 0.00, 0.00
Tasks: 391 total, 2 running, 389 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.0%us, 0.0%sy, 0.0%ni,100.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 8098892k total, 8052064k used, 46828k free, 114832k buffers
Swap: 16217580k total, 241316k used, 15976264k free, 6870516k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2369 oracle 15 0 12996 1344 816 R 0.3 0.0 0:00.14 top
1 root 15 0 10348 628 568 S 0.0 0.0 0:03.12 init
2 root RT -5 0 0 0 S 0.0 0.0 0:00.56 migration/0
3 root 34 19 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/0
4 root RT -5 0 0 0 S 0.0 0.0 0:00.00 watchdog/0
5 root RT -5 0 0 0 S 0.0 0.0 0:00.70 migration/1
4- Shows Absolute Path of Processes
Press ‘c‘ option in running top command, it will display absolute path of running process.
top - 11:17:22 up 43 days, 8:45, 2 users, load average: 8.21, 8.77, 8.92
Tasks: 904 total, 9 running, 895 sleeping, 0 stopped, 0 zombie
Cpu(s): 15.1%us, 2.1%sy, 0.0%ni, 81.9%id, 0.7%wa, 0.0%hi, 0.2%si, 0.0%st
Mem: 16226808k total, 14786320k used, 1440488k free, 18980k buffers
Swap: 37758728k total, 920880k used, 36837848k free, 11425508k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
157616 oracle 20 0 4246m 2.6g 2.5g R 49.8 16.5 108:58.69 oracletest (LOCAL=NO)
172755 oracle 20 0 4528m 1.9g 1.6g S 32.7 12.3 78:40.91 oracletest (LOCAL=NO)
172753 oracle 20 0 4304m 1.7g 1.7g D 30.4 11.3 66:19.20 oracletest (LOCAL=NO)
155644 oracle 20 0 4246m 2.0g 2.0g R 20.8 13.0 9:12.19 oracletest (LOCAL=NO)
156643 oracle 20 0 4262m 2.1g 2.1g R 19.8 13.5 128:06.64 oracletest (LOCAL=NO)
5-
Change Delay or Set ‘Screen Refresh Interval’ in Top
By default screen refresh interval is 3.0 seconds, same can be change pressing ‘d‘ option in running top command and change
it as desired as shown below.
top - 11:20:50 up 43 days, 8:49, 2 users, load average: 8.96, 8.72, 8.85
Tasks: 906 total, 5 running, 901 sleeping, 0 stopped, 0 zombie
Cpu(s): 21.9%us, 2.6%sy, 0.0%ni, 74.8%id, 0.6%wa, 0.0%hi, 0.2%si, 0.0%st
Mem: 16226808k total, 14889092k used, 1337716k free, 20340k buffers
Swap: 37758728k total, 920880k used, 36837848k free, 11522528k cached
Change delay from 10.0 to:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
157616 oracle 20 0 4246m 2.6g 2.5g R 84.7 16.5 111:27.25 oracle
172755 oracle 20 0 4528m 1.9g 1.6g D 68.0 12.3 80:23.74 oracle
172753 oracle 20 0 4304m 1.8g 1.7g S 57.4 11.3 67:47.44 oracle
6-Kill running process with argument ‘k’
You can kill a process after finding PID of process by pressing ‘k‘ option in running top command without
exiting from top window as shown below.
7-Sort by CPU Utilisation
Press (Shift+P) to sort processes as per CPU utilization. See screenshot below.
Tasks: 913 total, 6 running, 907 sleeping, 0 stopped, 0 zombie
Cpu(s): 14.3%us, 1.5%sy, 0.0%ni, 82.6%id, 1.3%wa, 0.0%hi, 0.2%si, 0.0%st
Mem: 16226808k total, 15050824k used, 1175984k free, 21284k buffers
Swap: 37758728k total, 920880k used, 36837848k free, 11679112k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
157616 oracle 20 0 4246m 2.6g 2.5g R 71.5 16.5 112:56.40 oracle
156862 oracle 20 0 4245m 2.6g 2.6g R 69.6 16.5 108:25.97 oracle
172753 oracle 20 0 4304m 1.8g 1.7g R 18.0 11.3 68:37.61 oracle
172755 oracle 20 0 4528m 1.9g 1.6g R 17.4 12.3 81:22.37 oracle
8- Renice a Process
You can use ‘r‘ option to change the priority of the process also called Renice.
9-Save Top Command Results
Press (Shift+W) to save the running top command results under /root/.toprc.
10- Getting Top Command Help
Press ‘h‘ option to obtain the top command help.
Help for Interactive Commands - procps version 3.2.8
Window 1:Def: Cumulative mode Off. System: Delay 3.0 secs; Secure mode Off.
Z,B Global: 'Z' change color mappings; 'B' disable/enable bold
l,t,m Toggle Summaries: 'l' load avg; 't' task/cpu stats; 'm' mem info
1,I Toggle SMP view: '1' single/separate states; 'I' Irix/Solaris mode
f,o . Fields/Columns: 'f' add or remove; 'o' change display order
F or O . Select sort field
<,> . Move sort field: '<' next col left; '>' next col right
R,H . Toggle: 'R' normal/reverse sort; 'H' show threads
c,i,S . Toggle: 'c' cmd name/line; 'i' idle tasks; 'S' cumulative time
x,y . Toggle highlights: 'x' sort field; 'y' running tasks
z,b . Toggle: 'z' color/mono; 'b' bold/reverse (only if 'x' or 'y')
u . Show specific user only
n or # . Set maximum tasks displayed
k,r Manipulate tasks: 'k' kill; 'r' renice
d or s Set update interval
W Write configuration file
q Quit
( commands shown with '.' require a visible task display window )
Press 'h' or '?' for help with Windows,
any other key to continue
11-. Exit Top Command After Specific repetition
Top output keep refreshing until you press ‘q‘. With below command top command will automatically exit after 10 number of repetition
No comments:
Post a Comment