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 −

FlagsOptionsDescription
-a--allTo display all the matching manuals
-k string--apropos= stringTo search for the specified string across all the manual
-d dir--directory= dirTo add the directory in the INFOPATH to search for info files
--dribble= filenameTo log the user's keystrokes in the specified file
-f filename--file= filenameTo specify the info file name to open
-h--helpTo display help related to command
--index-search= stringTo go to the specified node
-n nodename--node= nodenameTo specify nodes in the first visited Info file
-o filename--output= filenameTo save the output in the specified file
-R--raw-escapesTo display the ANSI escapes (default)
--no-raw-escapesTo output escapes as literal text
--restore= filenameTo load the initial keystrokes from the specified file
-O--show-options / --usageTo go to the command-line options node
--subnodesTo display menu items recursively
--vi-likeTo use vi-like and less-like keybindings
-v VAR=Value--variable VAR=ValueTo assign VALUE to Info variable VAR
--versionTo display the command version
-w--where / --locationTo 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"
info Command in Linux1

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"
info Command in Linux2

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
info Command in Linux3

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
info Command in Linux4

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
info Command in Linux5

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.