Skip to main content

How to find out what a Linux command does

Learn how to locate, read, and use Linux system documentation with man, info, and /usr/share/doc files.
Image
Hands typing on keyboard

Linux distributions contain three powerful sets of documentation to enable users and administrators to get the most out of the system. Knowing how to use these resources effectively is an essential skill for Linux users.

Here are the three documentation sets:

  • Man pages
  • Info pages
  • /usr/share/docs

The man pages

Man pages are the go-to resource for nearly every Linux user working at the command line.

What can you discover via the man pages?

  • The command's summary
  • Options and explanations
  • Examples
  • Author and maintainer

This is perfect for when you cannot recall less commonly used options or work on multiple operating system platforms daily (the options between Linux and Unix versions of commands often differ).

Using the man pages is straightforward; simply type the man command and include the command you need more information about. For example, to display the manual for the ls command, type man ls.

Man pages include a powerful set of search capabilities to help you find exactly what you need. Once the man page is displayed, type a forward slash (/) to enable keyword searching. Simply enter the word you're looking for after the slash and select Enter. Use the n and N keys to find the next or previous example of the keyword. Use Ctrl+C to end the search.

Man pages are organized into the following sections:

  • User commands (section 1)
  • System calls (section 2)
  • C library functions (section 3)
  • Devices and special files (section 4)
  • File formats and conventions (section 5)
  • Games (section 6)
  • Miscellanea (section 7)
  • System administration tools and daemons (section 8)

Typically, a request for a man page goes to section 1 or 8, but you can specify the section (assuming the requested command exists in multiple sections) by typing:

$ man 1 ls

Comfort with accessing man pages and defining keyword searches is an essential Linux user skill. In fact, system documentation in general, and man pages specifically, are called out in the Red Hat Certified System Administrator (RHCSA) exam objectives.

[ See how your operating system is the foundation that solidifies and unifies your IT infrastructure in Why the operating system matters. ]

The info command

The info pages play a similar role to man pages, though they tend to be a little more user-friendly. The man pages are basically a short, terse reference, while info pages tend more toward readability and deeper explanations. The info page system also supports basic linking between documents for easier cross-referencing. This provides a more structured and readable documentation set.

The syntax for info pages is the same as with man:

$ info ls

Documentation

More formal documentation, along with templates, tutorials, licenses, and some configuration files, is found at /usr/share/doc. The files provide significantly more detail than man pages. These package-specific files are usually compressed, but tools such as vim and less handle the content seamlessly.

[ Learn more about Linux in the free training course Red Hat Enterprise Linux Technical Overview. ]

You can see what documentation is available by typing:

 $ ls /usr/share/docs | less

Each package has its own subdirectory. Run the following command to see the documentation for the Nano text editor:

$ ls /usr/share/doc/nano

The challenge

To help you practice using these resources, I've included three simple challenges involving the Nano text editor (so make sure Nano is installed before accomplishing these). The answer key is at the end of the article if you need it.

  1. How do you remove the two help lines at the bottom of Nano?
  2. Find the Nano bug tracker URL.
  3. What is the "wonderfully easy-to-use and friendly text editor" that Nano is based on?

Wrap up

Not all systems are internet-connected, and not all reminders need to come from advanced Google searches. Sometimes all a sysadmin needs is a quick hint, "Oh yeah, that's the option for long format." Man pages are great for those short prompts. Info pages add more detail, better linking between resources, and more readability. The official documentation stored at /usr/share/doc provides the most depth, examples, templates, license information, and other relevant resources.

Answer key:

  1. -x or --nohelp
  2. https://savannah.gnu.org/bugs/?group=nano
  3. pico (Pine composer)

Check out these related articles on Enable Sysadmin

Author’s photo

Damon Garn

Damon Garn owns Cogspinner Coaction, LLC, a technical writing, editing, and IT project company based in Colorado Springs, CO. Damon authored many CompTIA Official Instructor and Student Guides (Linux+, Cloud+, Cloud Essentials+, Server+) and developed a broad library of interactive, scored labs. He regularly contributes to Enable Sysadmin, SearchNetworking, and CompTIA article repositories. Damon has 20 years of experience as a technical trainer covering Linux, Windows Server, and security content. He is a former sysadmin for US Figure Skating. He lives in Colorado Springs with his family and is a writer, musician, and amateur genealogist. More about me

Red Hat Summit 2022: On Demand

Get the latest on Ansible, Red Hat Enterprise Linux, OpenShift, and more from our virtual event on demand.

Related Content

OUR BEST CONTENT, DELIVERED TO YOUR INBOX