That’s a far cry from when I first started my Linux journey (back in ‘96), at which point the terminal was an absolute necessity. Nearly everything I did required some level of command-line usage. Also: How to install Ubuntu Linux (It’s easy!) Because of that, I spent a good amount of time RTFMing (look it up) my way through Linux. Thankfully, there has almost always been a built-in system for reading those manuals, called man pages. 

The structure of a man page

Man pages are all laid out with specific sections, which include:

NAME - the name of the command in question.SYNOPSIS - the structure of the command.DESCRIPTION - a description of the command.OPTIONS - available options for the command.AUTHOR - the author of the command.REPORTING BUGS - instructions on reporting bugs to the developer(s).COPYRIGHT - information about command license.SEE ALSO - points to full documentation or related commands.CONFIGURATION - configuration details for a command or device.EXIT STATUS - possible exit status values.

Not every man page will include every section you see above, but they most always have the basics (NAME, SYNOPSIS, OPTIONS), so you can get up to speed on the command. Some man pages even include examples of how the command is used and many man pages will list out every single option available to the command. 

How to view a man page

Let’s say you want to find out all the options available for the ls command. For that, issue the command man ls, which will open the manual page (Figure 1). As you can see, the ls man page lays out the structure of the command in the SYNOPSIS section as such: What that means is this:

ls - the command to be used.[OPTION] - options you want to pass to the command.[FILE] - the file you want to use ls with.

Of course, not every command requires options and/or files. For instance, you could run the ls command in any directory (sans options or files) to view a listing of files. Unfortunately, not every man page makes the clear, so you might have to figure that one out for yourself (or with the help of ZDNet…or Google). Once you have the man page open, you can scroll through either using the space bar (to scroll one page at a time) or the arrow keys on your keyboard (to scroll one line at a time).

Man Sections

This is where man pages do get a bit confusing. Some man pages are comprised of sections, each of which describes a different aspect of the command. This is especially so when a man page is considerably more complicated or if there are related commands.  For example, if you want to view the man page for the man command (it exists), you’d issue the command man man. Scroll through that and you’ll find a reference that looks like man(7), which means there are more sections to view.  To view a specific section of a man page, you’d issue the command man 7 man, which will display section 7 of the man manpage. To find out the different sections in the man manpage, issue the command man -f man, which will display two sections (Figure 2). Not every man page will have multiple sections. For example, issue the command man -f ls and you’ll see only one section listed. The mkdir man page includes two sections:

mkdir (1) - make directoriesmkdir (2) - create a directory

Seems to me that make and create are the same thing. If you issue the command man 1 mkdir you’ll see a manpage that describes how to use the mkdir command. Issue the command man 2 mkdir the difference becomes quite clear. The 1 section is about how users can make use of the command, whereas the 2nd section is about how developers can use the command. In fact, it states it very clearly at the top of each page:

mkdir(1) - User Commandsmkdir(2) - Linux Programmer’s Manual

In other words, the first section targets users, and the other sections target developers. That’s not always the case but it’s a fairly safe bet.

Finding the right man page

Another very handy trick with man pages can help you find the man page you’re looking for. Say, you know there’s a grep-adjacent command, but you can’t remember what it’s called. If you issue the command man -k grep, you’ll see a listing of all man pages that contain the phrase “grep” in their name (Figure 3). Figure 3 By using this feature, you might be able to locate that man page, even if you can’t remember the exact name of the command. And that’s all there is to using man pages in Linux. If you’re a casual desktop user, you might never have to touch this help system. If, however, you plan on eventually moving up the ladder of Linux usage (such as server administration), the man command could easily become your best tech friend.