Saturday, May 28, 2011

Manual Pages (man pages)

To read a man page the general command is:

$/# man <command>

eg:

$ man ifconfig

The above command gives you a name, synopsis, note short description about the command, list of options with that command and author . At the same time you can see something like this on first line for ipconfig:

IFCONFIG(8) Linux Programmer’s Manual IFCONFIG(8)

IFCONFIG(8) denotes name(section) here the name: IPCONFIG and section: 8.

Linux Programmer's Manual denotes section means section 8 is Linux Programmer's Manual.

Now, a question may come in your mind what is sections??

The manual pages are categorised into sections. There are 8 sections in fedora 13.

The standard sections of the manual include:
1 User Commands
2 System Calls
3 C Library Functions
4 Devices and Special Files
5 File Formats and Conventions
6 Games et. Al.
7 Miscellanea
8 System Administration tools and Deamons.

Tips and tweet:

1. Suppose you want to find info about a C command. You have reduce the search time of man pages by using this format:

$ man 3 <C command>

eg: $ man 3 scanf

2. Convert man pages to any other format.

$ man -t <command>

The above command returns in postscript format. Now using the below command we can convert a man page to pdf file.

eg: $ man -t ifconfig | ps2pdf -> ifconfig.pdf

3. An equivalent command of whatis:

$ man -f <command>

eg:

$ man -f man
man (1) - format and display the on-line manual pages
man (1p) - display system documentation
man (7) - macros to format man pages
man-pages (7) - conventions for writing Linux man pages
man.config [man] (5) - configuration data for man

$ man -f ifconfig
ifconfig (8) - configure a network interface

In the above two commands, 1st command searches and returns 5 man pages and second command return only one man page.

4. Search an string (or word) in all man pages(inside a man page).

$ man -K <command>

Note: This command takes a long time.

1 comment: