.\" t .\" ** The above line should force tbl to be a preprocessor ** .\" Man page for man .\" .\" Copyright (C) 1994, 1995, Graeme W. Wilford. (Wilf.) .\" Copyright (C) 2001, 2002, 2003, 2006, 2007, 2008 Colin Watson. .\" .\" You may distribute under the terms of the GNU General Public .\" License as specified in the file COPYING that comes with the .\" man-db distribution. .\" .\" Sat Oct 29 13:09:31 GMT 1994 Wilf. (G.Wilford@ee.surrey.ac.uk) .\" .pc "" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH MAN 1 2014-09-28 2.7.0.2 手册分页显示工具 .SH NAME man \- 在线参考手册的接口 .SH 概述 .\" The general command line .\" The apropos command line \fBman\fP [\|\fB\-C\fP \fIfile\fP\|] [\|\fB\-d\fP\|] [\|\fB\-D\fP\|] [\|\fB\-\-warnings\fP\|[\|=\fIwarnings\fP\|]\|] [\|\fB\-R\fP \fIencoding\fP\|] [\|\fB\-L\fP \fIlocale\fP\|] [\|\fB\-m\fP \fIsystem\fP\|[\|,.\|.\|.\|]\|] [\|\fB\-M\fP \fIpath\fP\|] [\|\fB\-S\fP \fIlist\fP\|] [\|\fB\-e\fP \fIextension\fP\|] [\|\fB\-i\fP\||\|\fB\-I\fP\|] [\|\fB\-\-regex\fP\||\|\fB\-\-wildcard\fP\|] [\|\fB\-\-names\-only\fP\|] [\|\fB\-a\fP\|] [\|\fB\-u\fP\|] [\|\fB\-\-no\-subpages\fP\|] [\|\fB\-P\fP \fIpager\fP\|] [\|\fB\-r\fP \fIprompt\fP\|] [\|\fB\-7\fP\|] [\|\fB\-E\fP \fIencoding\fP\|] [\|\fB\-\-no\-hyphenation\fP\|] [\|\fB\-\-no\-justification\fP\|] [\|\fB\-p\fP \fIstring\fP\|] [\|\fB\-t\fP\|] [\|\fB\-T\fP\|[\|\fIdevice\fP\|]\|] [\|\fB\-H\fP\|[\|\fIbrowser\fP\|]\|] [\|\fB\-X\fP\|[\|\fIdpi\fP\|]\|] [\|\fB\-Z\fP\|] [\|[\|\fIsection\fP\|] \fIpage\fP\ \&.\|.\|.\|]\ .\|.\|.\& .br .\" The --global-apropos command line \fBman\fP \fB\-k\fP [\|\fIapropos\fP \fIoptions\fP\|] \fIregexp\fP \&.\|.\|.\& .br .\" The whatis command line \fBman\fP \fB\-K\fP [\|\fB\-w\fP\||\|\fB\-W\fP\|] [\|\fB\-S\fP \fIlist\fP\|] [\|\fB\-i\fP\||\|\fB\-I\fP\|] [\|\fI\-\-regex\fP\|] [\|\fIsection\fP\|] \fIterm\fP\ .\|.\|.\& .br .\" The --local command line \fBman\fP \fB\-f\fP [\|\fIwhatis\fP \fIoptions\fP\|] \fIpage\fP \&.\|.\|.\& .br .\" The --where/--where-cat command line \fBman\fP \fB\-l\fP [\|\fB\-C\fP \fIfile\fP\|] [\|\fB\-d\fP\|] [\|\fB\-D\fP\|] [\|\fB\-\-warnings\fP\|[\|=\fIwarnings\fP\|]\|] [\|\fB\-R\fP \fIencoding\fP\|] [\|\fB\-L\fP \fIlocale\fP\|] [\|\fB\-P\fP \fIpager\fP\|] [\|\fB\-r\fP \fIprompt\fP\|] [\|\fB\-7\fP\|] [\|\fB\-E\fP \fIencoding\fP\|] [\|\fB\-p\fP \fIstring\fP\|] [\|\fB\-t\fP\|] [\|\fB\-T\fP\|[\|\fIdevice\fP\|]\|] [\|\fB\-H\fP\|[\|\fIbrowser\fP\|]\|] [\|\fB\-X\fP\|[\|\fIdpi\fP\|]\|] [\|\fB\-Z\fP\|] \fIfile\fP \&.\|.\|.\& .br .\" The --catman command line \fBman\fP \fB\-w\fP\||\|\fB\-W\fP [\|\fB\-C\fP \fIfile\fP\|] [\|\fB\-d\fP\|] [\|\fB\-D\fP\|] \fIpage\fP \&.\|.\|.\& .br .\" --help and --version \fBman\fP \fB\-c\fP [\|\fB\-C\fP \fIfile\fP\|] [\|\fB\-d\fP\|] [\|\fB\-D\fP\|] \fIpage\fP \&.\|.\|.\& .br \fBman\fP [\|\fB\-?V\fP\|] .SH 描述 \fBman\fP is the system's manual pager. Each \fIpage\fP argument given to \fBman\fP is normally the name of a program, utility or function. The \fImanual page\fP associated with each of these arguments is then found and displayed. A \fIsection\fP, if provided, will direct \fBman\fP to look only in that \fIsection\fP of the manual. The default action is to search in all of the available \fIsections\fP following a pre\-defined order ("1 n l 8 3 2 3posix 3pm 3perl 5 4 9 6 7" by default, unless overridden by the \fBSECTION\fP directive in \fI/etc/manpath.config\fP), and to show only the first \fIpage\fP found, even if \fIpage\fP exists in several \fIsections\fP. 下表显示了手册的 \fI章节\fP 号及其包含的手册页类型。 .TS tab (@); l lx. 1@T{ 可执行程序或 shell 命令 T} 2@T{ 系统调用(内核提供的函数) T} 3@T{ 库调用(程序库中的函数) T} 4@T{ Special files (usually found in \fI/dev\/\fP) T} 5@T{ 文件格式和规范,如 \fI/etc/passwd\fP T} 6@T{ 游戏 T} 7@T{ Miscellaneous (including macro packages and conventions), e.g.\& \fBman\fP(7), \fBgroff\fP(7) T} 8@T{ 系统管理命令(通常只针对 root 用户) T} 9@T{ 内核例程 [\|非标准\| T} .TE 一个手册 \fI页面\fP 包含若干个小节。 小节名称通常包括 \fBNAME\fP, \fB概述(SYNOPSIS)\fP, \fB配置(CONFIGURATION)\fP, \fB描述(DESCRIPTION)\fP, \fB选项(OPTIONS)\fP, \fB退出状态(EXIT\ STATUS)\fP, \fB返回值(RETURN\ VALUE)\fP, \fB错误(ERRORS)\fP, \fB环境(ENVIRONMENT)\fP, \fB文件(FILES)\fP, \fB版本(VERSIONS)\fP, \fB符合标准(CONFORMING\ TO)\fP, \fB注(NOTES)\fP, \fB缺陷(BUGS)\fP, \fB示例(EXAMPLE)\fP, \fB作者(AUTHORS)\fP, 和 \fB亦见(SEE\ ALSO)\fP. 以下规范适用于 \fB概述(SYNOPSIS)\fP 小节,也可作为其他小节的指南。 .TS tab (@); l lx. \fB加粗文本\fP@T{ 原样显示的样式。 T} \fI倾斜文本\fP@T{ 替换为相应的参数。 T} [\|\fB\-abc\fP\|]@T{ [ ] 内的任意/全部参数都是可选的。 T} \fB\-a\|\fP|\|\fB\-b\fP@T{ 以 | 分隔的选项可以一起使用。 T} \fI参数\fP .\|.\|.@T{ \fI参数\fP 可以重复。 T} [\|\fI表达式\fP\|] .\|.\|.@T{ [ ] 内的整个 \fI表达式\fP 可以重复。 T} .TE 实际渲染的效果可能因输出设备而异。例如,在终端中 man 程序通常无法渲染出斜体,这时一般会以下划线或彩色文字代替。 程序和函数说明应该是一个可以匹配所有可能用法的模式(pattern)。有些情况下,建议按此手册页 \fB概述(SYNOPSIS)\fP 小节所显示的分别陈述几种互斥的用法。 .SH 示例 .TP \w'man\ 'u \fBman\fP\fI\ ls\fP 显示 \fI项目\fP (程序) \fIls\fP 对应的手册页 .TP \fBman\ \-a\fP\fI\ intro\fP 正确执行时显示手册中包含的所有可用的 \fIintro\fP 手册页。可以在连续显示过程中退出或跳过任一页。 .TP \fBman \-t \fP\fIalias \fP|\fI lpr \-Pps\fP 将别名“\fIalias\fP”所引用的手册页(常为 shell 手册页)格式化为默认的 \fBtroff\fP 或 \fBgroff\fP 格式并通过管道传送给名为 \fIps\fP 的打印机。\fBgroff\fP 的默认输出通常为 PostScript。\fBman \-\-help\fP 应该会提示哪个处理器程序与 \fB\-t\fP 选项绑定。 .TP \fBman \-l \-T\fP\fIdvi ./foo.1x.gz\fP\fB > \fP\fI./foo.1x.dvi\fP 此命令会将 nroff 源手册页 \fI./foo.1x.gz\fP 解压并格式化为 \fB设备无关(dvi)\fP 文件。重定向是必须的,因为 \fB\-T\fP 标志会导致输出不经分页程序直接传送到 \fBstdout\fP。 输出结果应该使用 \fBxdvi\fP 这样的程序查看,或使用 \fBdvips\fP 这样的程序进一步处理为 PostScript。 .TP \fBman\ \-k\fP\fI\ printf\fP 将关键词 \fIprintf\fP 作为正则表达式来搜索对应的手册页概述和手册页名称。打印任何匹配结果。等效于 \fBapropos\ \-r\fP\fI\ printf\fP\fB.\fP .TP \fBman\ \-f\fP\fI\ smail\fP 查找 \fIsmail\fP 引用的手册页并输出找到的任何概述。等效于 \fBwhatis\ \-r\fP\fI\ smail\fP\fB.\fP .SH 概述 \fBman\fP 有许多选项供用户灵活使用。搜索路径、章节顺序、输出处理器和其他行为和操作均可更改,具体如下。 If set, various environment variables are interrogated to determine the operation of \fBman\fP. It is possible to set the `catch all' variable $\fBMANOPT\fP to any string in command line format with the exception that any spaces used as part of an option's argument must be escaped (preceded by a backslash). \fBman\fP will parse $\fBMANOPT\fP prior to parsing its own command line. Those options requiring an argument will be overridden by the same options found on the command line. To reset all of the options set in $\fBMANOPT\fP, \fB\-D\fP can be specified as the initial command line option. This will allow man to `forget' about the options specified in $\fBMANOPT\fP although they must still have been valid. 手册分页程序工具封装在 \fBman\-db\fP 程序包里,它们充分利用 \fB索引\fP 数据库缓存。这些缓存包含了诸如每个手册页存储在文件系统的什么位置,它的 \fIwhatis\fP (对手册页的一句概述) 包含什么,而且能让 \fBman\fP 运行更快些,因为不用每次搜索文件系统查找相应的手册页。如果调用时使用了 \fB\-u\fP 选项,\fBman\fP 会保证缓存的一致性;这避免了手动运行软件来更新传统的 \fIwhatis\fP 文本数据库。 .\"`User' manual page hierarchies will have .\".B index .\"caches created `on the fly'. 如果 \fBman\fP 从 \fBmandb\fP 初始化的 \fB索引\fP 数据库中找不到某个手册页层次结构,它仍然会搜索请求的手册页,尽管搜索该层次结构时需要展开文件。如果 \fBwhatis\fP 或 \fBapropos\fP 找不到 \fB索引\fP,它会尝试从传统的 \fIwhatis\fP 数据库中提取信息。 这些工具默认支持以 \fB.Z\fP, \fB.z\fP 和 \fB.gz\fP 为扩展名的 nroff 压缩源文件。可以支持其他压缩扩展名,但相应信息需要在编译时提供。同样,任何 cat 页面将使用 \fBgzip\fP 压缩。每个“全局”手册页层次结构如 \fI/usr/share/man\fP 或 \fI/usr/X11R6/man\fP 可以包含任何与其 cat 页层次结构相同的目录。传统上 cat 页面保存在与 man 页面相同的层次结构下,但由于某些原因,例如 \fBFile Hierarchy Standard (文件系统层次结构标准, FHS)\fP 所指出的,可能将它们保存在其他位置更好。有关如何操作的详细信息,请参阅 \fBmanpath\fP(5)。想了解这样做的详细原因,请阅读标准文档。 此包提供了国际化支持。本地语言的手册页(如果系统上有)可以通过使用 \fIlocale\fP 功能来访问。要启用本地语言支持,需要将 $\fBLC_MESSAGES\fP 或 $\fBLANG\fP 或其他系统相关的环境变量设置为您的语言区域代码;该代码通常以基于 \fBPOSIX 1003.1\fP 的格式指定: .\" .\" Need a \c to make sure we don't get a space where we don't want one .\" <\fI语言\fP>[\|\fB_\fP<\fI地区\fP>\|[\|\fB.\fP<\fI字符集\fP>\|[\|\fB,\fP<\fI版本\fP>\|]\|]\|] 如果所需的页面有您的 \fI区域\fP 对应的版本,它会替代标准的(通常为美国英语)手册页显示。 国际化的消息分类功能也包含在此包中,可以用同样的方式启用(同样,如果可用的话)。如果您发现此包提供的手册页和消息分类对您的本地语言不可用并且想提供支持,请联系协调这类活动的(手册本地化)维护者。 有关此手册分页程序其他可用功能和扩展的信息,请阅读此包提供的文档。 .SH 默认值 \fBman\fP 将在 \fI索引\fP 数据库缓存中搜索需要的手册页。如果指定了 \fB\-u\fP 选项,将执行缓存一致性检查来保证数据库与文件系统精确对应。如果总是指定该选项,则不必在缓存初次创建后运行 \fBmandb\fP,除非缓存被破坏。不过,缓存一致性检查在安装了很多手册页的系统上可能很慢,因此默认不检查;系统管理员可以隔段时间(如每周)运行一次 \fBmandb\fP 来保证数据库缓存及时更新。为预防过期缓存导致的问题,\fBman\fP 会在查找缓存失败后退回到文件展开查找,就像没有缓存时一样。 一旦定位到手册页,程序将检查是否已存在一个相关的“cat”文件并且比 nroff 文件新。如果是,这个预格式化的文件(通常)会使用分页程序解压和显示。分页程序可以通过几种方式指定,或者退回到使用一个默认的(详见 \fB\-P\fP 选项)。如果找不到 cat 文件或它比 nroff 文件旧,nroff 将通过各种程序过滤并立即显示。 如果可以生成 cat 文件(相应的 cat 目录存在并有正确的权限),\fBman\fP 会在后台压缩并保存 cat 文件。 The filters are deciphered by a number of means. Firstly, the command line option \fB\-p\fP or the environment variable $\fBMANROFFSEQ\fP is interrogated. If \fB\-p\fP was not used and the environment variable was not set, the initial line of the nroff file is parsed for a preprocessor string. To contain a valid preprocessor string, the first line must resemble \&\fB'\e"\fP <\fB字符串\fP> 其中 \fB字符串\fP 可以是下面 \fB\-p\fP 选项所描述的任何字符的组合。 如果以上方法都没有提供过滤程序信息,将使用默认程序集。 .\" ******************************************************************** 过滤程序和主格式化程序(\fBnroff\fP 或 [\fBtg\fP]\fBroff\fP \fB\-t\fP) 将组成格式化流水线并执行。或者,如果 man 树根节点有可执行的 \fImandb_nfmt\fP (或 \fImandb_tfmt\fP \fB\-t\fP) 程序,将转而执行它。手册源文件、预处理字符串,以及可选的以 \fB\-T\fP 或 \fB\-E\fP 指定的设备将作为参数传递给它。 .SH 选项 非参数的选项如果在命令行和/或 $\fBMANOPT\fP 重复指定,不会产生问题。对于需要参数的选项,每次重复将覆盖上个参数值。 .SS 常规选项 .TP \fB\-C\ \fP\fI文件\fP,\ \fB\-\-config\-file=\fP\fI文件\fP 使用此用户配置文件代替默认的 \fI~/.manpath\fP。 .TP .if !'po4a'hide' .BR \-d ", " \-\-debug 打印调试信息。 .TP .if !'po4a'hide' .BR \-D ", " \-\-default 此选项通常作为第一个选项,它将 \fBman\fP 的行为恢复为默认。它的作用是重置任何在 $\fBMANOPT\fP 中设置的选项。\fB\-D\fP 之后的任何选项正常有效。 .TP \fB\-\-warnings\fP[=\fIwarnings\/\fP] 启用来自 \fIgroff\fP 的警告。这可以用于检查手册页源文件完整性。\fI警告\fP 是以英文逗号分隔的警告名列表;如果不提供,默认为“mac”。请查阅 \fBinfo groff\fP 中的 \(lq警告\(rq 节点了解可用的警告名列表。 .SS 操作的主要方式 .TP .if !'po4a'hide' .BR \-f ", " \-\-whatis Equivalent to \fBwhatis\fP. Display a short description from the manual page, if available. See \fBwhatis\fP(1) for details. .TP .if !'po4a'hide' .BR \-k ", " \-\-apropos 等同于 \fBapropos\fP。搜索关键词对应的手册概述并显示任何匹配结果。详见 \fBapropos\fP。 .TP .if !'po4a'hide' .BR \-K ", " \-\-global\-apropos 在所有手册中搜索文本。这是蛮力搜索,需要花费一定时间;如果可以,您应该指定手册章节以减少需要搜索的手册页数量。搜索条目可以是简单的字符串(默认),或正则表达式(若使用了 \fB\-\-regex\fP 选项)。 .TP .if !'po4a'hide' .BR \-l ", " \-\-local\-file .\" Compressed nroff source files with a supported compression .\" extension will be decompressed by man prior to being displaying via the .\" usual filters. 启用“本地”方式。格式化并显示本地手册文件,而非搜索系统手册集。每个手册页参数将解释为格式正确的 nroff 源文件。不产生 cat 文件。如果参数中有“\-”,将从标准输入读取。如果未指定它,而 man 未找到要求的页面,在显示错误消息前 man 会假设指定了此选项进行尝试,使用名称作为文件名并查找精确匹配。 .TP .if !'po4a'hide' .BR \-w ", " \-\-where ", " \-\-path ", " \-\-location 不实际显示手册页,但打印将格式化的 nroff 文件的位置。 .TP .if !'po4a'hide' .BR \-W ", " \-\-where\-cat ", " \-\-location\-cat 不实际显示手册页,但打印将显示的 cat 文件的位置。如果同时指定了 \-w 和 \-W,同时打印二者,以空格隔开。 .TP .if !'po4a'hide' .BR \-c ", " \-\-catman 此选项一般不使用,并且只应由 \fBcatman\fP 程序使用。 .TP \fB\-R\ \fP\fI编码\fP,\ \fB\-\-recode\fP=\fI编码\fP 与正常的格式化手册页不同,将输入源转换成指定的 \fI编码\fP 输出。如果您已经知道源文件的编码,也可以直接使用 \fBmanconv\fP(1)。不过,此选项可以将几个手册页转换为单一编码,而不用明确声明各自的编码,前提是它们已经安装在与手册页层次结构类似的目录结构中。 .SS 查找手册页 .TP \fB\-L\ \fP\fI区域\fP,\ \fB\-\-locale=\fP\fI区域\fP .\" .\" Due to the rather silly limit of 6 args per request in some `native' .\" *roff compilers, we have do the following to get the two-line .\" hanging tag on one line. .PP to begin a new paragraph, then the .\" tag, then .RS (start relative indent), the text, finally .RE .\" (end relative indent). .\" \fBman\fP 通常会通过调用 C 语言函数 \fBsetlocale\fP(3) 来确定您的当前区域设置。该函数会查询多个环境变量,可能包括 $\fBLC_MESSAGES\fP 和 $\fBLANG\fP。要临时覆盖检测到的值,请使用该选项直接向 \fBman\fP 提供一个 \fI区域\fP 字符串。注意,在搜索页面实际开始前它不会生效。帮助消息等输出将始终以检测到的区域语言显示。 .PP \fB\-m\fP \fI系统\fP\|[\|,.\|.\|.\|]\|, \fB\-\-systems=\fP\fI系统\fP\|[\|,.\|.\|.\|] .RS 如果此系统可以访问其他操作系统的手册页,可以使用此选项访问它们。如要在 NewOS 的手册页集中搜索某个手册页,使用 \fB\-m\fP \fBNewOS\fP 选项。 指定的 \fI系统\fP 选项可以是逗号分隔的操作系统名称组合。要在搜索中包括本地操作系统的手册页,可以在参数字符串中包含系统名 \fBman\fP。此选项会覆盖 $\fBSYSTEM\fP 环境变量。 .RE .TP \fB\-M\ \fP\fI路径\fP,\ \fB\-\-manpath=\fP\fI路径\fP 指定要使用的另一 manpath 路径。默认情况下 \fBman\fP 使用 \fBmanpath\fP 得到的代码来确定搜索路径。此选项会覆盖 $\fBSYSTEM\fP 环境变量。 指定为 manpath 的路径必须是划分为若干章节的手册页层次结构的根目录。章节描述见 man\-db 手册(位于“手册页系统”)。要查看层次结构之外的手册页,请参阅 \fB\-l\fP 选项。 .TP \fB\-S\ \fP\fI列表\fP,\ \fB\-s\ \fP\fI列表\fP,\ \fB\-\-sections=\fP\fI列表\fP 要搜索的“指定顺序”的手册章节列表,以英文冒号或逗号分隔。此选项会覆盖 $\fBMANSECT\fP 环境变量。(使用 \fB\-s\fP 表示是为了与 系统 V 兼容。) .TP \fB\-e\ \fP\fIsub\-extension\fP,\ \fB\-\-extension=\fP\fIsub\-extension\fP 某些系统包含大量的手册页包,例如某些系统将 \fBTcl\fP (手册)包并入主手册页层次目录。为避免两个手册页重名,如 \fBexit\fP(3),\fBTcl\fP 手册页通常都归于 \fBl\fP 章节。为解决这一不便,现在可以将页面放在正确的节,分配给它们一个特定的“扩展(extension”即可;这个例子中,就是 \fBexit\fP(3tcl)。正常操作时,\fBman\fP 会优先显示 \fBexit\fP(3) 而不是 \fBexit\fP(3tcl)。为协调这一状况并避免要记住所需手册页属于哪个章节,现在可以给 \fBman\fP 指定一个 \fIsub\-extension\fP字符串,指示该手册页必须属于哪个包。对于上面的例子,给 \fBman\fP 加上 \fB\-e\ tcl\fP 选项,就能限制只搜索带有 \fB*tcl\fP 扩展的页面。 .TP .if !'po4a'hide' .BR \-i ", " \-\-ignore\-case 搜索手册页时忽略大小写。默认值。 .TP .if !'po4a'hide' .BR \-I ", " \-\-match\-case 搜索手册页时匹配大小写。 .TP .if !'po4a'hide' .B \-\-regex 显示名字或描述的任何部分与所提供的正则表达式 \fI页\fP 参数匹配的所有页面,像使用 \fBapropos\fP(1) 一样。由于搜索正则表达式时通常没办法选出“最佳”手册页,此选项隐含打开 \fB\-a\fP 选项。 .TP .if !'po4a'hide' .B \-\-wildcard 显示名字或描述的任何部分与所提供的 shell 格式通配符 \fI页\fP 参数匹配的所有页面,像使用 \fBapropos\fP(1) \fB\-\-wildcard\fP 一样。\fI页\fP 参数必须匹配整个名字或描述,或匹配描述中单词的边界。由于搜索通配符时通常没办法选出“最佳”手册页,此选项隐含打开 \fB\-a\fP 选项。 .TP .if !'po4a'hide' .B \-\-names\-only 如果使用了 \fB\-\-regex\fP 或 \fB\-\-wildcard\fP 选项,则只匹配手册页名而不匹配描述,像使用 \fBwhatis\fP(1) 一样。否则不起作用。 .TP .if !'po4a'hide' .BR \-a ", " \-\-all 默认情况下,\fBman\fP 在显示它找到的最符合的手册页后会退出。此选项强制 \fBman\fP 显示名字匹配搜索条件的所有的手册页。 .TP .if !'po4a'hide' .BR \-u ", " \-\-update 此选项使 \fBman\fP 对数据库缓存进行“inode 级别”的一致性检查,以保证缓存与文件系统精确对应。只有安装的 \fBman\fP 程序设置了 setuid 权限位时它才有效。 .TP .if !'po4a'hide' .B \-\-no\-subpages 默认情况下,\fBman\fP 会试图将命令行上提供的一对手册页名视同包含连字符或下划线的单个手册页名来解释。这会支持那些实现了多个子命令的程序的常见模式,允许程序为每个子命令提供手册页,并用和调用各子命令的语法类似的方式访问它们。例如: .nf .if !'po4a'hide' \& $ man \-aw git diff .if !'po4a'hide' \& /usr/share/man/man1/git\-diff.1.gz .fi 要禁用此行为,请使用 \fB\-\-no\-subpages\fP 选项。 .nf .if !'po4a'hide' \& $ man \-aw \-\-no\-subpages git diff .if !'po4a'hide' \& /usr/share/man/man1/git.1.gz .if !'po4a'hide' \& /usr/share/man/man3/Git.3pm.gz .if !'po4a'hide' \& /usr/share/man/man1/diff.1.gz .fi .SS 控制格式化输出 .TP \fB\-P\ \fP\fI分页程序\fP,\ \fB\-\-pager=\fP\fI分页程序\fP 指定使用哪个输出分页程序。\fBman\fP 默认使用 \fBpager -s\fP。此选项会覆盖 $\fBMANPAGER\fP 环境变量,进一步覆盖 $\fBPAGER\fP 环境变量。它不和 \fB\-f\fP 或 \fB\-k\fP 合用。 值可以是简单的命令名或带参数的命令,并可以使用 shell 引用(反斜杠、单引号或双引号)。不能使用管道连接多个命令;如果您需要,请使用封装器脚本,它能够以参数形式或从标准输入获得要显示的文件。 .TP \fB\-r\ \fP\fI提示\fP,\ \fB\-\-prompt=\fP\fI提示\fP 如果使用较新的 \fBless\fP 作为分页程序,\fBman\fP 将尝试设置它的提示消息和一些敏感选项。默认的提示消息类似于 \fB\ Manual page\fP\fI\ name\fP\fB(\fP\fIsec\fP\fB)\fP\fB\ line\fP\fI\ x\fP .\"The default options are .\".BR \-six8 . .\"The actual default will depend on your chosen .\".BR locale . 其中 \fIname\fP 表示手册页名,\fIsec\fP 表示找到的手册页所属的章节,\fIx\fP 是当前行号。这是通过使用 $\fBLESS\fP 环境变量实现的。 .\"You may need to do this if your .\"version of .\".B less .\"rejects the default options or if you prefer a different prompt. 提供一个带字符串的 \fB\-r\fP 选项会覆盖这个默认值。字符串可以包含文本 \fB$MAN_PN\fP,它会展开为用“(”和“)”括起来的当前手册页的章节名。显示默认提示的字符串可以表示为 \fB\e\ Manual\e\ page\e\ \e$MAN_PN\e\ ?ltline\e\ %lt?L/%L.:\fP .br \fBbyte\e\ %bB?s/%s..?\e\ (END):?pB\e\ %pB\e\e%..\fP .br \fB(press h for help or q to quit)\fP 为了好读,这里分成了三行。字符串的含义请参阅 \fBless\fP(1) 手册页。提示字符串将首先由 shell 解释。提示中的所有的双引号、反斜杠都必须在前面加一个反斜杠转义。提示字符串可以转义的 $ 结束,后面还可以跟其他的 less 选项。\fBman\fP 默认设置 \fB\-ix8\fP 选项。 下面描述的 $\fBMANLESS\fP 环境变量可以用来在命令行未指定时设置默认的提示字符串。 .TP .if !'po4a'hide' .BR \-7 ", " \-\-ascii 当在 7 位终端或终端模拟器中查看纯 \fIascii\fP(7) 手册页时,若使用 \fBGNU\fP \fBnroff\fP \fIlatin1\fP(7) 设备描述,一些字符可能显示不正确。此选项允许纯 \fIascii\fP 手册页使用 \fIlatin11\fP 设备以 \fIascii\fP 显示。它不会转换任何 \fIlatin1\fP 文本。死皮赖脸显示了进行的转换:其中一部分可能只有在使用 \fBGNU\fP \fBnroff\fP 的 \fIlatin1\fP(7) 设备时才正确显示。 .ie c \[shc] \ . ds softhyphen \[shc] .el \ . ds softhyphen \(hy .na .TS tab (@); l c c c. 描述@八进制@latin1@ascii _ T{ 连字符 T}@255@\*[softhyphen]@- T{ 点(中间点) T}@267@\(bu@o T{ 重音符号 T}@264@\(aa@' T{ 乘号 T}@327@\(mu@x .TE .ad 如果 \fIlatin1\fP 列显示正确,您的终端可能作了 \fIlatin1\fP 字符设置,此选项将不需要。如果 \fIlatin1\fP 和 \fIascii\fP 列一样,那么您正在使用此选项阅读本手册页,或 \fBman\fP 未使用 \fIlatin1\fP 设备描述来格式化此页。如果 \fIlatin1\fP 列缺损,您可能要使用此选项来查看手册页。 在使用 \fB\-t\fP, \fB\-H\fP, \fB\-T\fP, 或 \fB\-Z\fP 选项时此选项可能对 \fBGNU 版\fP 之外的 \fBnroff\fP 程序无用。 .TP \fB\-E\ \fP\fI编码\fP,\ \fB\-\-encoding\fP=\fI编码\fP 生成对应字符编码的输出,而非默认编码。为向后兼容,\fI编码\fP 可以是 \fBnroff\fP 设备,如 \fBascii\fP、\fBlatin1\fP 或 \fButf8\fP,也可以是实际的字符编码如 \fBUTF\-8\fP。 .TP .if !'po4a'hide' .BR \-\-no\-hyphenation ", " \-\-nh 通常,如果需要将单词排在一行而不添加过多的空格, \fBnroff\fP 会在换行处自动断字(给文本添加连字符,即使单词本来不包含)。此选项禁止自动断字,即单词包含连字符时才会被断开。 如果您编写手册页时只是不希望 \fBnroff\fP 在某个位置不恰当地断字,不要使用此选项,而是查询 \fBnroff\fP 文档(寻找方法);例如,您可以在单词中插入“\e%”来指示该位置可以断字,或在单词开头插入“\e%”来阻止对它断字。 .TP .if !'po4a'hide' .BR \-\-no\-justification ", " \-\-nj 通常,\fBnroff\fP 会自动两端对齐文本。此选项禁止两端对齐,只对齐左边,形成所谓的“ragged\-right”(右边不齐)的文本。 如果您编写手册页时只是不希望 \fBnroff\fP 对齐某些段落,不要使用此选项,而是查询 \fBnroff\fP 文档(寻找方法);例如,您可以使用“.na”、“.nf”、“.fi”和“.ad”请求来临时禁止对齐和填充。 .TP \fB\-p\ \fP\fI字符串\fP,\ \fB\-\-preprocessor=\fP\fI字符串\fP 指定 \fBnroff\fP 或 \fBtroff\fP/\fBgroff\fP 之前运行的预处理器序列。系统中可能未安装所有的预处理器。一些预处理器及其代号如下:\fBeqn\fP (\fBe\fP), \fBgrap\fP (\fBg\fP), \fBpic\fP (\fBp\fP), \fBtbl\fP (\fBt\fP), \fBvgrind\fP (\fBv\fP), \fBrefer\fP (\fBr\fP)。此选项覆盖 $\fBMANROFFSEQ\fP 环境变量。\fBzsoelim\fP 总是作为第一个预处理器运行。 .TP .if !'po4a'hide' .BR \-t ", " \-\-troff 使用 \fI%troff\fP 来格式化手册页到 stdout。此选项不要求和 \fB\-H\fP、\fB\-T\fP 或 \fB\-Z\fP 一起使用。 .TP \fB\-T\fP[\fIdevice\/\fP], \fB\-\-troff\-device\fP[=\fIdevice\/\fP] 此选项用于更改 \fBgroff\fP (也可能是 \fBtroff\fP) 的输出以适合某个非默认设备。此选项隐含打开 \fB\-t\fP。(Groff\-1.17 提供的)例子包括 \fBdvi\fP、\fBlatin1\fP、\fBps\fP、\fButf8\fP、\fBX75\fP 和 \fBX100\fP。 .TP \fB\-H\fP[\fIbrowser\/\fP], \fB\-\-html\fP[=\fIbrowser\/\fP] 此选项使 \fBgroff\fP 生成 HTML 输出并在浏览器中显示输出结果。浏览器选择取决于可选的 \fIbrowser\fP 参数(若提供)、$\fBBROWSER\fP 环境变量,或编译时指定的默认值(或环境变量未设置,默认值通常为 \fBlynx\fP)。此选项隐含打开 \fB\-t\fP,并只和 \fBGNU\fP \fBtroff\fP 一起使用。 .TP \fB\-X\fP[\fIdpi\/\fP], \fB\-\-gxditview\fP[=\fIdpi\/\fP] 此选项使用 \fBgxditview\fP 程序在一个图形窗口中显示 \fBgroff\fP 的输出结果。\fIdpi\fP (点/英寸)可以是 75、75\-12、100 或 100\-12,默认为 75;\-12 形式使用 12 点的基础字号。此选项隐含打开带相应 X75、X75\-12、X100 或 X100\-12 参数的 \fB\-T\fP 选项。 .TP .if !'po4a'hide' .BR \-Z ", " \-\-ditroff \fBgroff\fP 会运行 \fBtroff\fP 然后使用合适的后处理器产生适合所选设备的输出。如果 \fI%troff\fP 为 \fBgroff\fP,此选项会传递给 \fBgroff\fP 并禁止使用后处理器。此选项隐含打开 \fB\-t\fP 选项。 .SS 获取帮助 .TP .if !'po4a'hide' .BR \-? ", " \-\-help 打印帮助消息并退出。 .TP .if !'po4a'hide' .BR \-\-usage Print a short usage message and exit. .TP .if !'po4a'hide' .BR \-V ", " \-\-version 显示版本信息。 .SH 退出状态 .TP .if !'po4a'hide' .B 0 程序成功执行。 .TP .if !'po4a'hide' .B 1 用法、语法或配置文件出错。 .TP .if !'po4a'hide' .B 2 操作出错。 .TP .if !'po4a'hide' .B 3 子进程返回了非零的退出状态码。 .TP .if !'po4a'hide' .B 16 至少有一个页面/文件/关键词不存在或不匹配。 .SH 环境 .\".TP \w'MANROFFSEQ\ \ 'u .TP .if !'po4a'hide' .B MANPATH 如果设置了 $\fBMANPATH\fP,它的值会用作搜索手册页的路径。 .TP .if !'po4a'hide' .B MANROFFOPT $\fBMANROFFOPT\fP 的内容会在每次 \fBman\fP 调用格式化程序(\fBnroff\fP, \fBtroff\fP 或 \fBgroff\fP)时添加到命令行。 .TP .if !'po4a'hide' .B MANROFFSEQ 如果设置了 $\fBMANROFFSEQ\fP,它的值会用于确定每个手册页经过的预处理程序的集合。默认的预处理器列表因系统而异。 .TP .if !'po4a'hide' .B MANSECT 如果设置了 $\fBMANSECT\fP,它的值(以冒号分隔的章节列表)会用于确定搜索哪些章节及搜索顺序。默认值为“1 n l 8 3 2 3posix 3pm 3perl 5 4 9 6 7”,除非被 \fI/etc/manpath.config\fP 中的 \fBSECTION\fP 指令覆盖。 .TP .if !'po4a'hide' .BR MANPAGER , " PAGER" 如果设置了 $\fBMANPAGER\fP 或 $\fBPAGER\fP (优先使用 $\fBMANPAGER\fP),它的值会用作显示手册页的程序的名称。默认使用 \fBpager -s\fP。 值可以是简单的命令名或带参数的命令,并可以使用 shell 引用(反斜杠、单引号或双引号)。不能使用管道连接多个命令;如果您需要,请使用封装器脚本,它能够以参数形式或从标准输入获得要显示的文件。 .TP .if !'po4a'hide' .B MANLESS 如果设置了 $\fBMANLESS\fP,它的值将用作 \fBless\fP 分页程序的默认提示字符串,如同作为 \fB\-r\fP 选项的参数传递一样(因此出现的任何 \fB$MAN_PN\fP 会以同样的方式展开)。例如,如果您想将提示字符串无条件地设置为\(lqmy prompt string\(rq,请将 $\fBMANLESS\fP 设置为 \(oq\fB\-Psmy\ prompt\ string\fP\(cq。使用 \fB\-r\fP 选项会覆盖此环境变量。 .TP .if !'po4a'hide' .B BROWSER 如果设置了 $\fBBROWSER\fP,它的值(冒号分隔的命令列表)中的每一个会轮流用于尝试为 \fBman\fP \fB\-\-html\fP 启动一个网络浏览器。每个命令中,\fI%s\fP 会替换成包含 \fBgroff\fP HTML 输出的文件名,\fI%%\fP 会替换成一个百分号(%),\fI%c\fP 会替换成冒号(:)。 .TP .if !'po4a'hide' .B SYSTEM 如果设置了 $\fBSYSTEM\fP 环境变量,则和将它指定为 \fB\-m\fP 选项的参数效果相同。 .TP .if !'po4a'hide' .B MANOPT If $\fBMANOPT\fP is set, it will be parsed prior to \fBman's\fP command line and is expected to be in a similar format. As all of the other \fBman\fP specific environment variables can be expressed as command line options, and are thus candidates for being included in $\fBMANOPT\fP it is expected that they will become obsolete. N.B. All spaces that should be interpreted as part of an option's argument must be escaped. .TP .if !'po4a'hide' .B MANWIDTH If $\fBMANWIDTH\fP is set, its value is used as the line length for which manual pages should be formatted. If it is not set, manual pages will be formatted with a line length appropriate to the current terminal (using the value of $\fBCOLUMNS\fP, an \fBioctl\fP(2) if available, or falling back to 80 characters if neither is available). Cat pages will only be saved when the default formatting can be used, that is when the terminal line length is between 66 and 80 characters. .TP .if !'po4a'hide' .B MAN_KEEP_FORMATTING 通常,当输出不定向到终端时(如定向到文件或管道),格式化字符会被忽略,以便不使用特殊工具就能阅读结果。但如果 $\fBMAN_KEEP_FORMATTING\fP 设置成了任何非空的值,这些格式化字符将保存。这对于可以解释格式化字符的 \fBman\fP 封装程序有用。 .TP .if !'po4a'hide' .B MAN_KEEP_STDERR 通常,当输出定向到终端时(一般是分页程序),产生手册格式化版本的命令造成的任何错误输出都会被忽略,以免干扰分页程序显示。\fBgroff\fP 这样的程度经常产生较小的有关排版显示的错误消息(如未对齐)。这些消息很难看,并且一般与手册页一起显示时会产生干扰。不过,有些用户就是想看到它们,好吧,如果 $\fBMAN_KEEP_STDERR\fP 设成了非空的值,这些错误输出会照常显示。 .TP .if !'po4a'hide' .BR LANG , " LC_MESSAGES" 取决于系统和实现,程序会查询 $\fBLANG\fP 和/或 $\fBLC_MESSAGES\fP 获知当前的消息区域语言。\fBman\fP 会以该区域语言显示消息(若可用)。参阅 \fBsetlocale\fP(3) 了解准确的详情。 .SH 文件 .TP .if !'po4a'hide' .I /etc/manpath.config man\-db 配置文件。 .TP .if !'po4a'hide' .I /usr/share/man 全局手册页层次结构。 .TP .if !'po4a'hide' .I /usr/share/man/index.(bt|db|dir|pag) 传统的全局 \fI索引\fP 数据库缓存。 .TP .if !'po4a'hide' .I /var/cache/man/index.(bt|db|dir|pag) 与 FHS 兼容的全局 \fI索引\fP 数据库缓存。 .SH 亦见 .if !'po4a'hide' .BR apropos (1), .if !'po4a'hide' .BR groff (1), .if !'po4a'hide' .BR less (1), .if !'po4a'hide' .BR manpath (1), .if !'po4a'hide' .BR nroff (1), .if !'po4a'hide' .BR troff (1), .if !'po4a'hide' .BR whatis (1), .if !'po4a'hide' .BR zsoelim (1), .if !'po4a'hide' .BR setlocale (3), .if !'po4a'hide' .BR manpath (5), .if !'po4a'hide' .BR ascii (7), .if !'po4a'hide' .BR latin1 (7), .if !'po4a'hide' .BR man (7), .if !'po4a'hide' .BR catman (8), .if !'po4a'hide' .BR mandb (8), man\-db 包的手册,\fBFSSTND\fP .SH 历史 1990, 1991 \(en Originally written by John W.\& Eaton (jwe@che.utexas.edu). 1992年12月23日: Rik Faith (faith@cs.unc.edu) 应用了 Willem Kasdorp (wkasdo@nikhefk.nikef.nl) 提供的 bug 补丁。 30th April 1994 \(en 23rd February 2000: Wilf. (G.Wilford@ee.surrey.ac.uk) has been developing and maintaining this package with the help of a few dedicated people. 30th October 1996 \(en 30th March 2001: Fabrizio Polacco maintained and enhanced this package for the Debian project, with the help of all the community. 31st March 2001 \(en present day: Colin Watson is now developing and maintaining man\-db.