APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed
RSS Feeds RSS Feeds

(OLDER) <- More Stuff -> (NEWER) (NEWEST)
Printer Friendly Version
-> I_WANT_A_BROKEN_PS (exploration of Linux 'ps')


In the old days, a "ps -e" on Linux would get you something like this:

warning: `-' deprecated; use `ps e', not `ps -e'

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.

If this page was useful to you, please help others find it:  


More Articles by - Find me on Google+

Click here to add your comments
- no registration needed!

"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?"

That happens only if the DARL_MCBRIDE environment variable has been set.

Regarding the ps semantics, I really don't appreciate some of these ADD-suffering coders intentionally deviating from the POSIX standards so as avoid typing one or two extra characters. I have enough trouble keeping all this stuff straight in my head without someone arbitrarily adding to the confusion. Let's try to maintain syntactical uniformity, even if it means typing that dreaded minus sign.


---July 24, 2004

I've been told that "oldps" no longer exists (I was using an older RedHat server) and that PS_PERSONALITY now works just as CMD_ENV did here.

The problem with the "-" stuff is this: BSD never required a "-", and unfortunately some of their option letters have different meanings. So how should "ps -e" be interpreted? Should it show the environment or every process? Setting PS_PERSONALITY lets you force that decision, otherwise the new "ps" tries hard to "do the right thing". Albert has sent me some longer explanations of this which I have asked permisson to publish.


Don't miss responses! Subscribe to Comments by RSS or by Email

Click here to add your comments

If you want a picture to show with your comment, go get a Gravatar

Kerio Samepage

Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.

Publishing your articles here

Jump to Comments

Many of the products and books I review are things I purchased for my own use. Some were given to me specifically for the purpose of reviewing them. I resell or can earn commissions from the sale of some of these items. Links within these pages may be affiliate links that pay me for referring you to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain. I also may own stock in companies mentioned here. If you have any question, please do feel free to contact me.

I am a Kerio reseller. Articles here related to Kerio products reflect my honest opinion, but I do have an obvious interest in selling those products also.

Specific links that take you to pages that allow you to purchase the item I reviewed are very likely to pay me a commission. Many of the books I review were given to me by the publishers specifically for the purpose of writing a review. These gifts and referral fees do not affect my opinions; I often give bad reviews anyway.

We use Google third-party advertising companies to serve ads when you visit our website. These companies may use information (not including your name, address, email address, or telephone number) about your visits to this and other websites in order to provide advertisements about goods and services of interest to you. If you would like more information about this practice and to know your choices about not having this information used by these companies, click here.


This post tagged:

       - Blog
       - Linux
       - Unix

My Troubleshooting E-Book will show you how to solve tough problems on Linux and Unix systems!

book graphic unix and linux troubleshooting guide

Buy Kerio from a dealer
who knows tech:
I sell and support

Kerio Connect Mail server, Control, Workspace and Operator licenses and subscription renewals

Click and enter your name and phone number to call me about Kerio® products right now (Flash required)