[root@micrsvr ~]# top
top - 12:21:15 up 13 days, 15:53, 5 users, load average: 0.24, 0.25, 0.19
Tasks: 262 total, 1 running, 261 sleeping, 0 stopped, 0 zombie
Cpu(s): 3.8%us, 1.4%sy, 0.0%ni, 91.7%id, 3.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 2043324k total, 1972360k used, 70964k free, 101808k buffers
Swap: 4192248k total, 31944k used, 4160304k free, 1275172k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
8739 root 20 0 288m 12m 9496 S 1.0 0.6 0:00.35 gnome-terminal
12 root 20 0 0 0 0 S 0.3 0.0 5:40.41 events/1
6875 root 20 0 98860 4712 2908 S 0.3 0.2 0:01.95 sshd
8933 root 20 0 15220 1360 944 R 0.3 0.1 0:00.02 top
1 root 20 0 19396 1292 1080 S 0.0 0.1 0:09.82 init
2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd
3 root RT 0 0 0 0 S 0.0 0.0 0:00.04 migration/0
4 root 20 0 0 0 0 S 0.0 0.0 0:00.01 ksoftirqd/0
5 root RT 0 0 0 0 S 0.0 0.0 0:00.00 migration/0
6 root RT 0 0 0 0 S 0.0 0.0 0:00.00 watchdog/0
7 root RT 0 0 0 0 S 0.0 0.0 0:00.05 migration/1
8 root RT 0 0 0 0 S 0.0 0.0 0:00.00 migration/1
9 root 20 0 0 0 0 S 0.0 0.0 0:00.29 ksoftirqd/1
10 root RT 0 0 0 0 S 0.0 0.0 0:00.00 watchdog/1
11 root 20 0 0 0 0 S 0.0 0.0 0:00.03 events/0
13 root 20 0 0 0 0 S 0.0 0.0 0:00.00 cpuset
14 root 20 0 0 0 0 S 0.0 0.0 0:00.00 khelper
Sort top Output command
=============================================
We can sort top output command by pressing O while it is running.
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
8973 oracle 20 0 1126m 23m 21m R 4.3 1.2 0:00.13 oracle
6875 root 20 0 98860 4712 2908 S 1.0 0.2 0:02.01 sshd
8739 root 20 0 288m 12m 9496 S 0.7 0.6 0:00.42 gnome-terminal
12 root 20 0 0 0 0 S 0.3 0.0 5:40.44 events/1
2859 oracle 20 0 1110m 16m 14m S 0.3 0.8 2:25.11 oracle
6921 root 20 0 239m 10m 7564 S 0.3 0.5 0:00.26 metacity
8950 root 20 0 15220 1356 944 R 0.3 0.1 0:00.10 top
1 root 20 0 19396 1288 1076 S 0.0 0.1 0:09.82 init
2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd
3 root RT 0 0 0 0 S 0.0 0.0 0:00.04 migration/0
4 root 20 0 0 0 0 S 0.0 0.0 0:00.01 ksoftirqd/0
5 root RT 0 0 0 0 S 0.0 0.0 0:00.00 migration/0
6 root RT 0 0 0 0 S 0.0 0.0 0:00.00 watchdog/0
7 root RT 0 0 0 0 S 0.0 0.0 0:00.05 migration/1
8 root RT 0 0 0 0 S 0.0 0.0 0:00.00 migration/1
9 root 20 0 0 0 0 S 0.0 0.0 0:00.30 ksoftirqd/1
10 root RT 0 0 0 0 S 0.0 0.0 0:00.00 watchdog/1
Current Sort Field: A for window 1:Def
[root@micrsvr ~]# top
Select sort field via field letter, type any other key to return
* A: PID = Process Id v: nDRT = Dirty Pages count
b: PPID = Parent Process Pid w: S = Process Status
c: RUSER = Real user name x: COMMAND = Command name/line
d: UID = User Id y: WCHAN = Sleeping in Function
e: USER = User Name z: Flags = Task Flags <sched.h>
f: GROUP = Group Name
g: TTY = Controlling Tty Note1:
h: PR = Priority If a selected sort field can't be
i: NI = Nice value shown due to screen width or your
j: P = Last used cpu (SMP) field order, the '<' and '>' keys
k: %CPU = CPU usage will be unavailable until a field
l: TIME = CPU Time within viewable range is chosen.
m: TIME+ = CPU Time, hundredths
n: %MEM = Memory usage (RES) Note2:
o: VIRT = Virtual Image (kb) Field sorting uses internal values,
p: SWAP = Swapped size (kb) not those in column display. Thus,
q: RES = Resident size (kb) the TTY & WCHAN fields will violate
r: CODE = Code size (kb) strict ASCII collating sequence.
s: DATA = Data+Stack size (kb) (shame on you if WCHAN is chosen)
t: SHR = Shared Mem size (kb)
u: nFLT = Page Fault count
top - 12:22:37 up 13 days, 15:54, 5 users, load average: 0.33, 0.28, 0.20
Tasks: 263 total, 2 running, 261 sleeping, 0 stopped, 0 zombie
Cpu(s): 1.0%us, 0.5%sy, 0.0%ni, 98.3%id, 0.2%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 2043324k total, 1972384k used, 70940k free, 97596k buffers
Swap: 4192248k total, 31944k used, 4160304k free, 1278756k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
16672 root 18 -2 11292 696 264 S 0.0 0.0 0:00.00 udevd
16663 root 18 -2 12480 2352 544 S 0.0 0.1 0:00.02 udevd
11415 oracle 20 0 90320 2424 1964 S 0.0 0.1 0:00.00 gconf-helper
11412 oracle 9 -11 429m 3848 2496 S 0.0 0.2 0:00.11 pulseaudio
11159 oracle 20 0 207m 5960 2688 S 0.0 0.3 0:24.42 tnslsnr
8986 oracle 20 0 1109m 12m 10m R 1.7 0.6 0:00.05 oracle
8950 root 20 0 15220 1360 948 R 0.3 0.1 0:00.15 top
8741 root 20 0 105m 1804 1444 S 0.0 0.1 0:00.01 bash
8740 root 20 0 8280 692 596 S 0.0 0.0 0:00.00 gnome-pty-helpe
8739 root 20 0 288m 12m 9496 S 0.0 0.6 0:00.44 gnome-terminal
7412 root 20 0 280m 11m 8552 S 0.0 0.6 0:00.07 notification-da
7331 root 20 0 211m 2868 2416 S 0.0 0.1 0:00.00 gvfsd-computer
7325 root 20 0 129m 1768 1460 S 0.0 0.1 0:00.00 gvfsd-metadata
7322 root 20 0 131m 2176 1868 S 0.0 0.1 0:00.00 gvfsd-burn
7320 root 20 0 225m 5820 4656 S 0.0 0.3 0:00.00 ibus-x11
7318 root 20 0 335m 23m 11m S 0.0 1.2 0:00.29 python
7316 root 20 0 150m 3164 2648 S 0.0 0.2 0:00.00 ibus-gconf
Kill a process.
==================================================
If you want to kill a process then first note down the PID and then while running top press "k" which will ask you for the process id. Type the process ID.You can see killed successfully.
[root@micrsvr ~]# top
top - 12:27:56 up 13 days, 15:59, 5 users, load average: 0.05, 0.11, 0.14
Tasks: 262 total, 1 running, 261 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.2%us, 0.1%sy, 0.0%ni, 99.4%id, 0.3%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 2043324k total, 1976272k used, 67052k free, 96232k buffers
Swap: 4192248k total, 31944k used, 4160304k free, 1288384k cached
PID to kill: 2589
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2589 oracle 20 0 1109m 15m 13m S 2.0 0.8 0:40.34 oracle
9157 root 20 0 15216 1232 832 R 2.0 0.1 0:00.01 top
1 root 20 0 19396 1276 1064 S 0.0 0.1 0:09.84 init
2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd
3 root RT 0 0 0 0 S 0.0 0.0 0:00.04 migration/0
4 root 20 0 0 0 0 S 0.0 0.0 0:00.01 ksoftirqd/0
5 root RT 0 0 0 0 S 0.0 0.0 0:00.00 migration/0
6 root RT 0 0 0 0 S 0.0 0.0 0:00.00 watchdog/0
7 root RT 0 0 0 0 S 0.0 0.0 0:00.05 migration/1
8 root RT 0 0 0 0 S 0.0 0.0 0:00.00 migration/1
9 root 20 0 0 0 0 S 0.0 0.0 0:00.30 ksoftirqd/1
10 root RT 0 0 0 0 S 0.0 0.0 0:00.00 watchdog/1
11 root 20 0 0 0 0 S 0.0 0.0 0:00.03 events/0
12 root 20 0 0 0 0 S 0.0 0.0 5:40.60 events/1
13 root 20 0 0 0 0 S 0.0 0.0 0:00.00 cpuset
14 root 20 0 0 0 0 S 0.0 0.0 0:00.00 khelper
15 root 20 0 0 0 0 S 0.0 0.0 0:00.00 netns