The man command is used to load detailed usage instructions for most (if not all) Linux commands. You can usually obtain basic usage information by using the --help argument, however not all commands support this convention.
If you are unsure of the exact command you are looking for, then you can also search the man pages using the -k switch.
For example:
man -k partition
will search themanpage summaries for the keyword 'partition' and will show pages relating to (or mentioning) 'partition'
It should be noted that the -K (uppercase 'K') can also be used. This will search through all the text in the man pages whereas -k (lowercase 'k') will only search titles and descriptions. Full text search will necessarily take longer (though I imagine not too much of a concern on modern machines).
There are different categories of man page
| Section | Explanation |
|---|---|
| 1 | Executable programs or shell commands |
| 2 | System calls (functions provided by the kernel) |
| 3 | Library calls (functions within program libraries) |
| 4 | Special files (usually found in /dev) |
| 5 | File formats and conventions |
| 6 | Games |
| 7 | Miscellaneous (including macro packages and conventions) e.g. man(7), groff(7) |
| 8 | System administration commands |
When running man -k [keyword] you will receive results from all of these categories. If you need to narrow the search, then you can pipe it through the grep command
For example:
man -k partition | grep 8
This will show you only results from the "System Administration Commands" section of the man pages (category '8')
You can also use man -f <command> to show a short description of a command. This may help you in understanding if you have the correct command for the task you wish to achive.
Occasionally you may also not find anything in the man pages. If this happens, then it could be that the database is outdated (this is usually updated using a cron job). If this happens, then you can force an update of the database by running mandb with superuser privileges (either as the root user or with sudo).
| Key press | Action |
|---|---|
| Space | Scroll down one screen |
| PgDn | Scroll down one screen |
| PgUp | Scroll up one screen |
| ↓ | Scroll down one line |
| ↑ | Scroll up one line |
| D | Scroll down half a screen |
| U | Scroll up half a screen |
| /string | Search down for string in the whole man page. |
| N | Continue previous search down |
| Shift + N | Search back up |
| G | Go back to the start of man page |
| Shift+G | Goes immediately to the end of the man page |
| Q | Exits man and returns to the shell prompt |
RegEx can be used when searching the man pages