Linux info Command
info is a powerful documentation reader in Linux that provides more detailed, structured help documents than the man command. info documents organize content using hypertext links, making them especially suitable for browsing complex software documentation.
Differences between info and man
| Feature | info command | man command |
|---|---|---|
| Document Structure | Hypertext links with a clear hierarchy | Linear text displayed on a single page |
| Depth of content | More detailed, including tutorials and examples | Concise, mainly a reference manual |
| Navigation method | Supports node jumping and searching | Can only scroll up and down |
| Applicable scenarios | Documentation for complex software (GCC, Emacs, etc.) | Quickly view command usage |
Basic Syntax
info [选项] [菜单项目...]
Common options
| Option | Description |
|---|---|
-a |
Use all matching documents |
-d |
Add a directory to INFOPATH |
-f |
Specify the info file to access |
-n |
Specify the first node to visit |
-o |
Output to the specified file |
Using the info system
Start info
info
Running it without arguments displays the top-level directory of the info system.
View the documentation for a specific command
info coreutils
This opens the documentation for GNU coreutils.
Navigation commands
Once in the info interface, you can navigate using the following shortcuts:
Basic navigation
| Keyboard shortcut | Function |
|---|---|
h |
Show help |
? |
Display a summary of commands |
q |
Exit info |
SPACE |
Page down |
DEL |
Page up |
Node jumping
| Keyboard shortcut | Function |
|---|---|
n |
Next node |
p |
Previous node |
u |
Go up one node |
m |
Select a menu item |
l |
Return to the previously viewed node |
Search functionality
| Keyboard shortcut | Function |
|---|---|
s |
Search |
i |
Index search |
, |
Find the next match |
Practical examples
Example 1: View the info documentation for the ls command
info ls
This displays detailed documentation for the ls command, including:
- Command syntax
- Descriptions of all options
- Usage examples
- Links to related commands
Example 2: Searching for specific content in the documentation
- Open the info documentation
- Press
sKey - Enter a search term such as "permission"
- Press Enter to start the search
- Use
,Find the next match
Create a custom info document
1. Write a texinfo file
input texinfo
@setfilename mycommand.info
@settitle My Command Manual
@node Top
@top My Command
This is the top node of my command documentation.
@menu
* Introduction:: Introduction to my command.
* Usage:: How to use my command.
@end menu
@node Introduction
@chapter Introduction
This command does something useful.
@node Usage
@chapter Usage
Here's how to use it...
2. Compile it into info format
makeinfo mycommand.texi
3. Install the info documentation
install-info mycommand.info /usr/share/info/dir
Advanced techniques
Viewing info in Emacs
Emacs has a powerful built-in info browser:
M-x info
Print the info documentation
info --subnodes -o output.txt bash
Set the default info browser
export INFO_COMMAND="pinfo"
Frequently Asked Questions
Q: Why do some commands have no info documentation?
A: Not all software provides documentation in info format; traditional Unix commands usually have only man pages.
Q: How do I update the info database?
A: Run sudo update-info-dir to update the info directory database.
Q: Where are info documents stored?
A: Usually in the /usr/share/info/ directory, in .info.gz format.
Linux Command Reference