The man command, is short for manual. It provides access to the various up-to-date on-board documentation pages. This helps users utilize the Linux/Unix operating systems in a better manner.
What is man ?
The man command is a manual pager which provides the user with documentation about specific functions, system calls, and commands. The man command uses the less pager by default. (See man less for more information.)
Note that a man page is likely to contain better up-to-date information compared to what can be found on the internet. It is wise to compare the man page usage and options with that found on the web.
How to use man ?
To use the man command effectively we have to know the manual pages system. The manual pages are distributed in 8 sections. Each provides documentation on particular topics.
What are the manual page sections ?
- Programs, shell commands and daemons.
- System calls.
- Library calls.
- Special files, drivers, and hardware.
- Configuration files.
- Games.
- Miscellaneous commands.
- System administration commands and daemons.
Examples
To get the printf library function documentation (section 3):
# man 3 printf
To get the printf shell builtin documentation (section 1):
# man 1 printf
You can learn more about the man command and its options:
# man man
How to manage the index caches database
To update the existing database, or to create it, use the -c or –create flag with the mandb command:
# mandb --create
To do a correctness check on the documentation database use the -t or –test flag:
# mandb --test
How to export manual pages
To export a man page, use the -t flag with the man command:
man -t 5 dnf.conf > manual.ps
This will create a PostScript file with the contents of the dnf.conf man page from section 5.
Alternatively, if you want to output a PDF file, use something like this instead:
man -Tpdf 5 dnf.conf > dnf.conf.pdf
You will need the groff-perl package installed for this command to work.
Summary
The need to get information about commands, daemons, shell builtins, etc. to make them do what they are intended to do correctly, motivates us to use the system manual to learn not everything but the required knowledge to reach our goal.
Thijs
Thank you. I always suspected man was powerful, but I only used it as a reference if –help didn’t help. I found it too big, not easy to find the information I needed. But this motivates me to learn more about man and learn to use it more efficiently and effectively.
littlephoenix85
Excellent tutorial. But the related acronym, RTFM, is missing an explanation.
For anyone interested, it can also be found on Wikipedia.
TimS
It would be helpful if you could additionally explain the intended usage of the manual page command “apropos” and any other man page search tools. Thank you if you are able to post that also. There is also the GNU “info” command that relates to “man”, and shows man pages or full books, depending what is installed on the system.
Terry
The keyword option “man -k” (aka apropos) is a useful option. To find all the man pages that “list” in section 1:
man -s 1 -k list
Thomas Xu
I’d say manual pages has really become old school fashion these days. I personally ask some LLM first, then STFW to verify. Only refer to the man page when I know something is there, for details I cannot recall.
Cody
I’ve used various forms of unix for decades. As such you can imagine I have used man(1) a lot. Just wanted to point out a typo…
To get the printf sell builtin documentation (section 1):
I think you meant ‘shell’ đŸ™‚
Richard England
Correction made. Thank you.
dvildmonpsy
thanks, i get surprised about man command power and features
Barry
Thanks for writing this article.
I see that some command are prefixed with # and others without.
Usually #, rather the $, implies run as root.
You talk about the mandb command which I think needs root to run.
Can you show the command with sudo?
Also you might want to mention the systemd service man-db-cache-update.service
which manages the cache automatically.
ttomasz
Thanks for the article!
When I run mandb –test as root, I receive 1600+ messages like this
mandb: warning: /usr/share/man/tr/man8/kded6.8.gz: whatis parse for kded6(8) failed
I am not sure it is related, but all of them are .gz files.
Also, I do not think that my system is corrupted.
Any ideas?
zibuyu
These warnings from
usually mean it can’t extract the “whatis” description from certain man pages. It’s common and not a sign of system corruption, especially if you can view the man pages normally.
Possible reasons:
– The man page files (.gz) may lack proper formatting, like missing
or
sections.
– The content might not follow the expected syntax, so
can’t parse it.
– The files are compressed, but
can handle that—it’s the content format that matters.
What you can do:
1. Try viewing one of the problematic man pages:
man /usr/share/man/tr/man8/kded6.8.gz
If it displays correctly, the warning is harmless.
Check the start of the file for lines like:
.SH NAME
kded6 - short description
If these are missing,
can’t generate the whatis info.
If the warnings bother you, you could report them to the package maintainers or manually fix the formatting.
Summary:
These warnings are common and
zibuyu
These warnings from
usually mean it can’t extract the “whatis” description from certain man pages. It’s common and not a sign of system corruption, especially if you can view the man pages normally.
– The man page files (.gz) may lack proper formatting, like missing
or
sections.
Danniello
If you use some exotic language (i.e. different than English;) it is very useful to know how to open English man page (translated man pages very often are not up-to-date):
It is very handy to know how to search man pages (so how to use ‘less’ effectively).
Enable/disable “Ignore case” mode: type “-I”
Search for “text”: type “/text” (+enter)
Bryan A Zimmer
If you happen to be plain-text oriented, as I am, there’s a simple way to “translate” man pages into a plain text format. Assuming the subject to be researched is “grep”, the command would be like this:
$ man grep | col -b | tee ~/grep.man.txt
I do this when I get frustrated by the inability to just view it as a text file: easy to understand, easily scrollable and compatible with other tools.
(But then, I still use Emacs as my primary editor.)