2016.8.22 9:00-9:40
The keywords database can become out of date. If you add additional man pages to your system, you may need to rebuild this file with mandb (Ubuntu, SUSE), makewhatis (Red Hat), or catman -w (Solaris, HP-UX, AIX).
keyword指代的库可能已经过期了。如果要向系统添加man手册页,需要构这个库文件,在Ubuntu、SUSE上使用mandb命令,在Red Hat上使用makewhatis命令,在Solaris、HP-UX和AIX上使用catman-w命令。
1.9.3 Storage of man pages
1.9.3 手册页的保存
nroff input for man pages is usually kept in directories under /usr/share/man. Linux systems compress them with gzip to save space. (The man command knows how to uncompress them on the fly.) The man command maintains a cache of formatted pages in /var/cache/man or /usr/share/man if the appropriate directories are writable, but this is a security risk. Most systems preformat the man pages once at installation time (see catman) or not at all.
手册页的nroff输入通常保存在/usr/share/man/下的多个目录中。Linux系统会把他们用gzip压缩以节省空间(命令man知道如何当场将它们解压缩)。如果在/var/cache/man或者/var/share/man下的适当目录有写入权限,那么命令man会在那里维护一个有格式的手册页的缓存,但是这存在安全风险。大多数系统会在安装的时候预处理一次手册页的格式(参考catman命令),或者根本不做预处理。
Solaris understands man pages formatted with SGML in addition to the traditional nroff. The SGML pages have their own section directories underneath /usr/share/man.
除了传统的nroff格式之外,Solaris还支持SGML格式的手册页。SGML格式手册页相关各节的目录都在/usr/share/man下。
The man command can search several man page repositories to find the manual pages you request. On Linux systems, you can find out the current default search path with the manpath command. This path (from Ubuntu) is typical:
命令man会在若干不同的目录中寻找用户需要的手册页。在Linux系统上,用户可以使用manpath命令来确定搜索路径。这个搜索路径(在Ubuntu中)一般为;
ubuntu$ manpath
/usr/local/man:/usr/local/share/man:/usr/share/man
If necessary, you can set your MANPATH environment variable to override the default path:
export MANPATH=/home/share/localman:/usr/share/man
如果有必要,用户可以设置自己的环境变量MANPATH来覆盖默认路径;
Some systems let you set a custom system-wide default search path for man pages,
which can be useful if you need to maintain a parallel tree of man pages such as
those generated by OpenPKG. If you want to distribute local documentation in the form of man pages, however, it is simpler to use your system’s standard packaging mechanism and to put man pages in the standard man directories. See Chapter 12, Software Installation and Management, for more details.
有些系统让用户为手册页设置一个自定义的系统级默认搜索路径,如果用户想要维护平行的一套man手册页目录树(比如OpenPKG创建的目录树),就能够用上这种功能。不过,如果用户想要手册页的形式发布本地文档,更简单的做法是,用系统的标准打包机制打包,并把这些手册页放在标准的man目录下。参考第12章了解有关软件安装和管理的更多知识。