联机帮助页中 Unix 命令名称后面显示的括号中的数字是什么意思?
例如:man(1)
、find(3)
、updatedb(2)
?
括号(英式“方括号”)中的数字是什么意思?
For example: man(1)
, find(3)
, updatedb(2)
?
What do the numbers in parentheses (Brit. "brackets") mean?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
这是命令的手册页所分配到的部分。
它们被分为
每个部分的原始描述可以在 Unix 程序员手册(第ii).
为了访问“foo(5)”给出的手册页,请运行:
It's the section that the man page for the command is assigned to.
These are split as
Original descriptions of each section can be seen in the Unix Programmer's Manual (page ii).
In order to access a man page given as "foo(5)", run:
该命令的部分记录在手册中。 各部分的列表记录在人类手册中。 例如:
当不同部分存在相似或完全相同的命令时,这非常有用
The section the command is documented in the manual. The list of sections is documented on man's manual. For example:
This is useful for when similar or exactly equal commands exist on different sections
部分编号之所以重要,是因为许多年前磁盘空间比现在更成为一个问题,这些部分可以单独安装。
例如,许多系统只安装了 1 和 8。 如今,人们倾向于在谷歌上查找命令。
The reason why the section numbers are significant is that many years ago when disk space was more of an issue than it is now the sections could be installed individually.
Many systems only had 1 and 8 installed for instance. These days people tend to look the commands up on google instead.
正如 @Ian G 所说,它们是手册页部分。 让我们更进一步:
1. 使用
man man
查看man
命令的手册页,它显示了 9 个部分,如下所示:2.
男人
假设您正在 Google 上搜索 Linux 命令。 您可以在线找到
OPEN(2)
pg: open(2) — Linux 手册页。要在电脑上的手册页中查看此内容,只需输入
man 2 open
即可。对于
FOPEN(3)
使用man 3 fopen
等3.
man; intro
要阅读某个部分的介绍页面,请输入
man; intro
,例如man 1 intro
、man 2 intro
、man 7 intro
等。查看所有手册页介绍连续,一个接一个,执行
man -a intro
。 第 1 部分的介绍页面将打开。 按 q 退出,然后按 Enter 查看第 8 节的介绍。按 q 退出,然后按 Enter kbd> 查看第 3 部分的介绍。继续此过程直至完成。 每次点击 q 后,它都会带您返回主终端屏幕,但您仍然处于交互式提示中,并且您将看到这一行:请注意,该部分的顺序是 < code>man -a intro 将带您浏览以下内容:
此搜索顺序是故意的,因为
man man
页面解释:他们为什么选择这个顺序? 我不知道(如果您知道,请在评论中回答),但只要意识到这个顺序是正确且有意的。
相关:
As @Ian G says, they are the man page sections. Let's take this one step further though:
1. See the man page for the
man
command withman man
, and it shows the 9 sections as follows:2.
man <section_num> <cmd>
Let's imagine you are Googling around for Linux commands. You find the
OPEN(2)
pg online: open(2) — Linux manual page.To see this in the man pages on your pc, simply type in
man 2 open
.For
FOPEN(3)
useman 3 fopen
, etc.3.
man <section_num> intro
To read the intro pages to a section, type in
man <section_num> intro
, such asman 1 intro
,man 2 intro
,man 7 intro
, etc.To view all man page intros in succession, one-after-the-other, do
man -a intro
. The intro page for Section 1 will open. Press q to quit, then press Enter to view the intro for Section 8. Press q to quit, then press Enter to view the intro for Section 3. Continue this process until done. Each time after hitting q, it'll take you back to the main terminal screen but you'll still be in an interactive prompt, and you'll see this line:Note that the Section order that
man -a intro
will take you through is:This search order is intentional, as the
man man
page explains:Why did they choose this order? I don't know (please answer in the comments if you know), but just realize this order is correct and intentional.
Related:
另请注意,在其他 UNIX 上,指定该部分的方法有所不同。 以Solaris 为例,它是:
Note also that on other unixes, the method of specifying the section differs. On solaris, for example, it is:
它指示在手册页中找到该命令的部分。 man 命令上的 -s 开关可用于将搜索限制为某些部分。
当您查看手册页时,左上角会给出该部分的名称,例如:
用户命令 printf(1)
标准 C 库函数 printf(3C)
因此,如果您尝试查找 C 函数并且不想意外看到共享相同名称的用户命令的页面,则可以执行“man -s 3C ...”
It indicates the section of the man pages the command is found in. The -s switch on the man command can be used to limit a search to certain sections.
When you view a man page, the top left gives the name of the section, e.g.:
User Commands printf(1)
Standard C Library Functions printf(3C)
So if you are trying to look up C functions and don't want to accidentally see a page for a user command that shares the same name, you would do 'man -s 3C ...'
Wikipedia 有关手册部分的详细信息:
Wikipedia details about Manual Sections: