In the old days, a "ps -e" on Linux would get you something like this:
warning: `-' deprecated; use `ps e', not `ps -e' PID TTY STAT TIME COMMAND ..
To get that now, you need to use "oldps". The man page (which you can still see with "man oldps") warned:
For now, ps will give you a warning if you use a `-' for a short option, but it will still work. If you have shell scripts which use BSD-style arguments to ps, take heed of the warning and fix them, or else your scripts will fail to function correctly at some point in the future. If you want to turn off the warnings, set the I_WANT_A_BROKEN_PS environment variable.
When I first saw this, it ticked me off. From time to time, I've even made comments like:
Personally, I think bsd ps semantics are "broken", not the other way around. But if I were putting in such a flag, I'd call it "I_WANT_BSD_FLAGS".
Well, I was wrong. Albert Cahalan (see the end of "man ps") set me straight:
I think Michael K. Johnson named that option, not me, but I support the naming and the code behind it. If you set that option, you make ps violate the POSIX and UNIX standards. The common "ps -ef" command will not work. (this is an ISO, IEEE, Open Group, and ANSI standard) According to the standards, "ps -aux" is parsed the same way as "ps -a -u x", with "x" being a username! People who want the BSD options get them by default anyway, with less typing. Why type "ps -aux" when "ps aux" will work? Besides, it's more portable to leave off the "-". You can use "ps aux" on AIX or Tru64, along with "ps -ef", but you can't use "ps -aux" on those systems at all. I like using both BSD and UNIX syntax, sometimes together. For example: ps f -ef ps -C bash,xterm u
OK, I see the error of my ways. But.. the new ps doesn't seem to mind using "ps -e" at all. So the warning seems not to have come true, at least not yet.
Reading the newer "man ps", I found this :
PS_PERSONALITY Description () () none "Do the right thing" aix like AIX ps bsd like FreeBSD ps compaq like Digital Unix ps debian like the old Debian ps digital like Digital Unix ps gnu like the old Debian ps hp like HP-UX ps hpux like HP-UX ps irix like Irix ps linux deviate from Unix98 for convenience only old like the original Linux ps posix standard sco like SCO ps sgi like Irix ps sun like SunOS 4 ps sunos like SunOS 4 ps sysv standard unix standard unix95 standard unix98 standard
That made me think that if I set PS_PERSONALITY to "old" (and exported it) that "ps -e" would act like "oldps -e", but it doesn't (at least not on the system I tried it on). However, setting and exporting CMD_ENV did alter the behaviour as expected, though you don't get the "deprecated" message.
It's fun to play with the various settings. I notice that "sco" is one of the options, though I'm not sure what effects that has. Perhaps it causes "ps" to spawn a lawsuit?
See How "ps" works and why also.
Got something to add? Send me email.
(OLDER) <- More Stuff -> (NEWER) (NEWEST)
Printer Friendly Version
Inexpensive and informative Apple related e-books:
Take Control of Apple Mail, Third Edition
El Capitan: A Take Control Crash Course
A Practical Guide to Networking, Privacy &Security in iOS 9
Take Control of Numbers
Take Control of Your Digital Photos on a Mac