GNU/Linux - Info和Man的区别

Linux 中的 info 和 man 命令是文档系统,但它们有不同的特点和使用场景。下面概述了它们的区别:
The info and man commands in Linux serve as documentation systems, but they have distinct characteristics and usage scenarios. Here's an overview of their differences:
Overview of Man Command
man 命令是 "manual "的缩写,是类 Unix 操作系统中的传统文档系统。它为命令和实用程序提供简明的参考资料。
* 结构: man 页面按命令类别(如用户命令、系统调用)分为若干部分。
* 内容: 一般包括命令的目的、语法、选项等基本信息,有时还包括示例。
* 格式: Man 页通常简单明了,可借助寻参器(如 less 或 more)轻松浏览。
The man command, short for "manual," is a traditional documentation system in Unix-like operating systems. It provides concise reference materials for commands and utilities.
* Structure: Man pages are organized into sections, each corresponding to a category of commands (e.g., user commands, system calls).
* Content: It generally includes basic information such as the command's purpose, syntax, options, and sometimes examples.
* Format: Man pages are usually straightforward and easy to navigate with the help of pagers (like less or more).
Overview of Info Command
info 命令是一种较新的文档系统,可以替代 man 命令,尤其是在 GNU 项目中。
* 结构: 信息页面被组织成一个个节点,形成一个层次分明、相互关联的结构,让用户可以轻松浏览相关主题。
* 内容: 信息文档往往更全面,提供详细的解释和示例,通常还提供指向相关主题的超链接,从而促进对内容的深入探讨。
* 格式: 与 man 页面的线性格式不同,信息页面就像一本带有菜单和链接的电子书,让用户更容易找到相关信息。
The info command is a newer documentation system that serves as an alternative to man, particularly within the GNU project.
* Structure: Info pages are organized into nodes that create a hierarchical and interconnected structure, allowing users to navigate through related topics easily.
* Content: Info documentation tends to be more comprehensive, offering detailed explanations, examples, and often hyperlinks to related topics, fostering deeper exploration of content.
* Format: Unlike the linear format of man pages, info pages resemble a digital book with menus and links, making it easier to find related information.
Key Differences

  1. 内容卷:
    * man: 简要概述命令,重点介绍关键选项。
    * info: 内容更广泛,包括更多上下文信息和交叉引用。
  2. 导航
    * man: 使用章节编号,线性操作。
    * info: 支持通过菜单系统进行导航,使用户能够在相关主题之间快速跳转。
  3. 超链接和相互关联的主题:
    * man: 一般没有超链接,以更静态的格式呈现信息。
    * info: 其结构中包含超链接,允许用户轻松浏览相关信息。
  4. 易用性:
    * man: 简单易用,是快速参考的理想选择。
    * 信息: 由于内容广泛且结构相互关联,可能需要更多时间浏览。
  5. Content Volume:
    * man: Provides a succinct overview of commands, focusing on key options.
    * info: More extensive, including additional contextual information and cross-references.
  6. Navigation:
    * man: Uses section numbers and operates linearly.
    * info: Supports navigation through a menu system, enabling users to jump between related topics quickly.
  7. Hyperlinks and Interconnected Topics:
    * man: Generally lacks hyperlinks, presenting information in a more static format.
    * info: Features hyperlinks within its structure, allowing users to explore related information with ease.
  8. Ease of Use:
    * man: Simplicity makes it ideal for quick references.
    * info: May require more time to navigate due to its extensive content and interconnected structure.
    Summary
    总之,虽然 man 和 info 命令的目的都是为 Linux 中的命令和实用程序提供文档,但它们在结构、内容深度、导航方法和整体可用性方面都有很大不同。如何在它们之间做出选择,通常取决于用户对信息的具体需求以及对信息详细程度的要求。
    In summary, while both the man and info commands aim to provide documentation for commands and utilities in Linux, they differ significantly in their structure, depth of content, navigation methods, and overall usability. The choice between them often depends on the user's specific needs for information and how detailed they require that information to be.

