Linux man command - Linux help tutorial

In the beginning, many people restrain to use Linux and one of the reason is they afraid because Linux is a free operating system and doesn't come with warranty and customer's support. Although most people aware that Linux works great with its big potential but that reason seems strong enough to hold them back.

Actually, Linux comes with many great helping tools. We can't say Linux doesn't need customer's support at all but one thing to consider, Linux is the operating system that teach its users. It provides information and helps that user needs within the Linux operating system itself. What I mean is, Linux comes with great tools that user can always refer to whenever they need it. One of the most useful tool to get help in Linux system is the Linux online manual pages.

Linux manual pages

Linux manual page is a great help that comes together with Linux operating system. User can access Linux manual page by invoking man command at the command line interface. Linux man command formats and displays the online Linux manual pages. The Linux manual has 8 standard sections which are:

  1. User Commands
  2. System Calls
  3. C Library Functions
  4. Devices and Special Files
  5. File Formats and Conventions
  6. Games et. Al.
  7. Miscellanea
  8. System Administration tools and Deamons

Linux distributions customize the manual section to their specifics, which often include additional sections.

SYNOPSIS
       man  [-acdfFhkKtwW]  [--path]  [-m system] [-p string] [-C config_file]
       [-M pathlist] [-P pager] [-B browser] [-H htmlpager] [-S  section_list]
       [section] name ...


DESCRIPTION
       man formats and displays the on-line manual pages.  If you specify sec-
       tion, man only looks in that section of the manual.  name  is  normally
       the  name of the manual page, which is typically the name of a command,
       function, or file.  However, if name contains  a  slash  (/)  then  man
       interprets  it  as a file specification, so that you can do man ./foo.5
       or even man /cd/foo/bar.1.gz.

       See below for a description of where man  looks  for  the  manual  page
       files.

As you can see, Linux man command offers several options for user to specify the details such as provides a specific path, search in specific manual database sections and displays the output in different format. It can also be as simple as it can be, for an example, if you want to just print help on the monitor's screen, then, issue:

luzar@slackware:~$ man man

That will print the manual page for Linux man command on the screen. You'll see a result similar to the picture below:

Linux man manual page screenshot image

If you perhaps want to copy the man page to a specific file and print the hard copy to read it later, then the command should be:

luzar@slackware:~$ man man | col -b > /luzar/manual.txt 

The | is called pipe and the key location is on the left of the backspace key on your keyboard.

The col -b option is to get a plain text version without backspaces and underscores

The > is called redirection and it means please write in this file I mention here.

The /luzar/manual.txt is the path and the name of the file.

With Linux man command, we can view other commands available in Linux system to learn about that command. Let's say we need help on ls command, we just type man ls and enter:

luzar@slackware:~$ man ls

In Linux manual page about Linux commands, we can find 3 important information:

  • NAME - Shows the name of the command and a brief information about what it does.
  • SYNOPSIS - Shows the command's syntax and available options that can be used with the command.
  • DESCRIPTION - Explains more about the command.
  • OPTIONS - Available options that can be used with the command. Some commands required option while some can be used with no option. Options enable user to customize the command, change the scope of default value the command offers, and many more depends on the command.
  • TIPS or EXAMPLES - Some commands provide tips and usage examples.
  • AUTHOR - Name of person who writes the command and his email address. (Thank you sir!)
  • SEE ALSO - Related commands.

Here is more information about options available for Linux man command:

man, version 1.6f

usage: man [-adfhktwW] [section] [-M path] [-P pager] [-S list]
        [-m system] [-p string] name ...

  a : find all matching entries
  c : do not use cat file
  d : print gobs of debugging information
  D : as for -d, but also display the pages
  f : same as whatis(1)
  h : print this help message
  k : same as apropos(1)
  K : search for a string in all pages
  t : use troff to format pages for printing
  w : print location of man page(s) that would be displayed
      (if no name given: print directories that would be searched)
  W : as for -w, but display filenames only

  C file   : use `file' as configuration file
  M path   : set search path for manual pages to `path'
  P pager  : use program `pager' to display pages
  S list   : colon separated section list
  m system : search for alternate system's man pages
  p string : string tells which preprocessors to run
               e - [n]eqn(1)   p - pic(1)    t - tbl(1)
               g - grap(1)     r - refer(1)  v - vgrind(1)

Linux man command examples

You can see some of man command's options which normally used to customize the result in all the examples below.

Linux man command with -a option prints all matching entry:

luzar@slackware:~$ man -a man
MAN(1)                        Manual pager utils                        MAN(1)

NAME
       man - an interface to the on-line reference manuals

SYNOPSIS
       man  [-c|-w|-tZ] [-H[browser]] [-T[device]] [-X[dpi]] [-adhu7V] [-i|-I]
       [-m system[,...]] [-L locale] [-p  string]  [-C  file]  [-M  path]  [-P
       pager]  [-r  prompt]  [-S  list] [-e extension] [--warnings [warnings]]
       [[section] page ...] ...
       man -l [-7] [-tZ] [-H[browser]] [-T[device]] [-X[dpi]] [-p string]  [-P
       pager] [-r prompt] [--warnings[warnings]] file ...
       man -k [apropos options] regexp ...
       man -f [whatis options] page ...

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 displayed. 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 and to show only the first page
       found, even if page exists in several sections.

The example above is the first man result. To see the next manual page, press q to quit the current man. You'll get the menu like in the example below:

luzar@slackware:~$ man -a man
--Man-- next: man(7) [ view (return) | skip (Ctrl-D) | quit (Ctrl-C) ]

Press enter or return key to view next man result. You can skip the result by pressing ctrl+D. Press ctrl+C to quit. If you press enter, you'll get the next man result like the example below:

MAN(7)                     Linux Programmer’s Manual                    MAN(7)

NAME
       man - macros to format man pages

SYNOPSIS
       groff -Tascii -man file ...

       groff -Tps -man file ...

       man [section] title

DESCRIPTION
       This manual page explains the groff an.tmac macro package (often called
       the man macro package).  This macro package should be used by  develop‐
       ers when writing or porting man pages for Linux.  It is fairly compati‐
       ble with other versions of this macro package,  so  porting  man  pages
       should  not  be  a  major  problem  (exceptions  include  the NET-2 BSD
       release, which uses a totally different macro package called mdoc;  see
       mdoc(7)).

That's another result of man command with -a option. Press q to quit the manual page.

This is the example of man command with -k option which can be used to search the short descriptions and manual page names for the keyword mention as regular expression.

luzar@slackware:~$ man -k mkdir
mkdir (1)            - make directories
luzar@slackware:~$

The man command with -f option can be used to lookup the manual pages referenced by keyword mentioned and print out the short descriptions of any found. See the example below:

luzar@slackware:~$ man -f less
less (1)             - opposite of more
luzar@slackware:~$

That all. Perhaps that covers almost all important information you need to know about Linux man command. Linux has many commands and it's impossible to remember all the commands' options. So, use man command to learn more about new Linux commands everyday.

Back to Linux basic commands main page.


Post new comment

The content of this field is kept private and will not be shown publicly.
This blog uses the CommentLuv Drupal plugin which will try and parse your sites feed and display a link to your last post, please be patient while it tries to find it for you.

Custom Search