Linux Commands

Man Command Linux

We all know that there are tons of Linux commands, and obviously, we don’t know them all by heart. Either way, at times, we need help to understand what a Linux command means and how it is used. For this, we must resort to the commands that function as manuals within Linux. On Linux, there are 5 such commands – the help command, the man command, the info command, the apropos command, and the whatis command. In this tutorial, we’ll be reviewing the man command, particularly as it is the most powerful manual for Linux.

The man command

Man stands for manual and is used to get as much information as is possible about any commands that can be run within the terminal. In fact, this is the only command out there that will chuck so much information that you’ll probably not be capable of going through the entire manual for the command in question.

Each command has information on a number of sub-sections. These sub-sections include NAME, SYNOPSIS, CONFIGURATION, DESCRIPTION, OPTIONS, EXIT STATUS, RETURN VALUE, ERRORS, ENVIRONMENT, FILES, VERSIONS, CONFORMING TO, NOTES, BUGS, EXAMPLE, AUTHORS, and SEE ALSO. In the SYNOPSIS section, the syntax used to run the program is found. Further, the OPTIONS section elaborates on the options that the command uses.

Each command in the manual comes with a number attached to it; this number refers to the manual section where the command is located. For example, you may read the following:

passwd (1) – change user password

Next to passwd, there’s a number, and in this case, it’s a one. But this number can change depending on the command you input. This number refers to the section in the manual where it is found. There are exactly 9 sections in the manual itself. The manual includes these various sections:

  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)
  5. File formats and conventions, e.g. /etc/passwd
  6. Games
  7. Miscellaneous (including macro packages and conventions), e.g., man(7), groff(7)
  8. System administration commands (usually only for root)
  9. Kernel routines [Non standard]

Typically, the way you’d search for information on a particular command is by typing:

man [command]

Ex: man passwd

Further, you can read about the manual itself in the manual by typing:

man man

“Man man” will give you information about the manual itself.

Search by Section

When a search is performed in the manual using the man command (followed by another command, ex; man passwd), the manual is searched in a particular order. The pre-defined order in which it searches the manual is as follows: (1 n l 8 3 2 3posix 3pm 3perl 5 4 9 6 7). However, you can modify this order if you so wish using the file /etc/manpath.config.

The result that is then displayed is the first result it finds. But this by no means means that there aren’t multiple entries that match the search term. So if the search term was found in section 1 and section 5, it will display the result found in section 1 and omit the result found in section 5.

For example, if you’re looking for the command “passwd”, then you would type:

man passwd

This will display the first match that it finds. In our case, the first match that it will find will be in section 1 or shell commands (passwd (1) – change user password). However, there are multiple instances of the “passwd” command in the manual.

passwd (1ssl) - compute password hashes

passwd (1) - change user password

passwd (5) - the password file

So what if the command that you want more information about is the passwd file (located at /etc/passwd and is used to store user information)? In such cases, you’d have to give the section number of the manual where you’ll find the command. In our case, as we can see, passwd (5) means section 5 of the manual. So let’s try that:

man [section] [command]

Ex: man 5 passwd

“Man 5 passwd” will yield results that are dissimilar to “man passwd”. In fact, in this case, it will search and chuck out information about the password file and not the passwd command (to change the user password)!

The next question we ask ourselves is, what if we don’t know which section the “passwd” file is in the manual but that we still need information about it. In the previous case, I told you that the section number was 5, but chances are, you wouldn’t know the section numbers by heart! So what we’re looking for is an alternative to the whatis command. And what is special is that the man command comes with a hyphen f that mimics the whatis command. It will give you the matching commands with a description.

So if we type:

man -f [command]

Ex: man -f passwd

“man -f passwd” will list the following:

passwd (1ssl) - compute password hashes

passwd (1) - change user password

passwd (5) - the password file

Search by terms

Next, what if we wanted to search the manual using search terms? What if we knew the general function of the command but didn’t know the command itself? In this case, we need a man command that mimics the apropos command.

man -k [term]

Ex: man -k passwd

Ex: man -k “list directory”

Here, when you add the hyphen k and then the search term, you get exactly the exact information that matches that search term. It will collect every term in the manual that matches the search term that you’ve inputted.

In our case, we’d get this for “man -k passwd”:

Other searches

Though we looked at how to search the manual by section and by function, there are many other ways to search the manual! You can read further about the manual by typing “man man” in the command line.


Commands are an essential part of Linux. In particular, if you’re new to Linux and even experienced users need help with commands. For this purpose, manuals were integrated into the Linux system. These manuals can be accessed via the man command (amongst others). The man command is quite powerful as it gives in-depth information about the command itself and its usage.

Happy Coding!

About the author

Kalyani Rajalingham

I'm a linux and code lover.