Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

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

up vote 4 down vote accepted

Ascending:

ps ax --sort +pid

Descending

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

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

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

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

You can use tac command also

tac command print files in reverse


ps -aux --sort -pid

and

ps -aux | tac
share|improve this answer

You must log in to answer this question.