Regular, when writing a command - both easy and complex ones - one will want to access more detailed information about the command and it’s available options. There is a wealth of information available in the Linux manual pages, and this is provided free of charge, and is available with just a few keystrokes.

In this tutorial you will learn:

  • How to access the manual page for a given command
  • How to access inline help for a given command
  • How to search all manuals for a given search term
  • How to access manual pages for builtin commands
  • How to access the manual using a GUI (graphical user interface)
  • Examples showing various manual usage use cases
How to Access Manual Pages for Linux Commands
How to Access Manual Pages for Linux Commands

Software requirements and conventions used

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Linux Distribution-independent
Software Bash command line, Linux based system
Other Any utility which is not included in the Bash shell by default can be installed using sudo apt-get install utility-name (or yum install for RedHat based systems)
Conventions # - requires linux-commands to be executed with root privileges either directly as a root user or by use of sudo command
$ - requires linux-commands to be executed as a regular non-privileged user

Example 1: Access the Manual Page for a Given Command

Accessing the Manual Page for a given command could not be easier while you are working on the command line. Simply prefix the command with man:

man ls

Will bring up the manual page for the ls command!

Within this page, simply type / to start entering a search term to look for. For example, in the ls command manual, one could type /directory to look for the word directory. If you press the n key you will be taken to the next occurrence of that word etc. You can also use ? followed by a search term (without space) to search upwards. This is handy if you are at the end of the file and want to search upwards.

Press q to exit the manpage screen.

Example 2: How to Access Inline Help for Commands

As an alternative to using the manual through man, we can also access terminal inline help for any command. This will often prove to be a faster route in daily use. To do so, simply specify --help at the end of any command:

$ ls --help | head -n10
Usage: ls [OPTION]... [FILE]...
List information about the FILEs (the current directory by default).
Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.

Mandatory arguments to long options are mandatory for short options too.
  -a, --all                  do not ignore entries starting with .
  -A, --almost-all           do not list implied . and ..
      --author               with -l, print the author of each file
  -b, --escape               print C-style escapes for nongraphic characters
      --block-size=SIZE      with -l, scale sizes by SIZE when printing them;

If the output is too long to fit in your terminal window and scrolls, you can use | more to pause at the end of every screen-full of text:

ls --help | more
      --hide=PATTERN         do not list implied entries matching shell PATTERN

Subscribe to RSS and NEWSLETTER and receive latest Linux news, jobs, career advice and tutorials.

And press space to obtain the next page full of text.

Example 3: Searching through all manuals

You can also search through all manuals. First update the manual database by using the mandb command:

$ mandb
0 man subdirectories contained newer manual pages.
0 manual pages were added.
0 stray cats were added.
0 old database entries were purged.

And then use man -k your_search_term to search for a search term:

$ 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 man section command where command is the command searched for (for example ls) and section is the section as seen in the search results above.

man 8 lsblk

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 command’s in your operating system.

Example 4: Access the Manual Page for Built-in Commands

Have you ever run into a situation like this:

$ man fg
No manual entry for fg

fg (foreground) is a Bash-shell builtin command. It is builtin the core Bash shell. To access the manual for this, there are two strategies one can use. The first is to try the help command:

$ help fg
fg: fg [job_spec]
    Move job to the foreground.

    Place the job identified by JOB_SPEC in the foreground, making it the
    current job.  If JOB_SPEC is not present, the shell's notion of the
    current job is used.

    Exit Status:
    Status of command placed in foreground, or failure if an error occurs.

And whilst there is no man page for help, help can help itself:

$ help help | head -n2
help: help [-dms] [pattern ...]
    Display information about builtin commands.

The second strategy is to look for the information from within the shell interpreter command itself. For example, for the Bash shell, once can do:

$ man bash

And then use /fg as a command to search for fg within the manual. Press n to search for the next occurrence etc.

If you are interested in learning more about advanced process management at the Bash command line, please read our Multi-threaded Bash Scripting Process Management at the Command Line article!

Example 5: Using a GUI to View Manpages

If you want to view the manual pages in a GUI, you can use yelp:

yelp man:ls

Will bring up a new window with a graphical frontend to the ls manpage.

Yelp showing the manual page for ls


In this article, we explored how to access the manual page for given commands, how to access inline help and how to access the manual using a GUI (graphical user interface). We also looked at how to access manual pages for builtin commands, and how to search the manual. Enjoy browsing and searching the manuals and leave us a comment with your best man tips!

Submit your RESUME, create a JOB ALERT or subscribe to RSS feed.
Subscribe to NEWSLETTER and receive latest news, jobs, career advice and tutorials.
Get extra help by visiting our LINUX FORUM or simply use comments below.

Comments and Discussions