The “man” command comes from the word “manual”, which gives information about any command from the Linux manual.
We get full of commands from Linux manuals.
General Usage
To get full details of “chmod” command, use the “man” command like the below-
$ man chmod
BashNote: To get out of the manual information section, press “q” key.
Sections in Manual
Linux manual has 8 sections. You can see the section number with each command in the manual in parentheses.
$ man chmod
CHMOD(1) User Command
NAME
chmod - change file mode bits
.
.
.
BashSee the “1” in the parenthesis beside “CHMOD(1)”. This indicates that the “chmod” command belongs to section “1”.
These sections actually indicate the category of the command. Let’s see that sections are there in the manual-
Section No. | Section usage |
---|---|
1 | User command |
2 | System call |
3 | C library function |
4 | Devices and special files |
5 | File system and convertion |
6 | Games |
7 | Miscellaneous |
8 | System administration |
Search Command in Manual
Use the “-k” option for the manual to search for something in the manual-
$ man -k search_term_here
BashIf want to search for the term “permission” in the manual then we can do it, using the following command-
$ man -k permission
access (2) - check users permissions for a file
chmod (2) - change permissions of a file
eaccess (3) - check effective users permissions for a file
euidaccess (3) - check effective users permissions for a file
faccessat (2) - check users permissions for a file
faccessat2 (2) - check users permissions for a file
fchmod (2) - change permissions of a file
fchmodat (2) - change permissions of a file
ioperm (2) - set port input/output permissions
shtool-fixperm (1) - GNU shtool file permission fixing command
BashYou can also see the section number beside the command(the number inside the parenthesis).
How to Read Manual Page?
Linux command has the following structure-
command_name [-this_is_optional_option] [-choose_this | -or_choose_this] <mandatory_option_or_param>
BashNote: anything inside the angle brackets “<>” is mandatory.
Note: Pipe character(|) means we can choose only one of those options.
Note: If some option is in square brackets “[]” that means it is optional.
Note: “…” means we can add multiple arguments or options for that.
Note: command and options are case sensitive, so make sure to use the correct case for the command and options.