36

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.

oa-
  • 7,716
Jonathan Komar
  • 895
  • 3
  • 12
  • 21

1 Answers1

26

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
oa-
  • 7,716
  • 2
    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 04 '18 at 15:08