The other day I was testing alias and unalias commands on my Ubuntu 18.04 desktop. I wanted to refer all available arguments, flags and options of the alias command, so I opened the man page. But, I got the following message when I tried to open the man pages of alias or unalias commands.
$ man alias No manual entry for alias
$ man unalias No manual entry for unalias
It turns out that man pages are missing for some other programs, such as export and eval.
There is no other way except googling to learn about these programs.
On RPM-based systems(E.g. CentOS), if you run "man alias" command, it will open man pages for BASH BUILTINS. You may need to go through the whole man page to find details of the respective command.
After a bit of Google search, I learned that there is no dedicated manual pages for shell builtins, like alias, export, eval in Linux Programmer's manual. If you're not sure whether the given command is an alias, shell built-in, file, function, or keyword, use type command to find out.
$ type alias alias is a shell builtin
The documentation for these builtins are available in the related shell man page. As you can see in the above output, alias is a shell builtin, so you can view the documentation in the associated shell man page. In my case, it is BASH.
Let us open the man pages of BASH:
$ man bash
Search for alias or unalias entries in the Bash man page.
Here is the information of alias and unalias:
Tip: Having trouble at finding something in the man pages? Refer the following guide.
View information about shell builtins using "help" command
Alternatively, you can get the information of shell builtins using help command like below.
$ help alias
alias: alias [-p] [name[=value] ... ] Define or display aliases. Without arguments, `alias' prints the list of aliases in the reusable form `alias NAME=VALUE' on standard output. Otherwise, an alias is defined for each NAME whose VALUE is given. A trailing space in VALUE causes the next word to be checked for alias substitution when the alias is expanded. Options: -p print all defined aliases in a reusable format Exit Status: alias returns true unless a NAME is supplied for which no alias has been defined.
If you prefer man page format, simply use -m flag with help command below.
$ help -m alias
All bash builtins have help pages. Even help command itself has a help page.
$ help help help: help [-dms] [pattern ...] Display information about builtin commands. Displays brief summaries of builtin commands. If PATTERN is specified, gives detailed help on all commands matching PATTERN, otherwise the list of help topics is printed. Options: -d output short description for each topic -m display usage in pseudo-manpage format -s output only a short usage synopsis for each topic matching PATTERN Arguments: PATTERN Pattern specifiying a help topic Exit Status: Returns success unless PATTERN is not found or an invalid option is given.
This is how you can find the information of shell builtins.
Now, let us get back to the topic. Is there any way to install missing man pages of commands? That's what we are going to do now.
Install Missing Man Pages Of Commands On Ubuntu
As stated earlier, Builtins are part of the shell. Each shell has its own set of builtins. They are not independent commands and they don't have separate man pages. Luckily, the man pages of shell builtins are available in POSIX Programmer's Manual. You need to install it to access those man pages.
On Debian, Ubuntu and other DEB-based systems, simply run the following command to install POSIX Programmer's Manual:
$ sudo apt install manpages-posix
Now, you can access the man pages of a shell builtin (E.g. alias) using command:
$ man alias
Hope this helps.