Thursday 6 August 2015

Understanding man pages


Man pages are stands for manual pages. In Linux, all types of tools have it's own manual page. Manual pages are commonly contains informations and instructions about a command. man pages are very useful for learning commands in Linux.
Even if we forget the commands, that time also man pages are helpful to remember. To get detailed information about man pages in Linux, then type following commands

To know respective commands with our needs, then type following command in terminal 
 man -k keyword  

For an example  
 man -k time  

where, -k stands for keyword. the above command lists many commands with numbers. This number is refer to section of man pages command. Each section of man describes different kind of commands. You can get an over view of man pages by typing following command
 man man-pages  

It gives look like following result


In section 1 commands are described for ordinary users.
In section 5 documents are document configuration files.
In section 8 describes management commands.
When we are using man pages, grep is an very useful utility. grep is the most important command in Linux. It is a filtering utility whcih is allows to search resolves of a command in a specific time. You can also use to find a text in text files. Let we use grep in man pages 
 man -k time | grep 1  
 If a commands separates by pipe means the output of the first command is goes to the input of the second command.
The above command is gives following result
 
Now we can easily identify the command 'date' to know date of the system.
So now let as see the man page of date command 
 man date  

For this command we will get following result

 
The synopsis is very clearly shows how to use the date command.

Let we see some useful options
Look at -s which is describes "set time described by STRING". So we need to set the time. Now our dought is what a STRING?
To get the detail about STRING type /STRING in the same man page. Now you will get look like following information about the STRING 
 
when we are typing date -s with time. We will get human readable format. Now we are learned how to find a command using man -k.
There is another way to get information about an command  
 date --help  


Hope you understand!  

No comments:

Post a Comment