Where are man pages stored in Ubuntu?

49

15

I hope my question isn't too trivial, but I've never actually needed to know this before.

In which directory can I find the files of the man pages, i.e. the read-only text file opened when you type man foo? I assume different distros may keep them in slightly different places, so if it makes any difference I run Ubuntu 10.04.

Yitzchak

Posted 2011-08-03T15:12:29.130

Reputation: 4 084

Answers

61

Use manpath to see the directories used by your system, and man --where --all foo to find a specific manual page of foo.

The standard location is /usr/share/man according to Filesystem Hierarchy Standard, and /usr/man is usually a symlink to that directory.

Other locations can be defined in /etc/manpath.config or /etc/man_db.conf (exact location varies). For example, /usr/local/share/man is almost always included.

In addition, man tries to find manual pages for every directory specified in $PATH – for example, if you added /opt/plan9/bin to $PATH, man will automatically search /opt/plan9/man and /opt/plan9/bin/man.

If the $MANPATH environment variable is set, however, it will override all other sources.

user1686

Posted 2011-08-03T15:12:29.130

Reputation: 283 655

I know this question is for Ubuntu, but if anybody from macOS is here, the equivalent is man -w -a foo. It appears Apple's man does not have the longer --where and --all options – Max Coplan – 2019-11-23T20:29:28.777

6

In the files that end with .gz when using whereis:

whereis man

output:

man: /usr/bin/man /usr/bin/X11/man /usr/local/man /usr/share/man /usr/share/man/man1/man.1.gz /usr/share/man/man7/man.7.gz

Example with grep:

whereis grep

output:

grep: /bin/grep /usr/share/man/man1/grep.1.gz

minor update on how to read these gz files:

info /usr/share/man/man1/grep.info.gz
zcat /usr/share/man/man1/grep.1.gz | less

or if it is in the name.number.gz format:

zcat /usr/share/man/man1/grep.1.gz | less
# or more readable
man /usr/share/man/man1/grep.1.gz

jmunsch

Posted 2011-08-03T15:12:29.130

Reputation: 239

4whereis tells you the location of a program, so doing whereis man will tell you where the man executable is stored, but not the man pages themselves. – jff – 2016-06-29T01:31:56.300

4@jff is incorrect here. From the manual page for whereis: 'whereis - locate the binary, source, and manual page files for a command'. Using whereis -m grep will restrict output just to the location of the manual page files. – Nick Kennedy – 2018-06-18T15:51:16.327

4

They should be under /usr/share/man.

John T

Posted 2011-08-03T15:12:29.130

Reputation: 149 037