因此,例如,当我输入时,man ls
我会看到LS(1)
.但如果我输入,man apachectl
我会看到APACHECTL(8)
,如果我输入,man cd
我最终会得到cd(n)
.
我想知道括号中的数字(如果有的话)的意义是什么。
答案1
该数字对应于该页面来自手册的哪个部分; 1 是用户命令,而 8 是系统管理员命令。 man 本身的手册页 ( man man
) 对其进行了解释并列出了标准的:
MANUAL SECTIONS
The standard sections of the manual include:
1 User Commands
2 System Calls
3 C Library Functions
4 Devices and Special Files
5 File Formats and Conventions
6 Games et. al.
7 Miscellanea
8 System Administration tools and Daemons
Distributions customize the manual section to their specifics,
which often include additional sections.
有些术语在不同部分有不同的页面(例如,printf
命令出现在第 1 部分,函数stdlib
出现在第 3 部分);在这种情况下,您可以将节号传递到man
页面名称之前以选择您想要的节号,或者用于man -a
显示一行中的每个匹配页面:
$ man 1 printf
$ man 3 printf
$ man -a printf
您可以知道某个术语属于哪些部分man -k
(相当于apropos
命令)。它也会进行子字符串匹配(例如,sprintf
如果你运行它会显示man -k printf
),所以你需要使用^term
来限制它:
$ man -k '^printf'
printf (1) - format and print data
printf (1p) - write formatted output
printf (3) - formatted output conversion
printf (3p) - print formatted output
printf [builtins] (1) - bash built-in commands, see bash(1)
请注意,该部分有时可以包含一个小节(例如,p
in1p
和3p
above)。本p
小节针对 POSIX 规范;本x
小节是 X Window 系统文档。
答案2
答案3
konqueror 还描述了非标准部分:(感谢 @greg0ire 的想法)
0 Header files
0p Header files (POSIX)
1 Executable programs or shell commands
1p Executable programs or shell commands (POSIX)
2 System calls (functions provided by the kernel)
3 Library calls (functions within program libraries)
3n Network Functions
3p Perl Modules
4 Special files (usually found in /dev)
5 File formats and conventions eg /etc/passwd
6 Games
7 Miscellaneous (including macro packages and conventions), e.g. man(7), groff(7)
8 System administration commands (usually only for root)
9 Kernel routines
l Local documentation
n New manpages
答案4
从man
联机帮助页:
The table below shows the section numbers of the manual followed by the
types of pages they contain.
1 Executable programs or shell commands
2 System calls (functions provided by the kernel)
3 Library calls (functions within program libraries)
4 Special files (usually found in /dev)
5 File formats and conventions eg /etc/passwd
6 Games
7 Miscellaneous (including macro packages and conven‐
tions), e.g. man(7), groff(7)
8 System administration commands (usually only for root)
9 Kernel routines [Non standard]
至于为什么它们如此分开——有一些重叠。某些联机帮助页存在于多个部分中,具体取决于您的意思。
例如,man crontab
与man 5 crontab
-- 进行比较,后者很可能是您想要查找的。