Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Commands like ps come with a lot of parameters, especially because they give the use an option to choose between Unix and BSD style flags. I hope you get my point here.

So, when there's such an option available, which should I choose for maximum compatibility across all linux systems? (max. compatibility is one of the priorities for instance)

I know that Unix style is quite obvious, but BSD commands for some reason include more readable information (column titles for example, CPU column etc). Of course, please correct me if I am wrong, but that's what I felt.

share|improve this question

2 Answers 2

up vote 15 down vote accepted

Pretty much all Linuxes use GNU versions of the original core Unix commands like ps, which, as you've noted, supports both BSD and AT&T style options.

Since your stated goal is only compatibility among Linuxes, that means the answer is, "It doesn't matter."

Embedded and other very small variants of Linux typically use BusyBox instead of the GNU tools, but in the case of ps, it really doesn't affect the answer, since the BusyBox version is so stripped down it can be called neither AT&Tish nor BSDish.

Over time, other Unixy systems have reduced the ps compatibility differences. Mac OS X — which derives indirectly from BSD Unix and in general behaves most similarly to BSD Unix still — accepts both AT&Tish and BSDish ps flags.

Solaris/OpenIndiana behaves this way, too, though this is less surprising because it has a mixed BSD and AT&T history.

FreeBSD, OpenBSD, and NetBSD still hew to the BSD style exclusively.

The older a Unix box is, the more likely it is that it accepts only one style of flags. You can paper over the differences on such a box the same way we do now: install the GNU tools, if they haven't already been installed.

That said, there are still traps. ps output generally shouldn't be parsed in scripts that need to be portable, for example, since Unixy systems vary in what columns are available, the amount of data the OS is willing to make visible to non-root users, etc.

(By the way, note that it's "BSD vs. AT&T", not "BSD vs. Unix". BSD Unix is still UNIX®. BSD Unix shares a direct development history with the original AT&T branch. That sharing goes both ways, too: AT&T and its successors brought BSD innovations back home at several points in its history. This unification over time is partly due to the efforts of The Open Group and its predecessors.)

share|improve this answer

In case of doubt, use the SysV syntax. This has been agreed on by a lot of people, and is the de-facto standard. The BSD stuff either dates from the prehistory or is part of some divergent branch (SysV was an effort to end the Unix wars by bringing all the disparate lines under one roof).

share|improve this answer
    
De facto standard for Linux, not Solaris, *BSD, OSX, etc. –  chiggsy Jan 23 '13 at 15:17
    
Sure it is the standard for Solaris (that was the first SysV to come out, remember). It has been adhered to by IBM's AIX and HP-UX, at least. The BSDs are a holdout from a bygone era. –  vonbrand Jan 23 '13 at 15:46
    
You are correct about Solaris being SysV, my error. –  chiggsy Jan 23 '13 at 15:55
    
@chiggsy so, upvote instead of downvote? –  its_me Jan 23 '13 at 17:03
    
Upvoted, although I question the disparaging references to BSD. It's not a bad thing to keep doing things the right way. –  chiggsy Jan 25 '13 at 8:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.