Ubuntu – the difference between standard syntax and BSD syntax

command linesyntax

I have seen many commands that accept a "BSD syntax" as well as their standard syntax. Take the ps command for one example:

To see every process on the system using standard syntax:
      ps -e
      ps -ef
      ps -eF
      ps -ely

To see every process on the system using BSD syntax:
      ps ax
      ps axu

So what is the difference between these two routes? In general when they say in BSD syntax what elements I should remember? Is this syntax just for those commands which they are in the BSD also?

Best Answer

What's the difference between MS Office and LibreOffice? Between Firefox and Chrome?
They do roughly the same thing, but they're by different people with slightly different aims.

Perhaps the better question is why do BSD, Linux, OSX and Unix distributions share so many commands? This boils down to POSIX compliance. POSIX is basically a set of standards for Unix-like operating systems; it stipulates the core API, the commands and how those commands should work.

In the case of ps (a POSIX-stipulated command) certain arguments are demanded. These include these BSD ones. All the POSIX-derived commands have their own man pages but they need a separate install. For ps:

sudo apt-get install manpages-posix
man 1posix ps

So why isn't BSD using our ps (or vice versa)?

  • Our ps package (procps see: dpkg -S $(which ps)) is a fork of another procps package. Both these are GPL licensed. This is incompatible with BSD's license so can't be included there. (We could include BSD's but don't need to).
  • ps is fairly kernel specific. I reckon they're technically incompatible.

What about other applications?

Most of the commands for POSIX compliance come from Ubuntu's coreutils package. This package represents the GNU in GNU/Linux and it too is GPL licensed. BSD ships its own BSD-compatible-licensed versions that adhere to POSIX but aren't necessarily completely the same as their GNU counterparts.

ps isn't the only POSIX command that isn't GNU. There are loads of them.

As I lead with, why should they be? They're by different people over a very, very long time. That's the short answer here.