Linux 中的 man 和 info 命令从不同来源获取文档,其位置和格式也各不相同。
The man and info commands in Linux retrieve documentation from different sources, and their locations and formats vary.
Man Command
man 命令主要读取存储在文件系统特定目录中的手册页面。
* 位置: 手册通常位于/usr/share/man 目录中,该目录包含由不同部分组成的层次结构。老式 Unix 系统可能使用 /usr/man 目录。
* 数据检索: man 命令使用复杂的搜索方法,根据调用选项和环境变量查找手册页面文件。它还会参考/etc/man.config配置文件,以确定如何以及在何处搜索相应的文档。
The man command reads manual pages primarily stored in specific directories of the filesystem.
* Location: Man pages are typically located in the /usr/share/man directory, which contains a hierarchical structure of various sections. Older Unix-like systems might use the /usr/man directory instead.
* Data Retrieval: The man command uses a sophisticated search method to find manual page files based on the invocation options and environment variables. It also refers to the /etc/man.config configuration file to determine how and where to search for the appropriate documentation.
Info Command
info 命令的操作方式不同,它侧重于 GNU Info 格式的信息。
* 位置: 信息文件通常位于 $INFOPATH 变量指定的目录中,通常在 /usr/share/info/。
* 数据生成: 这些文件通常从 Texinfo 源生成,可以转换成 Info 文档和 HTML 或 PDF 等其他格式。如果 info 命令找不到所需的信息,它可能会退回到 man 命令,尝试显示相关的 man 页面。
The info command operates differently, focusing on information in the GNU Info format.
* Location: Info files are usually found in directories specified by the $INFOPATH variable, commonly at /usr/share/info/.
* Data Generation: These files are often generated from Texinfo sources, which can be transformed into both Info documentation and other formats such as HTML or PDF. If the info command cannot find the requested information, it may fallback to the man command, attempting to display the relevant man page.
INFOPATH变量也有可能为空,比如在Ubuntu里,我查询就是空的,但不影响info命令使用。
Summary
总之,man 命令从主要存储在 /usr/share/man 中的结构化手册页面中获取数据,而 info 命令则从 $INFOPATH 变量指定的目录中查找 Info 格式的文档。每种命令都使用不同的数据格式和结构,man 命令的页面更简洁、更有条理,而 info 命令的文件通常更丰富、更相互关联。
In summary, while the man command retrieves its data from structured manual pages stored mainly in /usr/share/man, the info command looks for documentation in the Info format from directories specified by the $INFOPATH variable. Each command utilizes different data formats and structures, with man pages being more concise and structured, whereas info files are often richer and more interconnected.
除此之外,在/usr/share/doc/里,也可以查询一些相关主题的文档。

相关推荐
gywl1 小时前
openEuler VM虚拟机操作(期末考试)
linux·服务器·网络·windows·http·centos
日记跟新中3 小时前
Ubuntu20.04 修改root密码
linux·运维·服务器
码农君莫笑3 小时前
信管通低代码信息管理系统应用平台
linux·数据库·windows·低代码·c#·.net·visual studio
BUG 4043 小时前
Linux——Shell
linux·运维·服务器
大霞上仙3 小时前
Linux 多命令执行
linux·运维·服务器
晨欣3 小时前
Kibana:LINUX_X86_64 和 DEB_X86_64两种可选下载方式的区别
linux·运维·服务器
AI青年志4 小时前
【服务器】linux服务器管理员查看用户使用内存情况
linux·运维·服务器
dessler4 小时前
Docker-run命令详细讲解
linux·运维·后端·docker
PyAIGCMaster5 小时前
ubuntu装P104驱动
linux·运维·ubuntu
奈何不吃鱼5 小时前
【Linux】ubuntu依赖安装的各种问题汇总
linux·运维·服务器