No, there probably isn't a way. ps
has a few process selection options, but (at least the one on my system) doesn't have a way to filter on the status. You can check the manual page (man ps
) on your system to confirm.
Note that it's using things like awk
, grep
, etc. to find the bits of output you're interested in is the normal, expected way to use a Linux/Unix shell. If you do that often, and want to save re-typing it, you can use a shell function defined in your .bashrc
or similar, or put a shell script somewhere in $PATH
(often, $HOME/bin
).
For example, a shell function taking one argument (the status to look for):
ps_for_stat() {
ps -aux | awk {'if ($8 == "'"$1"'") print $8" "$11'}
}
You could then run: ps_for_stat S