info Command in Linux
The info command in Linux reads the Info document. The Info document is primarily used in Unix and Unix-like operating systems like Linux. It provides structured and interactive documentation that is more user-friendly than traditional man pages.
The info and man commands both provide access to documentation, but the info command is interactive and easier to navigate compared to man.
Table of Contents
Here is a comprehensive guide to the options available with the info command −
Syntax of info Command
The general syntax of the Linux info command is as follows −
info [options] [menu-item]
The [options] field is used to specify various options to modify the command's behavior. The [menu-item] is used to specify the particular section of the documentation to access.
Options of info Command
The options for the info command are listed below −
Flags | Options | Description |
---|---|---|
-a | --all | To display all the matching manuals |
-k string | --apropos= string | To search for the specified string across all the manual |
-d dir | --directory= dir | To add the directory in the INFOPATH to search for info files |
--dribble= filename | To log the user's keystrokes in the specified file | |
-f filename | --file= filename | To specify the info file name to open |
-h | --help | To display help related to command |
--index-search= string | To go to the specified node | |
-n nodename | --node= nodename | To specify nodes in the first visited Info file |
-o filename | --output= filename | To save the output in the specified file |
-R | --raw-escapes | To display the ANSI escapes (default) |
--no-raw-escapes | To output escapes as literal text | |
--restore= filename | To load the initial keystrokes from the specified file | |
-O | --show-options / --usage | To go to the command-line options node |
--subnodes | To display menu items recursively | |
--vi-like | To use vi-like and less-like keybindings | |
-v VAR=Value | --variable VAR=Value | To assign VALUE to Info variable VAR |
--version | To display the command version | |
-w | --where / --location | To display the physical location of Info file |
Node: The name of a specific topic or section within the Info document.
Index: The index in an Info document is a searchable reference guide that helps in quickly locating topics or terms, typically listing keywords alongside their corresponding nodes.
Examples of info Command in Linux
This section demonstrates the usage of the info command in Linux with examples −
Displaying All the Matching Manuals
To display all the matching manuals from the Info document, use the -a or --all option −
info -a "cat"

Searching for a Specific Term
To search for a specific term in all the indices of all manuals, use the -k or --apropos option. For example, to list all the entries related to the network, use the info command in the following way −
info -k "emacs"

Adding a Directory to INFOPATH
To add a directory to the INFOPATH, use the -d or --directory option with the directory path −
info -d "./addinfo.info"
This option adds a directory for info files.
Logging Keystrokes
To log the userâs keystrokes while using the info command, use the --dribble option −
info --dribble=file.log
This command opens the Info document and creates a log file in the current working directory to store the keystrokes.
Reading the Keystroke Log File
To read the keystrokes logged into the log file and restore previous navigation, use the --restore option −
info --restore=keystrokes.log
Saving the Output in a Specific File
To store the output of the info command in a specific file, use the -o or --output option with the filename. For example, to save the information of the find command from the Info document, use the following command −
info -o find.txt find

Displaying the Physical Location of Info File
To display the physical location of the Info file, use the -w, --where, or --location option with the node name.
For example, to find the physical location of cat, use the following command −
info -w cat

Displaying Info Documentation with RAW ANSI Escapes
To display the Info documentation with the RAW ANSI escape sequences (if any), use the -R or --raw-escapes option −
info -R
To display escapes with literal text, use the --no-raw-escapes.
info --no-raw-escapes
Displaying Menu Items Recursively
To display all the menu items and nodes recursively from a specific starting point, use the --subnodes option −
info --subnodes find

In the above command, the find is the starting point. The info command will display all menu items and sub-nodes under the find node, showing the entire structure of the Find documentation.
Conclusion
The info command in Linux is used to display Info documentation. The Info documentation is a special document that is used in the Unix and Unix-like operating systems, including Linux.
The info command is a powerful tool for getting information on standard Linux command-line utilities. Moreover, the Info documentation is easier to navigate compared to man pages.
In this tutorial, we explained the info command, its syntax, options, and examples in Linux.