Some Linux commands may not have manual pages. This brief guide gives you a quick fix to install missing man pages of commands on Ubuntu and its derivatives.
Table of Contents
Introduction
The other day I was testing alias and unalias commands on my Ubuntu desktop. I wanted to refer all available arguments, flags and options of the alias
command, so I opened the man page.
But, it turns out both commands doesn't have manual pages.
$ man alias No manual entry for alias
$ man unalias No manual entry for unalias
The man pages are also 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:
Heads Up: Having trouble at finding something in the man pages? Refer the following guide.
View shell builtins information using "help" command
Alternatively, you can get the information of shell builtins using help
command like below.
$ help alias
Sample output:
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
Sample output:
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.
Suggested read:
6 comments
Really helpful article for newbies like myself.
Thanks a lot!
“python3” is misspelled twice as “pythin3”. Please correct. Thank you.
There are no such misspelled words in this guide. Which guide are you referring to?
yes it helped me by sudo apt install manpages-posix
I did man foreach and got “No manual entry for foreach”.
I then did sudo apt install manpages-posix, and tried man foreach again.
Same result; i.e. “No manual entry for foreach”.
Is there something else that i need to do? E.g. some adjustment to environment
variables?
I am running Ubuntu 22.04
1. `foreach` is typically a built-in command for `csh` or `tcsh` shells. Check your shell with `echo $SHELL`.
2. If you’re using `bash`, the equivalent is `for`.
3. Man pages might be missing; ensure you’ve installed documentation packages.
4. Update the man page database with `sudo mandb`.
5. Double-check your command for typos.
6. If unavailable locally, check online for documentation.