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
mancommand on Linux
|Category||Requirements, Conventions or Software Version Used|
|System||Any Linux distro|
|Other||Privileged access to your Linux system as root or via the
|Conventions||# – requires given linux commands to be executed with root privileges either directly as a root user or by use of
$ – requires given linux commands to be executed as a regular non-privileged user
Frequently Used Options
man command prints documentation for any Linux command on the system. Check some of the examples below to see how to use it.
- 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.
- To navigate the man page, use your
Enterkey to move down one line, and your
spacekey to move down one whole page. To exit the man page at any time, just press the
qkey. You may also use the
Page Downkeys to scroll up or down.
- You can also search through all manuals with the
$ 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
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
- 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
Enterand your terminal will be brought to the first instance of this keyword.
- If you want to view the manual pages in a GUI, you can use the
$ yelp man:ls
- 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
infocommand 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.
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.