如何在Ubuntu上安装丢失的手册页
我想引用 alias命令的所有可用参数,标志和选项,所以我打开了手册页。
但是,当我尝试打开别名或者unalias命令的man 页面时,我收到了以下消息。
$man alias No manual entry for alias
$man unalias No manual entry for unalias
事实证明,某些其他程序缺少人的页面,例如导出和eval。
除Googling除了了解这些程序之外,还没有其他方式。
在基于RPM的系统(例如,CentOS),如果我们运行"Man别名"命令,它将打开Bash内置的人网页。
我们可能需要通过整个手册页查找相应命令的详细信息。
经过一点谷歌搜索后,我了解到,Shell内置没有专门的手册页,如别名,导出,Linux程序员手册中的EVAL。
如果我们不确定给定的命令是别名,shell内置,文件,函数或者关键字,请使用type命令清楚。
$type alias alias is a shell builtin
这些构建的文档可在相关的shell手册页中提供。
正如我们可以在上面的输出中看到的,别名是shell内置,因此我们可以在关联的shell手册页中查看文档。
在我的情况下,它是bash。
让我们打开Bash的man 网页:
$man bash
在BASH手册页中搜索 alias或者unalias条目。
使用"帮助"命令查看关于shell内置的信息
或者,我们可以使用下面的帮助命令获取shell内置的信息。
$help alias
示例输出:
alias: alias [-p] [name[=value] ... ] Define or display aliases. Without arguments, `alias' prints the list of aliases in the reusable form `alias NAME=VALUE' on standard output. Otherwise, an alias is defined for each NAME whose VALUE is given. A trailing space in VALUE causes the next word to be checked for alias substitution when the alias is expanded. Options: -p print all defined aliases in a reusable format Exit Status: alias returns true unless a NAME is supplied for which no alias has been defined.
如果我们更喜欢手册页格式,只需使用下面的帮助命令的-m标志。
$help -m alias
所有Bash内置都有帮助页面。
甚至帮助命令本身有一个帮助页面。
$help help help: help [-dms] [pattern ...] Display information about builtin commands. Displays brief summaries of builtin commands. If PATTERN is specified, gives detailed help on all commands matching PATTERN, otherwise the list of help topics is printed. Options: -d output short description for each topic -m display usage in pseudo-manpage format -s output only a short usage synopsis for each topic matching PATTERN Arguments: PATTERN Pattern specifiying a help topic Exit Status: Returns success unless PATTERN is not found or an invalid option is given.
这是我们如何找到shell内置信息的方式。
现在,让我们回到主题。
是否有任何方法可以安装缺少的命令页面?
这就是我们现在要做的事。
在Ubuntu上安装丢失的手册页
如前所述,内置是shell 的一部分。
每个shell都有自己的内置。
它们不是独立的命令,他们没有单独的人页面。
幸运的是,Posix Programmer手册中提供了Shell内置的人网页。
我们需要安装它以访问这些人的页面。
在Debian,Ubuntu和其他基于DEB的系统上,只需运行以下命令即可安装POSIX程序员的手册:
$sudo apt install manpages-posix
现在,我们可以使用命令访问shell内置(例如别名)的手册页:
$man alias