man command in linux is short form of manual of any tool, utility, and commands. man command is used to giving information and instruction of particular command. Instruction would be what are the possible way and option to use that command.
You will find very useful and essential command, which helps you explore other command as well as troubleshoot.
You get a detailed view of the command which includes NAME, SYNOPSIS, DESCRIPTION, OPTIONS, EXIT STATUS, RETURN VALUES, ERRORS, FILES, VERSIONS, EXAMPLES, AUTHORS and SEE ALSO by using man command.
Most of manual has following sections:
- Executable programs or shell commands
- System calls (functions provided by the kernel)
- Library calls (functions within program libraries
- Special files (usually found in /dev)
- File formats and conventions eg /etc/passwd
- Miscellaneous (including macro packages and conventions), e.g. groff(7)
- System administration commands (usually only for root)
- Kernel routines [Non standard]
- The basic syntax of man command in Linux
- Options of man command in Linux
- ls command in Linux in Hindi Video Tutorial
The basic syntax of man command in Linux
The basic syntax of man command in Linux as follows:
man [OPTION]… [COMMAND NAME]…
For Example, if you want to know the instruction and information of touch command then you should use man touch. See the result follows:
Options of man command in Linux
In the above example I have described use command without option but as you know options allow commands to work on specific condition.
You can use following command the know available options:
I am giving you some examples of useful options of man command. You can find it in the following table:
|Section-num||Display a specific section|
|-f||One may not be able to remember the sections in which a command is present. So this option gives the section in which the given command is present.Display a short description from the manual page|
|-a||Display intro manual pages|
|-k||Regular expression of Command|
|-w||location of manul page|
|-l||command as case sensitive|
Section-num of man command in Linux
As I have told you manual is divided into multiple sections, the section-num option can be used to display only a specific section of a manual.
Basic Syntax of man command with section-num option as follows :
$ man [SECTION-NUM] [COMMAND NAME]
An example is here with intro command:
$ man 2 intro
You will get the 2nd section of manual page available for intro command, And section second is Description.
-f option of man command
You may not be able to remember the sections in which a command is present. So this option allow user to see section in which the given command is present.
Basic syntax of -f option with man command is as follows:
$man -f [COMMAND NAME]
In the above examples, the -f option are returned with it section numbers respectively mkdir, printf and ls command.
-a option of man command
-a option with man command is used to display, in succession, all of the available intro manual pages contained within the manual. It is possible to quit between successive displays or skip any of them.
This option helps us to display all the available intro manual pages in succession.
Basic Syntax of use man command to know about command name:
$ man -a [COMMAND NAME]
Example as follows:
$ man -a mkdir
In the above example, you can move through the sections of manual pages i.e either reading(by pressing Enter) or skipping(by pressing ctrl+D) or exiting(by pressing ctrl+C).
-k option of man command
You can search the short descriptions and manual page names for the keyword mkdir as regular expression.
Basic Syntax of man command:
$man -k [COMMAND NAME]
See example in below:
[[email protected] ~]$ man -k mkdir mkdir (1) - make directories mkdir (1p) - make directories mkdir (2) - create a directory mkdir (3p) - make a directory relative to directory file descriptor mkdirat (2) - create a directory [[email protected] ~]$
The command ‘mkdir‘ is searched in all the manual pages by considering it as a regular expression.
-w option of man command in Linux
If you want to know the location of manual page inside your operating system. You use man command and displayed the information of same command. But you don’t “where is this manual page comming from?”
-w option of man command will allow you to get the location in which the manual page of a given command is present.
[[email protected] ~]$ man -w mkdir /usr/share/man/man1/mkdir.1.gz [[email protected] ~]$ man -w touch /usr/share/man/man1/touch.1.gz [[email protected] ~]$ man -w printf /usr/share/man/man1/printf.1.gz [[email protected] ~]$
-I option of man command
It considers the command as case sensitive.
Basic Syntax of man command with -I option :
$ man -I [COMMAND NAME]
See the Example as below:
$ man -I printf
The explanation result is as follows:
The command ‘printf‘ is taken as case-sensitive i.e ‘printf‘ returns the manual pages but ‘printF‘ and ‘PRINTF’ gives error.
ls command in Linux in Hindi Video Tutorial
You have learned about man command in Linux, which is used to display manuals on any command in Linux and Unix.
For more information about the man command, check the man page.
If you have any questions or feedback, feel free to leave a comment.