23

Note: This applies to Centos 7. If you are looking for a Debian answer, see this question. Those answers will not be duplicated here.

After an install of centos 7, I can't access man pages :

# man ls
-bash: man: command not found

I tried to install it via yum

# yum install man-pages
... ok

But again:

# man ls
-bash: man: command not found

Why?

1
  • 1
    This is extremely weird, as man(1) is a very fundamental piece of the system. You could try to reinstall, i.e., go yum reinstall /usr/bin/man.
    – vonbrand
    Dec 31, 2015 at 23:01

5 Answers 5

23

In order to use the man command, you must also install the man package before or after the man-pages one

# yum install man-pages
... ok
# yum install man
... ok

Now man is installed

# man ls


NAME
      ls - list directory contents

SYNOPSIS
      ls [OPTION]... [FILE]...

DESCRIPTION
      List information about the FILEs (the current directory by default).  Sort entries alphabetically if none of -cftuvSUX nor --sort.

      Mandatory arguments to long options are mandatory for short options too. ...
3
  • 4
    Apparently this doesn't work on centOS inside a docker container. I know I've gotten this to work in a centOS VM, but unsure why its not working in the container. Jan 10, 2018 at 21:07
  • 17
    Ok, I just found my answer. Docker centos images are prebuild with tsflags=nodocs set in /etc/yum.conf. See hub.docker.com/_/centos Jan 10, 2018 at 22:26
  • Yes you're right! +1 for the complement. Thanks!
    – Rémi B.
    Jan 11, 2018 at 13:34
14

I had the same problem in my docker container and solved it by commenting out tsflags=nodocs in the /etc/yum.conf file, then I removed the man-pages and man-db and reinstall them again. It works fine this way.

$ vi /etc/yum.conf

Search for tsflags into the file and add a comment (#) in front of it:

#tsflags=nodocs

Now remove the man-db and the man-pages if it's already installed on your system:

$ yum remove man-pages man-db

Then install them again:

$ yum install man-pages man-db

Sorted!

1
  • This was the secret sauce for my WSL centos75 installation on windows.
    – choy
    Nov 20, 2019 at 17:41
4

The syntax on CentOS 7:

# yum install man-pages man-db man

The syntax on CentOS 6:

$ sudo yum install man man-pages

Source

2

As pointed out by R. S, the CentOS official Docker images have manual page installation disabled. This is true also of the Fedora official Docker images.

The easiest way to handle this is via the following sed command, which will work on either system:

sed -i -e '/tsflags=nodocs/s/^/#/' /etc/yum.conf /etc/dnf/dnf.conf || true

This will produce an error message saying it cannot read one of the two files, but whichever one does exist will be updated to comment out the tsflags=nodocs line. The || true at the end ensures that the command returns success regardless of any errors, to avoid halting in scripts.

This can be used in a RUN command in a Dockerfile, in which case you should use it before installing any further packages. For packages you already have installed any manual pages that normally come with them will remain uninstalled and the package will have to be re-installed to bring in the manual pages. Many of the base system's manual pages (such as ls) are in the man-pages package, but other packages, such as git include their own manual pages and also need to be reinstalled.

Removing and then re-installing packages can create dependency problems. To avoid these instead use:

yum -y reinstall man-pages git
0

Since Centos 8 is EOL, you might be looking for man pages on RHEL 8

For my RHEL 8.7 docker container, I had to update yum and install man:

yum update -y
yum install man -y

then I could access man pages: man curl

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .