Monday, 3 April 2017

Linux Tutorial : Getting Help on Linux Part II

info Command

Man pages are great sources of information, but they do tend to have a few disadvantages. One example of a disadvantage is that each man page is a separate document, not related to any other man page. While some man pages have a SEE ALSO section that may refer to other man pages, they really tend to be unrelated sources of documentation.
The info command also provides documentation on operating system commands and features. The goal of this command is slightly different from man pages: to provide a documentation resource that provides a logical organizational structure, making reading documentation easier.
Within info documents, information is broken down into categories that work much like a table of contents that you would find in a book. Hyperlinks are provided to pages with information on individual topics for a specific command or feature. In fact, all of the documentation is merged into a single "book" in which you can go to the top level of documentation and view the table of contents representing all of the documentation available.
Another advantage of info over man pages is that the writing style of info documents is typically more conducive to learning a topic. Consider man pages to be more of a reference resource and info documents to be more of a learning guide.

1 Displaying Info Documentation for a Command

To display the info documentation for a command, execute info command(replace command with the name of the command that you are seeking information about). For example, the following demonstrates the output of the command info ls:
File: coreutils.info,  Node: ls invocation,  Next: dir invocation,  Up: Directo\ry listing                                                                      
                                                                       
10.1 `ls': List directory contents                                     
==================================                                              
                                                                      
    The `ls' program lists information about files (of any type, including directories).  Options and file arguments can be intermixed arbitrarily, as usual.                                                          
                                                                       
    For non-option command-line arguments that are directories, by    
default `ls' lists the contents of directories, not recursively, and   
omitting files with names beginning with `.'.  For other non-option    
arguments, by default `ls' lists just the file name.  If no non-option 
argument is specified, `ls' operates on the current directory, acting  
as if it had been invoked with a single argument of `.'.                        
                                                                       
    By default, the output is sorted alphabetically, according to the  
locale settings in effect.(1) If standard output is a terminal, the    
output is in columns (sorted vertically) and control characters are    
output as question marks; otherwise, the output is listed one per line 
and control characters are output as-is.                              
--zz-Info: (coreutils.info.gz)ls invocation, 58 lines --Top-------------
Welcome to Info version 5.2. Type h for help, m for menu item.
Notice that the first line provides some information that tells you where you are in the info documentation. This documentation is broken up into nodes and in the example above you are currently in the ls invocation node. If you went to the next node (like going to the next chapter in a book), you would be in the dir invocation node. If you went up one level you would be in the Directory listing node.

2 Moving Around While Viewing an info Document

Like the man command, you can get a listing of movement commands by typing the letter h while reading the info documentation:
Basic Info command keys                                                        
l           Close this help window.                                   
q           Quit Info altogether.                                     
H           Invoke the Info tutorial.                                           
Up          Move up one line.                                          
Down        Move down one line.                                        
DEL         Scroll backward one screenful.                             
SPC         Scroll forward one screenful.                              
Home        Go to the beginning of this node.                          
End         Go to the end of this node.                                         
TAB         Skip to the next hypertext link.                           
RET         Follow the hypertext link under the cursor.               
l           Go back to the last node seen in this window.                       
[           Go to the previous node in the document.                   
]           Go to the next node in the document.                       
p           Go to the previous node on this level.                    
n           Go to the next node on this level.                         
u           Go up one level.                                           
-----Info: *Info Help*, 466 lines --Top---------------------------------
Note that if you want to close the help screen, you type the letter l. This brings you back to your document and allows you to continue reading. To quit entirely, you type the letter q.
The following table provides a summary of useful commands:
CommandFunction
Down arrow ↓Go down one line
SpaceGo down one page
sSearch for term
[Go to previous node
]Go to next node
uGo up one level
TABSkip to next hyperlink
HOMEGo to beginning
ENDGo to end
hDisplay help
LQuit help page
qQuit info command
If you scroll through the document, you will eventually see the menu for the lscommand:
* Menu:                                                                         
                           
* Which files are listed::                     
* What information is listed::                 
* Sorting the output::                          
* Details about version sort::                   
* General output formatting::                    
* Formatting file timestamps::                    
* Formatting the file names::                                                   
                                         
   ---------- Footnotes ----------                                              
          
 (1) If you use a non-POSIX locale (e.g., by setting `LC_ALL' to 
`en_US'), then `ls' may produce output that is sorted differently than
you're accustomed to.  In that case, set the `LC_ALL' environment     
variable to `C'.                                                                
--zz-Info: (coreutils.info.gz)ls invocation, 58 lines --Top-------------
The items under the menu are hyperlinks that can take you to nodes that describe more about the ls command. For example, if you placed your cursor on the line "* Sorting the output::" and pressed the Enter key, you would be taken to a node that describes sorting the output of the ls command:
File: coreutils.info,  Node: Sorting the output,  Next: Details about version s\ort,  Prev: What information is listed,  Up: ls invocation                      
10.1.3 Sorting the output                                             
-------------------------                                                      
These options change the order in which `ls' sorts the information it  
outputs.  By default, sorting is done by character code (e.g., ASCII   
order).                                                                         
                                                                      
