Linux Commands

How to Read GNU Info Documents From the Command Line Without Using Emacs (or Info)

Why Look at GNU Info Documentation?

Man pages are great, but the man pages of some commands from the GNU project basically say that this man page is not updated and not comprehensive, so see the info page. In other words, the man page is neglected in favor of the info documentation. Consider the man page for the chmod command (GNU coreutils 8.30). For example, the man page has no explanation of what the setgid permission bit means. However, if you look at the info docs for GNU coreutils, “section 27 File permissions” explains all about permissions in detail:

Full documentation at: <https://www.gnu.org/software/coreutils/chmod>

or available locally via: info '(coreutils) chmod invocation'

Other Methods That We’re Not Covering in Depth Here: Emacs, Info, Pinfo, and HTML

If you are already a user of Emacs and know your way around Emacs, then you can conveniently use the Info mode of Emacs or the stand-alone program info, which uses similar (wacky Emacs) keyboard shortcuts. But this article is not about that—it is for users who don’t want to do it the Emacs way. Either because you don’t know Emacs well enough, it might not be installed on a particular computer that you’re using, or, like me as a long-time fellow Emacs user, you just want a different way.

Another standalone info program called pinfo claims to have more user-friendly keyboard shortcuts (a.k.a. keybindings) than info, but I won’t cover that in this article.

GNU info documents are often available in HTML format, sometimes locally, depending on what packages are installed, and sometimes on the WWW, assuming you have an Internet connection. I find several disadvantages to this way, though:

  • sometimes the computer is not online
  • sometimes the HTML documents are split into separate files, which prevents an easy global search
  • sometimes I don’t want to open a web browser—I just want to use the command line

Sending Output of Info Command to a Pager Like Less

This is a good example of the Unix toolbox principle. You don’t have to learn any new program, editor mode, or keyboard shortcuts. You probably already know a pager, such as less, more, or most:

info -o- chmod | less

Now, you can use all the great features (like searching and line numbering) of less using the keystrokes that you already know! What if you want an explanation of Unix file permissions? You can look at the entire coreutils manual in one go:

info --subnodes -o- coreutils | less

and then you can search for the “sticky” bit and find out what it means using less.

Sending Output of Info Command to a Text Editor

Perhaps, you use a text editor that you like a lot. Maybe you love its navigation and search features. You already know well how to use it, so use it! The Unix toolbox enables switching out different tools. Here are some examples:

info -o- chmod | nano -

info -o- chmod | vi -

info --subnodes -o- coreutils | nano -

Whatever your heart desires.

Searching ALL the Info Docs

The info command has an extremely useful search option, -k, which looks up a string in all indices of all manuals. That is some serious searching power. If you want to know about the implications of the setgid permission, then run:

info -k setgid

which prints:

"(coreutils)Mode Structure" -- setgid

"(kpathsea)Security" -- setgid scripts

Use the output in double quotes as your argument to info, e.g.

info "(kpathsea)Security" | less

Note that man has an analogous feature, man -K, that searches the full text of all man pages.

Conclusion

To get to the comprehensive and up-to-date information stored in GNU info docs, you can use any pager, editor, or text processing tool, such as grep. You don’t have to memorize new keyboard shortcuts of Emacs/info, thanks to the Unix toolbox principle. We hope you found this article useful and if you need more tips, please check out our other articles.

About the author

Greg Reagle

Greg Reagle is a life-long computer learner, having started with video games and Basic in his early childhood. He holds a Bachelor of Science in Computer Science and several certifications, including LPIC-1 which goes with his special interest in Linux. He does diverse computer consulting and tech support work. See linkedin.