Man expects the man directories listed in $MANPATH
or $(manpath)
to be split by section into directories named "man$section"
. This duplicates the section information that is already available in the suffix of the manpage. (e.g. for ls.1.gz
, the .1
info gets duplicated in man1/
).
Why not skip the middle man-directories and make the manpath directories flat when flat seems good enough for $PATH
directories?
2 Answers
It doesn't duplicate the information: you can have more suffixes in a given directory than the plain ".1" or ".3", e.g., (depending on the platform) letters following the numbers. For example, Debian follows the ".3" with a an application suffix such as "pm" for Perl modules.
Here is (part) of the listing from /usr/share/man/man1
, to illustrate:
-rw-r--r-- 1 root 592 Apr 17 2012 411toppm.1.gz
-rw-r--r-- 1 root 3827 Tue 15:21:13 CA.pl.1ssl.gz
lrwxrwxrwx 1 root 17 Feb 19 2012 GET.1p.gz -> lwp-request.1p.gz
lrwxrwxrwx 1 root 17 Feb 19 2012 HEAD.1p.gz -> lwp-request.1p.gz
lrwxrwxrwx 1 root 17 Feb 19 2012 POST.1p.gz -> lwp-request.1p.gz
-rw-r--r-- 1 root 2490 Aug 29 2011 SOAPsh.1p.gz
-rw-r--r-- 1 root 2428 Aug 29 2011 XMLRPCsh.1p.gz
-rw-r--r-- 1 root 5112 Apr 5 2012 alien.1p.gz
-rw-r--r-- 1 root 3130 Oct 26 2012 apt-show-versions.1p.gz
-rw-r--r-- 1 root 4011 Tue 15:21:13 asn1parse.1ssl.gz
-rw-r--r-- 1 root 2847 Tue 15:21:13 c_rehash.1ssl.gz
-rw-r--r-- 1 root 9796 Tue 15:21:13 ca.1ssl.gz
-rw-r--r-- 1 root 6410 Tue 15:21:13 ciphers.1ssl.gz
-rw-r--r-- 1 root 8419 Tue 15:21:13 cms.1ssl.gz
-rw-r--r-- 1 root 6394 Jun 26 2012 cpanm.1p.gz
-rw-r--r-- 1 root 2631 Tue 15:21:13 crl.1ssl.gz
-rw-r--r-- 1 root 2636 Tue 15:21:13 crl2pkcs7.1ssl.gz
-rw-r--r-- 1 root 2272 Jun 19 2014 dbilogstrip.1p.gz
-rw-r--r-- 1 root 3255 Jun 19 2014 dbiprof.1p.gz
Additionally, the various directories are split up because in systems using cat
directories, the filenames would be (usually) duplicated.
And finally - there's a split-up to keep directory size (relatively) small and improve performance.
-
I'd still call this duplication (the number still gets duplicated), but thanks for explaining this. I saw
1pm
and in there, and I was curious what thepm
meant.– PSkocikMay 9, 2016 at 9:25 -
The first point doesn't prevent you from putting all the files in a single directory, and the second could be handled by having a separate
catman
directory. May 9, 2016 at 9:57
At this point I'd say the main reason is backwards compatibility — the directory split was there right from the start, in V4 (that's the fourth release of UNIX, not SVR4). Back then there could have been any number of reasons: avoiding having to handle many files in a single directory, thinking of the manual pages as parts of a book...