Inscrivez-vous maintenant pour un meilleur devis personnalisé!

What are man pages and why are they important to your Linux education?

Le 31 mai 2022 Hi-network.com
ls [OPTION] a?| [FILE] a?|

As you begin your journey with Linux, you'll find things are far easier than you originally assumed. This is especially so on the desktop, where everything is a point-and-click affair and you could go your entire life without ever having to touch the command line. 

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!)

Recommends

The best Linux Foundation classes

Want a good tech job? Then you need to know Linux and open-source software. One of the best ways to learn is via a Linux Foundation course.

Read now

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. 

What are man pages?

Man pages are simply manual pages created to help users understand how commands are used in Linux. These pages are installed, by default, alongside the commands. As long as the software developer created a man page, it'll be there to help explain how to use a specific command.

What's interesting about this system is that it depends on a command itself. That command is man, which serves as an interface to the system reference manuals.

Man pages are laid out fairly in a fairly simple fashion but can be a bit daunting at first. Let's break down the structure of these 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 manls, which will open the manual page (Figure 1).

Viewing the manual page for the ls command.

Image: Jack Wallen

As you can see, the ls man page lays out the structure of the command in the SYNOPSIS section as such:

ls [OPTION] a?| [FILE] a?|

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 thelscommand 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

tag-icon Tags chauds: Services et logiciels Systèmes d’exploitation LINUX

Copyright © 2014-2024 Hi-Network.com | HAILIAN TECHNOLOGY CO., LIMITED | All Rights Reserved.