Home > Software design >  how to get `ps` info with process name but without pipe `|`
how to get `ps` info with process name but without pipe `|`

Time:10-08

How could I get the ps result of process name (like rabbitmq_server) without pipe |, the result equals to ps aux | grep rabbitmq_server.

If there is some option parameters to define the process name with ps?

CodePudding user response:

Depending on exactly what information you want pgrep rabbitmq_server might work for you. The default output isn't exactly the same as ps aux, but you can get additional fields by adding flags like -l or -a.

CodePudding user response:

You can use "-C" option -C cmdlist

$ sleep 10 &
[1] 124771
$ ps -C sleep
    PID TTY          TIME CMD
 124771 pts/0    00:00:00 sleep
  • Related