Home > Blockchain >  Filter "top" commands result on basis of command column
Filter "top" commands result on basis of command column

Time:11-18

I am trying to get specific commands processes instead of getting all process but I am unable to filter results on basis of command column. I want it to do it with a command. I don't want to go with the way in which we press "o" and then give something because I have to run it from a bash script.

what I have tried

top -b -n 1 | grep 'php-cgi, httpd'

I want to get process in which commands are httpd and php-cgi only

enter image description here

CodePudding user response:

Use

top -b -n 1  | grep 'php-cgi\|httpd'
  •  Tags:  
  • bash
  • Related