How to install man pages on Ubuntu Linux

BaoMinh

Moderator
Aug 13, 2013
592
6
18
ubuntu-logo.jpg

I installed the minimal Ubuntu Linux 20.04 LTS cloud server, and now man pages are missing from my image. How do I install man pages on Ubuntu Linux 16.04/18.04/20.04 LTS server?

Typically man pages for Ubuntu commands not installed on a minimal cloud server or container-based images. To save hard disk space and to keep container image rebuild time smaller, man pages not installed. But, fear not this page explains how to install man pages on Ubuntu Linux version 16.04/18.04/20.04 LTS using the apt command/apt-get command.

How to install man pages on Ubuntu Linux


You will see an error as follows when the man command and related files are not installed Ubuntu:
man
man useradd

-bash: man: command not found
First, you must run the following commands as the root user using the sudo command or su command. For example,
sudo -i
## OR ##
su -

Search for Ubuntu man pages


Use any one of the following command:
apt search manpages
apt search manpages | more
apt-cache search manpages
apt search man | grep -i db
We can filter out outputs using the grep command/egrep command:
apt-cache search manpages | egrep 'manpages-(dev|posix)'


manpages-dev - Manual pages about using GNU/Linux for development
manpages-posix - Manual pages about using POSIX system
manpages-posix-dev - Manual pages about using a POSIX system for development


Let us see what these pages do:
apt info manpages-posix
apt info manpages-dev
apt info man-db



Package: man-db
Version: 2.9.1-1
Priority: standard
Section: doc
Origin: Ubuntu
Maintainer: Colin Watson <[email protected]>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 2884 kB
Provides: man, man-browser
Pre-Depends: dpkg (>= 1.16.1~)
Depends: bsdmainutils, debconf (>= 1.2.0) | debconf-2.0, groff-base (>= 1.18.1.1-15), libc6 (>= 2.28), libgdbm6 (>= 1.16), libpipeline1 (>= 1.5.0), libseccomp2 (>= 2.1.0), zlib1g (>= 1:1.1.4)
Suggests: apparmor, groff, less, www-browser
Conflicts: man
Breaks: manpages-tr (<< 1.0.5.1-3), manpages-zh (<< 1.5.2-1.1)
Replaces: man, manpages-de (<< 0.5-4), manpages-tr (<< 1.0.5.1-3), manpages-zh (<< 1.5.2-1.1), nlsutils
Homepage: https://nongnu.org/man-db/
Task: standard
Download-Size: 1112 kB
APT-Sources: http://archive.ubuntu.com/ubuntu focal/main amd64 Packages
Description: tools for reading manual pages
This package provides the man command, the primary way of examining the
system help files (manual pages). Other utilities provided include the
whatis and apropos commands for searching the manual page database, the
manpath utility for determining the manual page search path, and the
maintenance utilities mandb, catman and zsoelim. man-db uses the groff
suite of programs to format and display the manual pages.

Package: man-db Version: 2.9.1-1 Priority: standard Section: doc Origin: Ubuntu Maintainer: Colin Watson <[email protected]> Bugs: https://bugs.launchpad.net/ubuntu/+filebug Installed-Size: 2884 kB Provides: man, man-browser Pre-Depends: dpkg (>= 1.16.1~) Depends: bsdmainutils, debconf (>= 1.2.0) | debconf-2.0, groff-base (>= 1.18.1.1-15), libc6 (>= 2.28), libgdbm6 (>= 1.16), libpipeline1 (>= 1.5.0), libseccomp2 (>= 2.1.0), zlib1g (>= 1:1.1.4) Suggests: apparmor, groff, less, www-browser Conflicts: man Breaks: manpages-tr (<< 1.0.5.1-3), manpages-zh (<< 1.5.2-1.1) Replaces: man, manpages-de (<< 0.5-4), manpages-tr (<< 1.0.5.1-3), manpages-zh (<< 1.5.2-1.1), nlsutils Homepage: https://nongnu.org/man-db/ Task: standard Download-Size: 1112 kB APT-Sources: http://archive.ubuntu.com/ubuntu focal/main amd64 Packages Description: tools for reading manual pages This package provides the man command, the primary way of examining the system help files (manual pages). Other utilities provided include the whatis and apropos commands for searching the manual page database, the manpath utility for determining the manual page search path, and the maintenance utilities mandb, catman and zsoelim. man-db uses the groff suite of programs to format and display the manual pages.

