• Because Linux is an open operating system, it draws contributions from many sources.


  • As a result, you can get help in documentation from many sources, as well.


  • Most things you're doing have extensive and well-made documentation, but there are cases where the documentation is simply lacking.


  • That's because sometimes developers think what they have done is so obvious, no help or documentation is needed, and other times they're just too bored to write documentation and especially for volunteer projects, sometimes it's hard to pay people to write documentation.


  • However, that's the relatively rare case.


  • Usually, there's plenty of documentation, and distributors play an important role in organizing coherently that documentation and make it easy to find and search.


  • You can also get, of course, technical support for a fee from commercial distribution in independent companies.


  • There are three basic command line tools people use to get documentation


  • There's the man pages or manual pages, which go back to the earlier stages of Linux.


  • Basically, everything on the system must have a man page as a general rule.


  • info is a hyperlinked system of help, that's probably the first hyperlink system of help ever used. It comes from the Free Software Foundation's GNU project and then most commands have a help option you can give, which tells you a basic syntax of the command and its options, and the shell interpreter has a help command which you can type help and in the name of a command and, for a lot of the commands, you can get basic documentation that way.


  • man is the workhorse of Linux documentation, as it has been on all UNIX-like operating systems since their inception. Its name is short for manual. In fact, the first edition of the UNIX Programmer’s Manual was released in 1971 and was probably the first case of online documentation.


  • It is most often invoked from the command line in a terminal window. For a random example (with a short man page!):


  • manzgrep
  • The above screenshot displays the most common standard sections: NAME, SYNOPSIS, DESCRIPTION, OPTIONS, SEE ALSO, and BUGS. Other sections that might appear include: RETURN VALUE, ERRORS, CONFORMING TO, RESTRICTIONS, AUTHOR, COPYRIGHT, REPORTING BUGS, and EXAMPLES.


  • When you invoke man at a terminal window, it will automatically pipe its output into your pager, which on most Linux systems is less; on older systems, it may be more. You can change this by altering the value of the PAGER environment variable.


  • In addition, there are sometimes chapters with a p or x suffix, such as 1p, or 3x, where the p stands for the POSIX standard specifications, and x stands for X Window System documentation. Other subsections may be present as well on your system.


  • One complication is that many keywords can have more than one man page. For instance, socket has at least two different man pages, in chapters 2 and 7. You can look at any one of them by specifying the particular chapter, as in:


  •  
    $ man 7 socket
     
    
  • or you can see all of them in sequence by doing:


  •  
    $ man -a socket
     
    
  • man has a lot of options (do man man), some of which have utility short hand forms. For example, by doing either of these commands:


  •  
    $ whatis socket
    $ man -f socket
     
    
  • you will get a list of all man pages that have socket in their name. Likewise, if you do either of the commands:


  •  
    $ apropos socket
    $ man -k socket
     
    
  • you will get a list of all man pages that discuss sockets, whether or not it is in their name.


  • info is a simple-to-use documentation system, hypertextual in nature, although it does not require a graphical browser.


  • The documentation is built using the Texinfo system, which is a reader you need know nothing about.


  • You may have noticed that many man pages say you can get more detailed information by running info on the command, such as in:


  •  
    $ info ls
     
    
  • This pops you into a documentation page, which you can page through by hitting the space bar. Other key bindings are:


  • Key Function
    n Go to next node
    p Go to previous node
    u Go to upper node
    l Go to last visited node
    space or PageDown Go to next page
    delete\verb or backspace or PageUp Go to previous page
    / or CTL-s Search for the string prompted for
    i Search for a node containing the string prompted for
  • You will notice we distinguish between nodes and pages. The info page is a hierarchical tree of nodes, each of which may have multiple pages, or screenfuls.


  • infoubuntu
  • Lines which begin with an asterisk (*) are nodes which you can jump to by moving to that line (with the arrow keys for example) and then hitting return.


  • info is easier to use than it is to describe. It often contains more exhaustive information than the man page, but sometimes it just regurgitates it.


  • Many of the commands on your system will generate a brief discussion of usage and options if you run them with the --help option. For example, trying this with rm by doing rm --help gives the output seen in the screenshot below.


  • helprm
  • This is often all you need and can be consumed much quicker than running man or info.


  • There is also a help command, which is actually part of the bash shell, and only gives information about commands which are actually part of the shell itself. Typing help by itself generates the screenshot shown below,


  • helpbash
  • and information on a particular command can be done as in:


  •  
    $ help pwd
    
    pwd: pwd [-LP]
        Print the current working directory.  With the -P option, pwd prints
        the physical directory, without any symbolic links; the -L option
        makes pwd follow symbolic links.
         
    
  • It is important to note that there are programs which have two incarnations, one in the bash shell and one as a standalone program. For example, these two commands are similar but not identical:


  •  
    $ echo hello
    $ /bin/echo hello
     
    
  • By default, the command built into the shell is invoked, rather than the one in the path. Likewise, the results of man echo and help echo are not the same. This can be confusing.


  • Often, there are multiple man pages (in different chapters of the manual) for a given topic. As an example, we will give stat.


  • If you just do:


  •  
        $ man stat
    STAT(1)                          User Commands                        STAT(1)
    
    NAME
          stat - display file or file system status
    
    SYNOPSIS
          stat [OPTION] FILE...
    
    DESCRIPTION
             Display file or file system status.
    
    .....
         
    
  • you will get a description of the command line utility.


  • Try doing:


  •  
        man -k stat
        
    
  • which is equivalent to doing apropos stat. You will get a long list of man pages that reference the string stat.


  • To narrow the list down to pages that are an exact match, do:


  •  
        man -f stat
        
        
    
  • and then you can get the page from chapter two by doing:


  •  
        man 2 stat
        
         
    
  • If you want to see all the pages, you can do:


  •  
     man -a stat   
        
    
  • and then you can see each of the relevant chapters in turn, typing q after each one is displayed to proceed the next one.