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.

In the manual for the ps command on Ubuntu there is this text:

This version of ps accepts several kinds of options:

   1   UNIX options, which may be grouped and must be preceded by a
       dash.
   2   BSD options, which may be grouped and must not be used with
       a dash.
   3   GNU long options, which are preceded by two dashes.

Why is it possible that a command built in Ubuntu uses options from different operating systems? I know that the origin of Linux, UNIX and BSD are the same but they are different branches.

share|improve this question

closed as not constructive by manatwork, Anthon, Mat, Renan, slm Jun 8 '13 at 15:43

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

4  
I don't understand what you're asking, really. It's just different argument "styles". There's nothing "interesting" happening here except for the impressively huge set of possible arguments that ps takes. –  Mat Jun 8 '13 at 11:09
add comment

1 Answer

I just can give you an overall answer: Command line options are often parsed using the library function "getopt". Originally it only accepted aguments consisting of a - followd by a symbol. This effectively limits the amount of options you have, more or less -A to -Z, -a to -z and -0 to -9. You can imagine that you will not use an option without at least a hint to the real use, like -h for help or -v for version information or verbose output.

In Linux and the often associated standard C library glibc there is the extension to getopt to also handle -- - like options. Coming with this is that many commands developed under GNU (like glibc) used this extension. Now for many comands you also have the GNU-like style option. -v and --verbose, -h and --help and so on. I guess the same happened in BSD (though I am no BSD guy, please correct me).

Your ps-command comes from a software collection called procps and I guess that they want to mimic the option style specific for a certain platform. So for the UNIX guys it has - options. For BSD it also accepts something like "ps aux" and so on.

PS is not the only programm behaving like this. Many of the standard programms understand the "old" UNIX style (POSIX) and some modern extensions.

share|improve this answer
1  
Welcome to the Unix & Linux stackexchange! You're off to an excellent start. –  paraxor Jun 8 '13 at 11:51
add comment

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