23

The BSD backend of MacOS has ps built in. The BSD General Commands Manual says that

The biggest change is in the interpretation of the -u option, which now displays processes belonging to the specified username(s). Thus, "ps -aux" will fail (unless you want to know about user "x"). As a convenience, however, "ps aux" still works as it did in Tiger.

I am wondering what the current standard is for this—dare I write—obsolete command+parameter sequence.

  • What's wrong with ps aux without minus? – Mateusz Szlosek Feb 13 '17 at 7:29
  • @MateuszSzlosek Nothing except that it is deprecated. Read the quote carefully. I assume the reason for its retirement is that it does not follow the standard parameter scheme of -p where p is a parameter character. (or --parameter where p is spelled out) – Jonathan Komar Feb 13 '17 at 7:33
  • 5
    ps aux is BSD syntax. Portable syntax would be ps -ef. – fd0 Feb 13 '17 at 7:39
  • 3
    @fd0 Your comment should probably be an answer. – Jonathan Komar Feb 13 '17 at 7:40
15

To replicate ps aux (BSD style) in the AT&T version of ps, you have to use

ps -Ao user,pid,%cpu,%mem,vsz,rss,tt,stat,start,time,command

This command is compatible with scripts that expect the same output as ps aux.

The only difference is the sort order; ps aux sorts all processes by their start time whereas ps -Ao sorts them by PID.


ps -jef is a shorter command, but it will output different headers.:

  • USER
  • PID
  • PPID
  • PGID
  • SESS
  • JOBC
  • STAT
  • TT
  • TIME
  • COMMAND
  • UID
  • C
  • STIME
  • TTY
| improve this answer | |
  • 1
    Thanks. "The only difference is the sort order; ps aux sorts all processes by their start time whereas ps -Ao sorts them by PID." Can ps --sort bsdstart -Ao sort in start time? – Tim Dec 4 '18 at 15:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .