Server Fault is a question and answer site for system and network administrators. 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 to sort ps output by process start time, so newest are either at the top or bottom ?

On Linux ?

On SysV5 ?

On Mac ?

share|improve this question
up vote 44 down vote accepted

This should work on Linux and SysV5

ps -ef --sort=start_time
share|improve this answer
This works exactly as requested, thanks. After more digging I am not sure this is possible on Mac OS without a bit of awk – Dean Smith Jun 18 '09 at 9:50
start_time worked. lstart did not. RHEL – Felipe Alvarez Mar 6 '15 at 5:22
ps aux --sort=start_time command works fine – Suresh Mahawar Jun 22 at 9:34


$ ps aux --sort=lstart


$ ps aux -O started
share|improve this answer
I'm afraid neither of those sorts by start time. It does display the start time, but doesn't sort. – Dean Smith Jun 18 '09 at 9:45
The difference between lstart and start_time caught me out as well -- lstart gives a full timestamp, but cannot be used as a sort key. start_time gives the usual 'time within the last 24 hours, date otherwise' column, and can be used as a sort key. Both give 'STARTED' in the header. – LHMathies Apr 5 '12 at 8:22
time within last hour: if a process was launched yesterday at a time later than today, it will appear after today's process ... can't be used by sort, unless a bit of "awk" changes that – Olivier Dulac May 22 '13 at 10:16
@OlivierDulac: not for me. 15/12 15:40 appears before 16/12 15:39, just as 13:39 appears before 15:38. – Gauthier Dec 16 '14 at 14:41
lstart did not work for me. start_time did. – Felipe Alvarez Mar 6 '15 at 5:21

Along with the great answers above, sometimes I just want to see the top 20 offenders by process sorted descending by time, cpu% and memory usage.

For that I use:

ps auxww --sort=lstart | sort -r -k3,4 | head -20

This would be on a CentOS platform, though I've enjoyed the same results on Fedora as well.

Oh and for grins, I sometimes want to remove a set of processes, so I simply use a variant on the above that includes a bit of grep -v action, such as:

ps auxww --sort=lstart | sort -r -k3,4 | grep -v "sbin/httpd" | head -20
share|improve this answer
--sort of ps does not work for me. Relying on shell sort. +1 – kellogs Jan 25 '15 at 11:32

Or try 'ls', as it allows time formats that are easy to sort, and easier to use.

( cd /proc; ls -td --full-time --time-style=+%s [0123456789]*; )

Outputs the date/time in epoch, newest procs at the top.

share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.