Linux top Command
In most Unix-like operating systems, the top command is a system monitor tool that produces a frequently-updated list of processes. By default, the processes are ordered by percentage of CPU usage, with only the "top" CPU consumers shown. top shows how much processing power and memory are being used, as well as other information about the running processes. Some versions of top allow extensive customization of the display, such as choice of columns or sorting method.top is useful for system administrators, as it shows which users and processes are consuming the most system resources at any given time.
The ps command is similar to top, but instead produces a one-time "snapshot" list of processes
#top
top - 12:59:35 up 3:25, 8 users, load average: 0.07, 0.17, 0.24 Tasks: 169 total, 2 running, 166 sleeping, 0 stopped, 1 zombie Cpu(s): 0.7%us, 1.3%sy, 0.0%ni, 98.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st Mem: 2037228k total, 1970468k used, 66760k free, 2572k buffers Swap: 8193108k total, 188k used, 8192920k free, 176744k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 2579 root 18 0 1607m 627m 8716 S 1.3 31.6 17:10.36 java 5732 root 15 0 650m 63m 16m S 1.0 3.2 2:57.50 VirtualBox 1 root 15 0 2160 628 544 S 0.0 0.0 0:00.21 init 2 root RT -5 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 RT -5 0 0 0 S 0.0 0.0 0:00.00 watchdog/0 5 root 10 -5 0 0 0 S 0.0 0.0 0:00.01 events/0 6 root 15 -5 0 0 0 S 0.0 0.0 0:00.00 khelper 7 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 kthread 10 root 10 -5 0 0 0 S 0.0 0.0 0:00.05 kblockd/0 11 root 20 -5 0 0 0 S 0.0 0.0 0:00.00 kacpid 141 root 20 -5 0 0 0 S 0.0 0.0 0:00.00 cqueue/0 144 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 khubd 146 root 12 -5 0 0 0 S 0.0 0.0 0:00.00 kseriod 207 root 22 0 0 0 0 S 0.0 0.0 0:00.00 khungtaskd 208 root 15 0 0 0 0 S 0.0 0.0 0:00.06 pdflush 209 root 15 0 0 0 0 S 0.0 0.0 0:00.03 pdflush 210 root 10 -5 0 0 0 S 0.0 0.0 0:00.64 kswapd0 211 root 20 -5 0 0 0 S 0.0 0.0 0:00.00 aio/0 368 root 11 -5 0 0 0 S 0.0 0.0 0:00.00 kpsmoused 391 root 10 -5 0 0 0 S 0.0 0.0 0:00.42 ata/0 392 root 16 -5 0 0 0 S 0.0 0.0 0:00.00 ata_aux 395 root 13 -5 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_0 396 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_1 397 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_2 398 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_3 401 root 10 -5 0 0 0 S 0.0 0.0 0:00.49 scsi_eh_4 402 root 11 -5 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_5 405 root 12 -5 0 0 0 S 0.0 0.0 0:00.00 kstriped 414 root 16 -5 0 0 0 S 0.0 0.0 0:00.00 ksnapd 423 root 10 -5 0 0 0 S 0.0 0.0 0:00.26 kjournald 449 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 kauditd 486 root 16 -4 2568 940 392 S 0.0 0.0 0:00.23 udevd 1420 root 15 -5 0 0 0 S 0.0 0.0 0:00.00 hd-audio0 1953 root 20 -5 0 0 0 S 0.0 0.0 0:00.00 kmpathd/0
top command options:
Line2: Gives total number of process on the machine, number of running process, number of sleeping process, number of stopped process, number of Zambie process.
Line3: Gives you CPU details
Line4 & 5: Gives RAM and SWAP details.
Line6: To execute top command shortcuts(See below for the list of top command shortcuts ).
From Line7: dynamically displayed top process results.
Linux top Command Shortcut
l --To display or to hide load average line t --To display or to hide task/cpu line 1 --To display or hide all other CPU's m --to display or to hide RAM and SWAP details s --To change the time interval for updating top results(value is in sec's) R --To sort by PID number u -- Press u then username to get only that user process details P --To sort by CPU utilization M --To sort by RAM utilization c --To display or hide command full path r --To renice a process, press r then the PID no then the renice value to renice a process. k --To kill a process, press k then PID number then enter to kill a process
W --To save the modified configuration permanently.
q --To quit the top command.
h --for getting help on top command
space -- immediately refresh output
!Enjoy
Kuldeep Sharma
No comments:
Post a Comment