Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
add comment

migrated from stackoverflow.com Sep 30 '12 at 9:14

This question came from our site for professional and enthusiast programmers.

4 Answers

up vote 3 down vote accepted

Ascending:

ps ax --sort +pid

Descending

ps ax --sort -pid
share|improve this answer
add comment

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

ps --sort='-pid'
share|improve this answer
add comment

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

share|improve this answer
add comment

You can use tac command also

tac command print files in reverse


ps -aux --sort -pid

and

ps -aux | tac
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.