- How do I view the man pages?
- 7 Answers 7
- man Command in Linux with Examples
- Linux man Command Syntax
- How to Use man in Linux
- Look for man Pages
- Display man Pages From Specific Sections
- Display man Pages in a Browser
- Display man Pages and Print Short Descriptions
- Display All man Pages
- Search by Considering Input as a Regular Expression
- Display Location of man Pages
- Enable Case-Sensitivity
How do I view the man pages?
I’m new to Linux. I got the «Unix And Linux System Administration Handbook» It speaks of several verisons of linux and unix, and the commands for viewing linux man pages and not specific to ubuntu. How do I view the manpages?
7 Answers 7
To view a manual page related to a package, open a terminal (press Ctrl + Alt + T together) and type:
For example, to view grep ‘s manual page, type:
This will open the manual page referring to the section numbers in the order:
If you want to open the manual page of a specific section, type:
For example, to open the manual page of the open() function in C, you should type:
Also, some tools have more extensive manuals in info pages (so info grep ); and some commands that are an internal part of the bash shell rather than being separate external files are documented on help pages (for example: help echo ). And, of course, many programs have a —help option that displays the most common usages.
To open the manual page of all sections, type man -a
Sorry, but this is IMO too inacurrate. The man argument is manpage name, not package name. grep is not a package (neither is open or ascii or hier ), but a command that is part of coreutils package. man coreutils does not give anything since that page does not exist. The convention (followed by most, but not all packages) is to add a manpage per command, which is why man grep works, but there are manpages that don’t describe commands. man does not really have concept of packages (aside from minor meta info displayed in footer).
@Jobin answer is perfect, I always like to add more options so Op can know it.
If you want to redirect a command man to a txt file:
man > /location/file (change location and the name of file )
Another thing I would like you to know:
When for example you type man ls , you will see LS (1) at the top, numbers mean:
(1) User Commands (2) System Calls (3) Library functions (4) Devices (5) File formats (6) Games and Amusements (7) Conventions and Miscellany (8) System Administration and Priveledged Commands (L) Local. Some programs install their man pages into this section instead (N) TCL commands
And if you want to view man pages on terminal I would prefer to use:
man | less so you can view it as pages
Why would one need to pipe man to less if it already uses a pager, which by default is (at least on my system) /usr/bin/less -s and can be specified by -P option or $PAGER env var?
If using unity you can also access thru the Dash via yelp & the manpages scope
Open Dash home, type in manpages:whatever , ex. manpages:bash
Available man’s will be displayed, when clicked on open in help window
The bookmark option in help when opened this way is semi useful, could be better.
Install the man2html package using sudo apt-get install man2html and then navigate to http://localhost/cgi-bin/man/man2html
You can use man package/command(name) and for more information about how man works try using man man
Your knee-jerk reaction when trying to study about new command or config file should be:
The argument to man is actually manpage name and the package maintainer is expected to add any manpages users would need. For many prolific packages, you can normally expect:
- one manpage per command — named exactly as the command,
- at least one manpage about configuration files (typically named exactly as the main configuration file).
However the man page system is a huge, really rich resource. There are actually far more man pages that don’t deal with particular command or even particular program. For example, the manpage system typically contains documentation of:
- commands (section 1) but often also pages that are not directly commands eg. perlre,
- kernel calls (section 2),
- system library calls (section 3),
- special system files (section 4),
- configuration files and formats (section 5),
- games (yes, games! .. although I’ve never seen anything there) (section 6),
- miscellaneous stuff (like man 7 ascii , man 7 iso-8859-1 , man 7 wireless ) (section 7)
Also, packages may provide their documentation as manpage sections. For example, perl-doc adds section 3perl where you can find all its modules, OpenSSL adds 3ssl .
Not sure if it’s on Ububtu, but on Fedora there is man-pages package that provides even more goods like POSIX versions of commands or system calls.
Just my 2¢: If you type man man (i.e. looking up the manpage for man) you get:
* man (1) man (7mp) man (1p) Man: What manual page do you want? Man:
This shows you what sections are available for a given man page. You can type in 1, 7mp, 1p to view whichever fits your fancy. 1p, for example, is the manpage for the command as defined by POSIX. If you are feeling particularly lazy, you can just hit enter at the Man: prompt and it will go to the default (*) section.
You can tell man which section you want by adding the section number to your request like (looking for info on mkdir command): man 1 mkdir or man mkdir.1 or man mkdir(1)
As far as the sections, I might suggest the following guide (from man 2.10.2):
The table below shows the section numbers of the manual followed by the types of pages they contain.
section | content |
---|---|
0 | Header files (usually found in /usr/include) |
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, e.g. /etc/passwd |
6 | Games |
7 | Miscellaneous (including macro packages and conventions), e.g. man(7), groff(7), man-pages(7) |
8 | System administration commands (usually only for root) |
9 | Kernel routines [Non standard] |
If you get bored w/ output you can change the pager to something like bat or use a colorizer. There are several ways to do this, just search for «how to colorize man page output» or something like that. It is worth looking over the manpage on man and on less (the default pager used by man ) as it will make looking up stuff a lot easier in the future. It is good to know that you can do something even if you have to look up how some other time.
man Command in Linux with Examples
The man command is a built-in manual for using Linux commands. It allows users to view the reference manuals of a command or utility run in the terminal. The man page (short for manual page) includes a command description, applicable options, flags, examples, and other informative sections.
In this tutorial, you will learn to use the man command in Linux.
- A machine running Linux
- Access to the command line
- An account with root privileges
Linux man Command Syntax
The basic man command syntax is:
man [option] [section number] [command name]
- option – the search result output.
- section number – the section in which to look for the man page.
- command name – the name of the command which man page you want to see.
By default, man looks in all the available sections of the manual and shows the first match (even if the page exists in several sections). Providing a section number instructs the man command to look in a specific section.
There are nine sections of the manual:
1. General commands: Commands used in the terminal.
2. System calls: Functions the kernel provides.
3. Library functions: Functions in program libraries.
4. Special files: Usually devices found in /dev and related drivers.
5. File formats and conventions: File formats like etc/passwd.
6. Games: Descriptions of commands that display database quotes.
7. Miscellaneous: Various descriptions, including macro packages and conventions, boot parameters, and others.
8. System administration commands: Commands mostly reserved for root.
9. Kernel Routines: Information about internal kernel operations.
How to Use man in Linux
In the terminal window, type man followed by the Linux command name which man page you want to see.
The output is lengthy. Use the mouse scroll wheel, the up and down arrow keys, or the PgDn and PgUp keys to navigate through it.
After running the man command, press H to see the help section and a table of possible keystrokes for navigating the output.
To exit, press Q.
The output of the command displays the available man page headings for the specified command.
The list of possible headings includes:
- Name: The name of the command.
- Synopsis: The command’s syntax.
- Configuration: Configuration details for a device.
- Description: A description of the command.
- Examples: Several examples demonstrating the use of the command.
- Defaults: The default functions of the command and how they can be overridden.
- Options: A list of options and flags that the command accepts.
- Exit Status: A list of possible exit status values for the command.
- Environment: A list and description of environment variables that affect the command.
- Files: A list of files used by the command.
- See also: Commands related to the described topic.
- Authors: The people who wrote or maintain the command.
- History: Command development history.
- Notes: Various notes, including permissions required, dependencies, etc.
- Bugs: Any known issues in this program version.
Note: Pages may contain more or fewer headings depending on the man page contents.
Look for man Pages
The -f option displays all man pages that match the specified command name and states the sections in which the given command is present.
The output is a list of results that match the search criteria. With multiple matches, the number next to the search result indicates the section.
Display man Pages From Specific Sections
To display the page from a specific section of a manual, use the syntax:
man [section number] [command name]
The output shows only the page from section 3 of the manual.
Display man Pages in a Browser
Man pages are long and sometimes difficult to scroll through to find the information you need. The man command allows users to display man pages in a browser to find information easily.
To do so, follow these steps:
1. Make sure the groff package is installed. Run:
sudo apt-get install groff
2. Before calling the man command, select a default browser. Run:
To use a different browser, replace firefox with google-chrome , chromium-browser , or any other browser.
3. Use the -H option to read the man page in a browser of your choice:
The -H option instructs groff to produce an HTML output and displays that output in a browser.
Display man Pages and Print Short Descriptions
The -f option allows users to look up the man pages and prints out short descriptions of the specified command in the terminal. The syntax is:
Display All man Pages
The -a attribute allows users to display all available intro manual pages contained in each section, one at a time.
Quit between successive displays or skip through them using Ctrl+C or Ctrl+D, respectively.
Search by Considering Input as a Regular Expression
The -k option allows users to search the short command descriptions and manual page names for a specified keyword as a regular expression. The output shows any available matches.
Display Location of man Pages
The -w attribute shows the location of the manual page of the specified command. Adding the -a option prints out the locations of all files matching the keyword.
In this example, we used the -a option to see the locations of all associated man pages.
Additionally, using the -W option displays the location of the preformatted cat file. With the -a option, it prints out the locations of all preformatted cat files matching the keyword.
Enable Case-Sensitivity
To search for manual pages using case-sensitivity, use the -I option. The syntax is:
The man default setting is to ignore case when looking up manual pages. To go back to default settings and ignore case, use the -i option.
You now know how to use the man command in Linux. Use the command to see user manuals for Linux commands, search for a specific keyword, or see all the entries in the manual.
To learn how can you search all man pages using known details as a search term, make sure to read our article apropos Linux command.
For more uses, refer to our article and find out how can man command review the complete manual for Expect.