1
In Linux, if I use ps --user john -C processname
, then I get all processes owned by the user and in addition all processes named processname
.
Is there a way to modify the behavior to get only processes called processname
owned by john
?
1
In Linux, if I use ps --user john -C processname
, then I get all processes owned by the user and in addition all processes named processname
.
Is there a way to modify the behavior to get only processes called processname
owned by john
?
1
Unfortunately ps
is a bit strange in that way. You can use pgrep
to help ps
. In pgrep
all conditions must match. Use that syntax for example:
ps -p"$(pgrep -d, -u john processname)"
pgrep
prints all the pids comma separated that match the conditions. That is given to ps
as an argument to the -p
flag. -p
selects a list of pids.