Linux - Top command to list specific process, Monitor all the process with specific name
Top command to list specific process
As a linux admin we will monitor only a specific process with specific name. Normally system admins use ps, pgrep command to find the process using particular command. In such situation to grep the process with specific name you can use the top command along with pgrep to grep only specific process or to monitor the specific process what it does.# top -p $(pgrep -d , chrome) # top '-p' $(pgrep -d ' -p ' chrome)OUTPUT:
Tasks: 10 total, 0 running, 7 sleeping, 0 stopped, 3 zombie Cpu(s): 6.2%us, 4.5%sy, 0.0%ni, 87.3%id, 0.0%wa, 2.1%hi, 0.0%si, 0.0%st Mem: 1801632k total, 577512k used, 1224120k free, 24952k buffers Swap: 4195324k total, 177992k used, 4017332k free, 222220k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 1806 vaishnav 20 0 347m 53m 22m S 0.0 3.0 1:30.39 chrome 1813 vaishnav 20 0 121m 1408 948 S 0.0 0.1 0:00.87 chrome 1815 vaishnav 20 0 102m 1224 880 S 0.0 0.1 0:00.02 chrome 2120 vaishnav 20 0 0 0 0 Z 0.0 0.0 0:32.41 chrome <defunct> 2122 vaishnav 20 0 0 0 0 Z 0.0 0.0 0:01.14 chrome <defunct> 2210 vaishnav 20 0 175m 29m 15m S 0.0 1.7 0:02.16 chrome 2236 vaishnav 20 0 221m 71m 19m S 0.0 4.1 0:28.59 chrome 2257 vaishnav 20 0 0 0 0 Z 0.0 0.0 0:00.28 chrome <defunct> 2279 vaishnav 20 0 180m 38m 16m S 0.0 2.2 0:02.04 chrome 2320 vaishnav 20 0 173m 27m 16m S 0.0 1.6 0:02.06 chrome
To be more specific about the process or the process with the command what it does? you can use the below command
# top -p $(pgrep -d , chrome) -cSample Output
1815 vaishnav 20 0 102m 1224 880 S 0.0 0.1 0:00.02 /opt/google/chrome/chrome --type=zygote 2120 vaishnav 20 0 0 0 0 Z 0.0 0.0 0:32.41 [chrome] <defunct> 2122 vaishnav 20 0 0 0 0 Z 0.0 0.0 0:01.14 [chrome] <defunct>
The topic on Linux - Top command to list specific process is posted by - Math
Hope you have enjoyed, Linux - Top command to list specific processThanks for your time