Skip to main content
Engineering LibreTexts

01-C.22: Man Page Format

  • Page ID
    26798
  • Man Pages and The Man Command

    Man pages are all formatted the exact same way. Conventional section names include NAME, SYNOPSIS, CONFIGURATION, DESCRIPTION, OPTIONS, EXIT STATUS, RETURN VALUE, ERRORS, ENVIRONMENT, FILES, VERSIONS, CONFORMING TO, NOTES, BUGS, EXAMPLE, AUTHORS, and SEE ALSO. However not every man page contains every one of these sections.

    To access a man page a user enters the man command. The man command in Linux is used to display the user manual of any command that we can run on the terminal. It provides a detailed view of the command. To display the man page for the man command we would enter:

    # The first man is the command, the second is the specific page we want to view
    pbmac@pbmac-server $ man man
    
    # Optionally we can specify the section number - there are 8 sections as described on the previous page
    pbmac@pbmac-server $ man -s 1 man
    

    The man page shown below is broken up in order to be able to discuss the sections - normally the output is all together.

    At the top of every man page, in the left and right corners, is the name of the command (in this case the man command). There is the NAME section, followed by the SYNOPSIS section which lists all of the options and arguments.

    MAN(1)                                         Manual pager utils                                         MAN(1)
    
    NAME
           man - an interface to the on-line reference manuals
    
    SYNOPSIS
           man [-C file] [-d] [-D] [--warnings[=warnings]] [-R encoding] [-L locale] [-m system[,...]] [-M path] [-S
           list] [-e extension] [-i|-I] [--regex|--wildcard] [--names-only] [-a] [-u] [--no-subpages] [-P pager] [-r
           prompt]  [-7]  [-E  encoding]  [--no-hyphenation]  [--no-justification]  [-p  string]  [-t]  [-T[device]]
           [-H[browser]] [-X[dpi]] [-Z] [[section] page[.section] ...] ...
           man -k [apropos options] regexp ...
           man -K [-w|-W] [-S list] [-i|-I] [--regex] [section] term ...
           man -f [whatis options] page ...
           man -l [-C file] [-d] [-D] [--warnings[=warnings]] [-R encoding] [-L locale] [-P pager] [-r prompt]  [-7]
           [-E encoding] [-p string] [-t] [-T[device]] [-H[browser]] [-X[dpi]] [-Z] file ...
           man -w|-W [-C file] [-d] [-D] page ...
           man -c [-C file] [-d] [-D] page ...
           man [-?V]
    

    This is immediately followed by a detailed DESCRIPTION of the command, its purpose, and other information about the command.

    DESCRIPTION
           man  is  the  system's  manual pager.  Each page argument given to man is normally the name of a program,
           utility or function.  The manual page associated with each of these arguments  is  then  found  and  dis‐
           played.  A section, if provided, will direct man to look only in that section of the manual.  The default
           action is to search in all of the available sections following a pre-defined order ("1 n l 8 3  2  3posix
           3pm  3perl 3am 5 4 9 6 7" by default, unless overridden by the SECTION directive in /etc/manpath.config),
           and to show only the first page found, even if page exists in several sections.
    

    There are often EXAMPLES of how to use the command. Not every single option is shown, but sufficient examples to help a user do what is being attempted, or whether to turn to some other resource for further assistance.

    EXAMPLES
           man ls
               Display the manual page for the item (program) ls.
    
           man man.7
               Display the manual page for macro package man from section 7.
    
           man -a intro
               Display,  in  succession, all of the available intro manual pages contained within the manual.  It is
               possible to quit between successive displays or skip any of them.
    
    

    The OPTIONS section does include each one of the options for a given command. Sometimes, even that doesn't provide the necessary clarity as to how or what a certain option does. Thank goodness for the plethora of web resources.

    OPTIONS
           Non  argument  options that are duplicated either on the command line, in $MANOPT, or both, are not harm‐
           ful.  For options that require an argument, each duplication will override the previous argument value.
    
       General options
           -C file, --config-file=file
                  Use this user configuration file rather than the default of ~/.manpath.
    
           -d, --debug
                  Print debugging information.
    

    Right near the end of the man page is the SEE ALSO section. This often provides valuable information about other commands that might be similar and might even be better to accomplish the user's goal. If you can't seem to figure out how to make a command behave the way you want, try looking at the SEE ALSO section and look up some of these commands as well.

    SEE ALSO
           apropos(1), groff(1), less(1), manpath(1), nroff(1), troff(1), whatis(1), zsoelim(1), setlocale(3),  man‐
           path(5), ascii(7), latin1(7), man(7), catman(8), mandb(8), the man-db package manual, FSSTND

    Adapted from:
    "man command in Linux with Examples" by AshwinGoel, Geeks for Geeks is licensed under CC BY-SA 4.0

    • Was this article helpful?