5

I'm displaying information about the current processes using this variety of the ps command:

ps -eo pid,start,stime,command

How can I sort these results by start?

I've read man ps and tried -m, -r and -v sorting options. Unfortunately I haven't been able to use these options to sort by start.

SundayMonday
  • 19,147
  • 29
  • 100
  • 154

1 Answers1

6

You use etime. That's elapsed time, in days, hours, etc. which is suitable for sorting numerically. If it's the first column, I think ps will sort by it automatically.

Otherwise, you can override sort order by using --sort, but make sure it is after the -o option, example:

ps -o pid,user:32,start,etime,state,time,vsz,args --sort=etime
Jeff Bauer
  • 13,890
  • 9
  • 51
  • 73
Bobby Jack
  • 15,689
  • 15
  • 65
  • 97