Hi everyone
How can I just get the PID of the following command:
ps aux --sort -rss
Thanks
Regards
Hi everyone
How can I just get the PID of the following command:
ps aux --sort -rss
Thanks
Regards
Did you consider ps
' OUTPUT FORMAT CONTROL with the -o pid
STANDARD FORMAT SPECIFIER? It doesn't bear with the u
option, though.
So
ps aux
will give you every process (including those not in a terminal) in a user-readable output. As you are using --sort
I assume you are using the GNU version of ps
. Also you require to pull the PID of each process from this list so you don't need the user-friendly switch.
The following uses the SysV options to list all processes; sort them as you were in the original post; listing only the PID.
ps -e --sort -rss -opid=
Andrew