Linux info command

Linux 命令大全Linux Command Encyclopedia


info is a powerful documentation reading tool in the Linux system. It provides more detailed and structured help documentation than the man command. info documents organize content in the form of 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, clearly hierarchical Linear text, single-page display
Content depth More detailed, includes tutorials and examples Concise, mainly 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 look up command usage

Basic syntax

info [选项] [菜单项目...]

Common options

Option Description
-a Use all matching documents
-d Add directory to INFOPATH
-f Specify the info file to access
-n Specify the first node to access
-o Output to specified file

Using the info system

Starting info

info

Running it without arguments displays the top-level directory of the info system.

Viewing documentation for a specific command

info coreutils

This will open the GNU coreutils documentation.


Navigation commands

After entering the info interface, you can use the following shortcut keys to navigate:

Basic navigation

Shortcut key Function
h Display help
? Display command summary
q Exit info
SPACE Page down
DEL Page up

Node navigation

Shortcut key Function
n Next node
p Previous node
u Up one node
m Select menu item
l Return to the previously viewed node

Search function

Shortcut key Function
s Search
i Index search
, Find next match

Practical examples

Example 1: View the info documentation for the ls command

info ls

This will display the detailed documentation for the ls command, including:

  • Command syntax
  • All option descriptions
  • Usage examples
  • Related command links

Example 2: Search for specific content in the documentation

  1. Open the info document
  2. presssKey
  3. Enter a search term such as "permission"
  4. Press Enter to start searching
  5. Use,Find next match

Creating custom info documents

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 document

install-info mycommand.info /usr/share/info/dir

Advanced tips

Viewing info in Emacs

Emacs has a built-in powerful info browser:

M-x info

Printing info documents

info --subnodes -o output.txt bash

Setting the default info browser

export INFO_COMMAND="pinfo"

FAQ

Q: Why do some commands not have info documentation?

A: Not all software provides documentation in info format; traditional Unix commands usually only have man pages.

Q: How to update the info database?

A: Runsudo update-info-dircan update the info directory database.

Q: Where are info documents stored?

A: Usually in/usr/share/info/directory, in.info.gzformat.


Linux 命令大全Linux Command Encyclopedia

Other extensions