Social Icons

Monday, September 23, 2013

UNDERSTANDING MAN PAGES.............ARTICLE 8

WHAT IS A MAN PAGE???

A Manual page shortly called as Man page is a software  documentation found on all the UNIX and LINUX operating systems by default. All the commands, library calls, system calls etc.. can be found inside Man pages.

WHY TO USE MAN PAGES??

 Man page is one of the best facility a LINIX/UNIX system provides us. One of the best ways to learn Linux is through the man pages.
It is basically divided into 9 sections. We will use mostly use the first seven sections of the man pages.
Each section of Man page is like a category. 
                            
The sections of Man pages are as follows:-
  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(dev is a operating system file which contain info about devices)).
  5. File formats and conventions eg /etc/passwd.
  6. Games.
  7. Miscellaneous (including macro packages and conventions).
  8. System administration commands (usually only for root).
  9. Kernel routines.   
    All the books which contains information or data about the Linux commands and functions are taken from the Man pages itself. Any book you find in the market are simply a re-write of Man pages. 

                                        Man pages conveys the information directly to the user. When we read from the books the authors of the books write about the commands and functions in the way they understood and implemented it. It cab be accurate or not accurate
    I am not writing against any author, what I want to say is learning through the Man pages is one of the best way you can learn LINUX. You do not have to memorize the syntax which can be a very tedious job. All you need to do is just remember the name of the function or at-least know a function exists for a specific purpose. The syntax, implementation, return value, errors that could occur etc can be viewed in the man page.
      
    HOW TO OPEN A MAN PAGE??

    Opening a man page is very simple . Open a terminal bt pressing ATL+CTRL+T  and type this man <<command  or library function or system calls  or tool name etc..>>
    for example: If I need to find out about a function printf(). I guess we are pretty familiar wit the printf() function which is used to print the output on the screen. To open he man page for print just open the terminal and type man printf  and you will get the documentation of printf().
    Have a look at my screen shot.

      
 Look I have opened my terminal and typed the command to open the man page for printf().
The output we get here is as shown below
 Here i would like to discuss a few pints and tips i know about using a man page.
As you open a man page you can see a number referring to the section. Here in printf() function 1 is present, that mean it belongs to the first section of the man page.

 Here this 1 tells that its a part of the first section. S ometimes a single command can be in the multiple sections, its because one command can be used for different purpose it can act both as a command as well as a library call or a system call hence it will belong to both the sections.
For example : Let me open a man page on signals. syntax is man signal.



The section number its referring to is 2 that means its the manual page of signal is from the second section of the man page.


Now look at this carefully, I am opening a man page on signal which belongs to section 7.


It will be a different man page with only a little similarity although the functionality is same. Try it for yourself.


DIFFERENT SECTIONS INSIDE A MAN PAGE: 
 When you open a man page of any command or a tool or a system call , the description about that particular function will be described in the following order 
1:  NAME
2:  SYNOPSIS
3:  DESCRIPTION 
4:  RETURN VALUE
5:  ERRORS
6:  CONFORMING TO
7:  NOTES
8:  BUGS 
9:  SEE ALSO
10:  COLOPHON

Every man page will have the following I mentioned above. It will give you a complete information about the function.

HOW TO USE THE MAN PAGE:

Once you have a man page on your screen, you'll want to know the information listed below.

If you need help while looking at the man page, you can type a ? to get more information.
If the man page is more than one page long, you'll need to press the space bar to see the next and all subsequent pages.
                           If you're looking for something specific in the man page (for example, the description of a particular option), you can have man find a particular word (say, that option name) by typing the following: /pattern . The man command will go to where it first finds the word you typed in place of pattern. 
                             To get man to look for the next occurrence of that word, simply type a slash (/) by itself.  If you don't want to look at the entire man page, you can quit by typing ctrl-c or, if the : prompt is on your screen, by typing q.  If you don't know the exact name of the UNIX command you're looking for, you can use: man -k something man -k responds by printing on the screen a list of all the commands it finds that are similar to the word you typed in place of something or that contain that word in the description of the command. You can then use the man command to get information about the command you're interested in. 


Its not important you read an entire Man page as sometimes man pages can turn very exhaustive. If you know how to use a particular function, what is its functionality its more than enough. As you keep using the tools, as you become familiar with these flags and functions etc usage will also become easy eventually. You don't have to memorize the functions and commands , as we can always refer into the man pages.

IF YOU WANT TO CHECK OUT ALL THE COMMANDS GOTO WWW.LINUXMANPAGES.COM.
THERE YOU WILL FIND THE ENTIRE LIST ( ACTUALLY A VERY LONG LIST , MORE THAN 3000 APPROXIMATELY  ). 

No comments:

Post a Comment