4

Is there a way i use the ps --sort option on a linux to display the processes in reverse order based on the process ID or is there another command i can use for this?

4 Answers 4

9

Ascending:

ps ax --sort +pid

Descending

ps ax --sort -pid
0

If that's the Linux ps command we're discussing,

ps --sort='-pid'
0

you can use this also for sorting the pid

ps -ax | sort -n 

ps -ax is for display all process with pid. sort -n for numeric sort

0

You can use tac command also

tac command print files in reverse


ps -aux --sort -pid

and

ps -aux | tac

You must log in to answer this question.