Getting Help From Linux - Part 2 Info
Well here we are again, at part two of the 'Getting Help from Linux' series. In this blog post I'll be talking about using Info to get help from Linux. In my previous post I spoke about how Info came about, but just in case you missed it I'll give you another quick lesson. Gnu Info was created by the Free Software Foundation and in my experience is used by all of Gnu's software for their version of 'man' pages. Info may contain much more information than what you can find in Man pages, and sometimes contains much more than you ever really need. The good thing about Info is that it is a hypertext markup utility. This makes it much easier to navigate through via hyperlinks embedded in emacs, than simply using arrow keys to navigate through information. While Man uses the Less utility to control the display, the info utility itself is designed to display Info pages. For those of you familiar with emacs, it appears the layout may be the same, along with some of the basic navigation. But that's where the two applications can differ. If you're using the Info application then your commands will be different than if you're viewing info files in Emacs. This article is about reading Info pages inside of info.
Layout and Navigation
Okay, I won't lie, navigation in emacs makes my head spin. For some people this may come naturally, for those of us that have lived on vi all their lives the old adage 'you can't teach an old dog new tricks' really hits home when it comes to figuring out all of the emacs tips and tricks. If anyone has actually gone through gnu.org's website on the Texinfo manual you know what I'm talking about. The document on how to use Texinfo is 36 pages long, quite a bit longer than navigating Man pages in Less. As far as layout goes, sections are broken down into what Info considers 'nodes', so if you see the reference to nodes in here then that's what I'm talking about. As stated earlier, the info documents are written in hypertext, which makes it easier to navigate through than Man pages. When you first execute 'info <name>' you are presented with the index for the subject that you are looking for. Now before you start hyperventilating, think of the Info layout as a Tree (Top Node) with various branches spanning from the tree (Individual Nodes). The Branches just point back to the main 'branch'.
Before I get ahead of myself, let me first explain the main window.
At the bottom of your window is what is called the Mode Line. The mode line just describes what you are viewing above, including information about the file, the node, number of lines, compression information, etc. Here are some examples and explanations of Mode Lines:
zz-Info: (festival.info.gz)Top, 58 lines --Top-- Subfile:
*zz=Compressed file, Info=Using Info to Navigate, festival.info.gz=name of
compressed files, 58 lines=Number of lines in node, festival.info-1.gz=Subfile
containing more information
zz-Info: (screen.info.gz)Commands, 27 lines --All-- Subfile: screen.info-1.gz
*zz=Compressed file, Info=Using Info, screen.info.gz=name of compressed file,
27 lines=number of lines in node, screen.info-1.gz=Subfile containing more
This might be useful to some, especially if you want to get your hands on the info file for further analysis. When you first open the document, at the top of the document you will see something like this: File: festival.info, Node: Top, Up: (dir). File is festival.info, Node is Top, Up is main directory.
That takes care of the layout portion of Info, there are many more advanced layout portions that you can get into if you wish to explore this further, such as moving windows and texts, echo areas, and so on and so forth. But as this is just a basic guide to getting information with Info, I won't be covering that here. However, if you do want more information on this, some of your basic emacs commands work just as well in Info, so if you're familiar with emacs you
won't have a problem with windowing with your info pages
How about navigation? If you know how to navigate around vim or emacs then this will be a piece of cake. I haven't gone into the advanced topics of navigation for a reason. Advanced topics include windowing, manipulating windows, moving text in windows, and so on and so forth.
Below is a table that outlines your basic navigation. The 'C' character is your Ctrl key, and 'M' stands for Meta. For some people Meta is Alt, and for some it's the Esc key. So if a key binding calls for 'C-n' that would mean hold down your Ctrl key and push the letter n.
Next Line: C-n or <Down> arrow key
Previous Line: C-p or <Up> arrow key
Beginning of Line: C-a or <Home> key
End of Line: C-e or <End> key
Forward 1 Character: C-f or <Right> arrow key
Backward 1 Character: C-b or <Left> arrow key
Forward 1 Word: M-f or C-<Right> arrow key
Backward 1 Word: M-b or C-<Left> arrow key
Beginning of Node: M-<
End of Node: M->
End of Current Node: e Quit q
Next Node: n
Previous Node: p
Up a Node: u
Last Node Viewed: l
Top Node: t
Directory Node: d
First Node: <
Last Node: >
Global Next Node: ]
Global Previous Node: [
From this table you can see that Man navigation and Info navigation can both be navigated with arrow keys, but then there are added commands for moving around nodes. Keep in mind though, hypertext language is being used and there is a lot more information in Info pages than there are in Man pages. So because of this, there had to be a way of navigating the complex labyrinths of indexes.
Searching Info Pages
Well now that you've figured out how to get around Info pages, it's time to find what you're looking for. Just like with Man, you can do apropos searches from the command line to search every index of all Info files for keywords with: info --apropos=string , or info -x string. This will list all instances where the string is listed. Now what do you do once you're actually in the lengthly Info page and need to find information? Well there's an
app command for that!
Search Forward: s(string) or /(string)
Search Backwards: ?(string)
Search Case-Sensitive: S(string)
Next word in Search: n
Next word Case-Sensitive: N
Interactively Search Forwards: C-s(string)
Interactively Search Backwards: C-r(string)
Index Search: i(string)
Next Index Search: ,
As you can see, some of the search keywords are just like vim commands, so if you're familiar with Vim, this should be a piece of cake. One of the gems to searching Info was given to me by some resourceful people in #linuxjournal that were more educated in emacs than myself.. I'll confess, if you can't tell, I'm a beginner at emacs as I have spent my entire Linux career in vi. So it goes without saying that I'll take any and every hint that I can when it comes to learning new and interesting things. Daddoo pointed out that he jumps to a named node in info pages by doing the following:
1. m - Brings up Menu Item (info specific)
2. Type in First letter of what you are looking for 'ex' for example
3. Tab 1 or 2 times to search Info for the node you are looking for, then select the node to view the page
Maybe to you veteran emacs users out there this might seem trivial, but this ended up being such an awesome and easy command. Before I would just arrow key down to what I was looking for and push enter to bring up the node. Ah, the simple joys in life.
Well there you have it, the end of a two part series on getting help from Linux with Man/Info. As you can see each one of these utilities has their strengths and weaknesses. If I was a betting man I would think that more and more help pages are going to be included in Info pages as it contains more information than your typical Man page, and eventually manpages will be pointers to Info. Do I think that is going to happen any time soon? Doubtful, as I'm a crusty old bugger when it comes to Man Pages. I do realize that when that day comes I'll need plenty of time to adapt to Info and emacs.
Free DevOps eBooks, Videos, and more!
Regardless of where you are in your DevOps process, Linux Journal can help!
We offer here the DEFINITIVE DevOps for Dummies, a mobile Application Development Primer, and advice & help from the expert sources like:
- Linux Journal