Installing man pages on server or desktop Linux


First update package index and then install manpages-posix package for all missing commands:
sudo apt update
sudo apt install man-db manpages-posix
Install man pages on Ubuntu Linux using the apt-get command


Install man pages for software development


Execute the following command:
sudo apt install manpages-dev manpages-posix-dev
Sample outputs:



Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
manpages-dev manpages-posix-dev
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 4059 kB of archives.
After this operation, 6260 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 manpages-posix-dev all 2013a-2 [1794 kB]
Get:2 http://archive.ubuntu.com/ubuntu focal/main amd64 manpages-dev all 5.05-1 [2266 kB]
Fetched 4059 kB in 1s (3352 kB/s)
Selecting previously unselected package manpages-posix-dev.
(Reading database ... 18489 files and directories currently installed.)
Preparing to unpack .../manpages-posix-dev_2013a-2_all.deb ...
Unpacking manpages-posix-dev (2013a-2) ...
Selecting previously unselected package manpages-dev.
Preparing to unpack .../manpages-dev_5.05-1_all.deb ...
Unpacking manpages-dev (5.05-1) ...
Setting up manpages-dev (5.05-1) ...
Setting up manpages-posix-dev (2013a-2) ...
Processing triggers for man-db (2.9.1-1) ...

Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: manpages-dev manpages-posix-dev 0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. Need to get 4059 kB of archives. After this operation, 6260 kB of additional disk space will be used. Get:1 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 manpages-posix-dev all 2013a-2 [1794 kB] Get:2 http://archive.ubuntu.com/ubuntu focal/main amd64 manpages-dev all 5.05-1 [2266 kB] Fetched 4059 kB in 1s (3352 kB/s) Selecting previously unselected package manpages-posix-dev. (Reading database ... 18489 files and directories currently installed.) Preparing to unpack .../manpages-posix-dev_2013a-2_all.deb ... Unpacking manpages-posix-dev (2013a-2) ... Selecting previously unselected package manpages-dev. Preparing to unpack .../manpages-dev_5.05-1_all.deb ... Unpacking manpages-dev (5.05-1) ... Setting up manpages-dev (5.05-1) ... Setting up manpages-posix-dev (2013a-2) ... Processing triggers for man-db (2.9.1-1) ...

How do I read man page for any command?


The syntax is:
man command
man [section] command
For example, to read man page of the ls command:
man ls
man 8 passwd
man 5 passwd
man 5 passwd

The section numbers of the manual pages are as follows:

SectionDescriptionExamples
1Executable programs or shell commandsls command
man date
2System calls (functions provided by the kernel)man 2 sendmsg
3Library calls (functions within program libraries)man 3 abort
4Special files (usually found in /dev)man 4 intel
man 4 amdgpu
5File formats and conventions eg /etc/passwdman 5 shadow
6Gamesman 6 gti
man 6 sl
7Miscellaneous (including macro packages and conventions), e.g. man(7), groff(7)man 7 inode
8System administration commands (usually only for root)man 8 ip
9Kernel routines [Non standard]man 9 vmxnet
Conclusion


In this tutorial, you learned how to install man-db and manpages-posix packages for Ubuntu Linux system using the apt command. See man command man page here for more info or by typing the following man command:
man 1 man
man 7 man

ADVERTISEMENTS
Posted by: Vivek Gite


The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.