12

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?

20

To view a manual page related to a package, open a terminal (press Ctrl+Alt+T together) and type:

man <package_name>

For example, to view grep's manual page, type:

man grep

This will open the manual page referring to the section numbers in the order:

1 2 3 4 5 6 7 

If you want to open the manual page of a specific section, type:

man <section_number> <package_name>

For example, to open the manual page of the open() function in C, you should type:

man 2 open

More information:

  • 3
    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. – evilsoup May 18 '14 at 18:47
  • @evilsoup: Feel free to add it to the answer. – jobin May 18 '14 at 18:48
  • To open the manual page of all sections, type man -a <page>. And note that the argument doesn't have to be a package name. It can be a command, a file, a function name, ... – scai May 19 '14 at 8:25
  • 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). – Alois Mahdal Jul 31 '17 at 19:51
5

@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 <command> > /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 <command> | less so you can view it as pages

For more options: man man

  • 2
    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? – Ruslan May 19 '14 at 6:03
2

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.

1

You can use man package/command(name) and for more information about how man works try using man man

1

You can also view man pages in a browser.

Install the man2html package using sudo apt-get install man2html and then navigate to http://localhost/cgi-bin/man/man2html

1

Your knee-jerk reaction when trying to study about new command or config file should be:

man command
man file.conf

or

man command<Tab>
man file<Tab>

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.