`-c'                                                                  
`--time=ctime'                                                        
`--time=status'                                                        
     If the long listing format (e.g., `-l', `-o') is being used, print 
     the status change time (the `ctime' in the inode) instead of the  
     modification time.  When explicitly sorting by time (`--sort=time'
     or `-t') or when not using a long listing format, sort according  
     to the status change time.                                                 
                                                                    
`-f'                                                                  
     Primarily, like `-U'--do not sort; list the files in whatever     
     order they are stored in the directory.  But also enable `-a' (lis
--zz-Info: (coreutils.info.gz)Sorting the output, 68 lines --Top--------
Note that by going into the node about sorting, you essentially went into a sub-node of the one in which you originally started. To go back to your previous node, you can use the u key. While u will take you to the start of the node one level up, you could also use the l key to return you exactly to the previous location that you were before entering the sorting node.

3 Exploring info Documentation

Instead of using info documentation to look up information about a specific command or feature, consider exploring the capabilities of Linux by reading through the info documentation. If you execute the info command without any arguments, you are taken to the top level of the documentation. From there you can explore many features:
File: dir,      Node: Top       This is the top of the INFO tree                
  This (the Directory node) gives a menu of major topics.              
  Typing "q" exits, "?" lists all Info commands, "d" returns here,    
  "h" gives a primer for first-timers,                                
  "mEmacslt" visits the Emacs manual, etc.                               
  In Emacs, you can click mouse button 2 on a menu item or cross referen  ce to select it.                                                                 
* Menu:                                                                        

Basics                                                                 
* Common options: (coreutils)Common options.                           
* Coreutils: (coreutils).       Core GNU (file, text, shell) utilities.
* Date input formats: (coreutils)Date input formats.                   
* File permissions: (coreutils)File permissions.                      
                           Access modes.                          
* Finding files: (find).   Operating on files matching certain criteria.   
                                                                       
C++ libraries                                                        
* autosprintf: (autosprintf).  Support for printf format strings in C+
-----Info: (dir)Top, 211 lines --Top------------------------------------
Welcome to Info version 5.2. Type h for help, m for menu item.

Additional Sources of Help

In many cases, you will find that either man pages or info documentation will provide you with the answers you need. However, in some cases, you may need to look in other locations.

1 Using the --help Option

Many commands will provide you basic information, very similar to the SYNOPSIS found in man pages, when you apply the --help option to the command. This is useful to learn the basic usage of a command:
sysadmin@localhost:~$  ps --help                                              
********* simple selection *********  ********* selection by list *********   
-A all processes                      -C by command name                      
-N negate selection                   -G by real group ID (supports names)    
-a all w/ tty except session leaders  -U by real user ID (supports names)     
-d all except session leaders         -g by session OR by effective group name
-e all processes                      -p by process ID                        
T  all processes on this terminal     -s processes in the sessions given     
a  all w/ tty, including other users  -t by tty                               
g  OBSOLETE -- DO NOT USE             -u by effective user ID (supports names)
r  only running processes             U  processes for specified users        
x  processes w/o controlling ttys     t  by tty                               
*********** output format **********  *********** long options ***********    
-o,o user-defined  -f full            --Group --User --pid --cols --ppid      
-j,j job control   s  signal          --group --user --sid --rows --info      
-O,O preloaded -o  v  virtual memory  --cumulative --format --deselect        
-l,l long          u  user-oriented   --sort --tty --forest --version         
-F   extra full    X  registers       --heading --no-headi
                    ********* misc options *********                          
-V,V  show version      L  list format codes  f  ASCII art forest             
-m,m,-L,-T,H  threads   S  children in sum    -y change -l format             
-M,Z  security data     c  true command name  -c scheduling class             
-w,w  wide output       n  numeric WCHAN,UID  -H process hierarchy            
sysadmin@localhost:~$

2 Additional System Documentation

On most systems, there is a directory where additional documentation is found. This will often be a place where vendors who create additional (third party) software can store documentation files.
Typically, this will be a place where system administrators will go to learn how to set up more complex software services. However, sometimes regular users will also find this documentation to be useful.
These documentation files are often called "readme" files, since the files typically have names such as README or readme.txt. The location of these files can vary depending on the distribution that you are using. Typical locations include /usr/share/doc and /usr/doc.









































Load disqus comments

0 comments