Jay die
Jay die

Reputation: 19

Get just PID Number from "ps aux --sort -rss "

How can I just get the PID of the following command:

ps aux --sort -rss

Thanks

Upvotes: 0

Views: 870

Answers (2)

David Novák
David Novák

Reputation: 53

Try this if you want to avoid using any external tools:

ps -ax --sort -rss -o pid

By forgoing u (user-oriented format option) and adding -o pid (user-defined output format - only show pid), you'll get what you need.

Upvotes: 2

ps aux --sort -rss | awk '{print $2}'

Try this

Upvotes: 2

Related Questions