Man command in Linux with Examples

The Linux operating system is absolutely brimming with different commands to use. Even with a fresh Linux installation, you can open a command line terminal and have instant access to hundreds of commands. This is why we have man command in Linux.

There’s only one problem, which is that you need a little background information about how to use each command. Linux commands can get very complex, with tons of different options and nuances that you can utilize to make your system do exactly what you want. With all the different commands and command options out there, there’s got to be some documentation about how everything works, right?

That’s where the man command (short for manual) comes into play. Knowing how to use the man command in Linux will grant you the instant ability to learn how to use any other Linux command. Best of all, you don’t have to use Google to learn about a command or any other third party source – you can just get the information you need from the Linux command line.

In this guide, you’ll see how to use the man command on Linux through command line examples and frequently used options. Check out the examples below to get started!

In this tutorial you will learn:

  • How to use the man command on Linux

"How

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Any Linux distro
Software man
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

Frequently Used Options

The man command prints documentation for any Linux command on the system. Check some of the examples below to see how to use it.

  1. Normally, you won’t specify any extra options with the man command. All you need to do is specify the name of the command for which you’d like to view instructions. For example, this command would view the man page for the cat command.
    $ man cat
    

    Now, “command” is not a fully accurate description. What you are actually passing to man is the page you are interested in. There just happens to be a page for most commands in your operating system.

    Viewing the manual page for cat command
    Viewing the manual page for cat command
  2. To navigate the man page, use your Enter key to move down one line, and your space key to move down one whole page. To exit the man page at any time, just press the q key. You may also use the Page Up and Page Down keys to scroll up or down.

    Viewing a different section of the manual page for cat command
    Viewing a different section of the manual page for cat command
  3. You can also search through all manuals with the -k option.
    $ man -k 'ls'
    ls (1) - list directory contentsa lsattr (1) - list file attributes on a Linux second extended file system
    lsb_release (1) - print distribution-specific information
    lsblk (8) - list block devices
    

    The output returned was significantly longer, so we abbreviated it here. To now open the manual for any item of interest from the list, you can specify the name in your man command. For example:

    $ man 8 lsblk
    

Advanced Usage

The man command in Linux is pretty simple and there are not many advanced ways to use it. However, there are still a few lesser mentioned options that we think users should be aware of. Check below to learn them.

Man command in Linux Basic Examples

  1. You can search for a text string in a man page by pressing / on your keyboard and typing a keyword to search for. Then, press Enter and your terminal will be brought to the first instance of this keyword."Using
  2. If you want to view the manual pages in a GUI, you can use the yelp command.
    $ yelp man:ls
    

    Viewing a manual page in GUI with the help of yelp command
    Viewing a manual page in GUI with the help of yelp command
  3. Users should also know that man in Linux isn’t the only command of its kind. GNU came up with the info system, which serves the same purpose, but it introduces a nice facility, namely that you can use hypertext to jump from one page to another, just like you do when browsing the web.
    $ info ls
    

    The info command works similarly to man command, but sometimes will contain different or additional information. It’s also formatted a bit differently and uses its own navigation conventions.

    Viewing an information page, which is very similar to a manual page
    Viewing an information page, which is very similar to a manual page

Closing Thoughts

In this guide, we saw how to use the man command on Linux. This is an essential command that every beginner needs to know, as it gives users the ability to familiarize themselves with all the commands available on a system. For further reading, be sure to check out our guides on accessing man pages, learning the man command, and writing manual pages on Linux.