Why are there two or more different versions of a manpage in http://manpages.ubuntu.com
For example, looking at the manpage of at
, you can find two, one that is provided by the manpages-posix
package [ref]. And another that is provided by the at
package itself [ref].
The same is valid for other packages as well like ls.1 and ls.1posix and ls.1plan9.
What I understood from a quick search is that posix means that it's a standard specified by IEEE to maintain compatibility between different OS [ref].
So does Ubuntu has its own implementation of a program?
POSIX stipulates a number of commands are available (see the Shell & Utilities volume) and that they work in a certain way. Here are those commands:
GNU coreutils (what GNU/Linux distributions ship) contains all these commands but they have developed away from the standard POSIX base over time. Some offer better features. Some work in slightly different ways. These coretils versions are what the standard
man
pages cater for.But it is still desirable to write scripts that work on many platforms. For example, if you tried to use extended coreutil functionality of
grep
on OSX, you'd run into syntax errors. And this is why knowing how the POSIX version works is desirable. Installmanpages-posix
and you know everything.It's also essential to know this stuff if you're planning on improving GNU coreutils.
Plan9 is different yet again. It was never designed to be POSIX compatible. It strives for an amount of POSIX compatibility through a emulation layer and the man pages for it are again, there as documentation to let you know what you can use.
More Uses of POSIX Manpages
Besides what Oli said about writing portable scripts (and hacking on coreutils), there are two other situations where the POSIX manual pages may come in handy:
1. You've configured (more) POSIX-compliant behavior.
If you set the
POSIXLY_CORRECT
environment variable (to anything, it can even be blank), many GNU utilities and some other programs will behave in the fashion specified by POSIX, even when the developers saw no reason users would likely want this behavior.This doesn't make your system behave like a truely POSIX-compliant OS. The Linux kernel, GNU libc, and many userlands tools are all deliberately designed to be POSIX-compliant only when doing so is more helpful than harmful. This is one of the reasons GNU/Linux systems like Ubuntu are widely considered not to be Unix systems.
The behavior of
ls
is affected by a great many things, but is not affected by whether or notPOSIXLY_CORRECT
is set. (You can verify this by checking the source code in, say, 13.04:ls-ls.c
,ls.h
, andls.c
make no reference to that environment variable.)But some other utilities are affected. For example, the
df
utility prints disk usage information for all mounted devices. Normally, Ubuntu'sdf
(privided by GNU coreutils) shows this in 1 kilobyte blocks. WithPOSIXLY_CORRECT
set, it shows it in 512 B (i.e., half-kilobyte) blocks. That behavior is required by the POSIX standard, but probably not useful to most users, so it is not the default.2. There's no "regular" manpage for the command/topic you're interested in.
Sometimes the POSIX manual page is the only one available. For example, the
cd
command is a shell builtin only. It's provided by different shells and behaves a little bit differently from shell to shell (in that different shells sometimes makecd
accept different command-line options).The default interactive shell in Ubuntu is
bash
and you can get information aboutcd
inman bash
. But if you want a manual page just forcd
, well, there's nocd
executable (no single globally usable, shell-independentcd
command).But the
cd
command is a required part of the POSIX standard--shells must implement it, and the POSIX standard "knows" about what it requires. So a POSIX manpage forcd
is possible, and exists.Searching for
cd
on manpages.ubuntu.com shows the POSIX manual page and two others. This is another kind of example of multiple manual pages with the same name, by the way. What are the others? One is thecd
command in the language Tcl. The other is a CD-ROM driver in the FreeBSD operating system. Manual pages for FreeBSD are sometimes helpful to Ubuntu users, so a whole collection of them can be installed, includingman 4 cd
(not one of the FreeBSD manual pages most likely to be helpful to Ubuntu users not also using FreeBSD).Why Plan 9?
You might be wondering why there are Plan 9 manual pages in Ubuntu at all. After all, unlike Ubuntu (and many other OSes such as FreeBSD), Plan 9 is not even a Unix-style operating system, though as Oli says there are some similarities.
The reason for this is that the Plan 9 userland tools (the basic set of tools corresponding very roughly to coreutils) have been ported to Unix-like systems, so they can be run on OSes such as Ubuntu. They, and their manual pages, are provided by the
9base
package.Some (not all) of the Plan 9 tools available for Ubuntu have the same name as Ubuntu tools, and perform the same or similar functions.
One of the reasons for having the Plan 9 tools on Ubuntu is that some of them don't correspond directly to any Ubuntu tool (but may still need the tools that do, for interoperability).
Another reason is to support software that depends on Plan 9 tools. For example, the window manager wmii used to be packaged for Ubuntu (and available in official Ubuntu software sources); this
wmii2
package depended on9base
.