UNPKG

3.43 kBMarkdownView Raw
1apropos
2===
3
4在 whatis 数据库中查找字符串
5
6## 补充说明
7
8**apropos命令** 在一些特定的包含系统命令的简短描述的数据库文件里查找关键字,然后把结果送到标准输出。 
9
10如果你不知道完成某个特定任务所需要命令的名称,可以使用一个关键字通过Linux apropos实用程序来搜索它。该实用程序可以搜索关键字并且显示所有包含匹配项的man页面的简短描述。另外,使用man实用程序和-k(关键字)选项,可以得到和用Linux apropos实用程序相同的结果(实际上是相同的命令)。
11
12### 语法
13
14```shell
15apropos [-dalhvV] -e|-[w|-r] [-s section] [-m system[,...]] [-M path] [-L locale] -C [file] keyword ...
16```
17
18### 选项
19
20```shell
21-d, --debug:输出调试信息。
22-v, --verbose:输出详细的警告信息。
23-r, -- regex:将每个keyword作为正则表达式解释。这是默认行为。每个keyword将匹配手册页和描述。
24-w, --wildcard:将每个keyword作为shell样式的通配符解释。
25-e, --exact:每个keyword将精确匹配手册页名字和描述。
26-a, --and:只显示匹配所有keyword的手册页和描述。默认显示匹配任何keyword的项。
27-l, --long:不根据终端宽度缩减输出。
28-s section, --section section:只查找指定的手册section。
29-m system[,...], --systems=system[,...]:用于查找其它操作系统的手册页。
30-M path, --manpath=path:指定从其它以冒号分隔的手册页层次查找。默认使用$MANPATH环境变量。这个选项覆盖$MANPATH的内容。
31-L locale, --locale=locale:apropos调用C函数setlocale来得到当前本地化信息,包括$LC_MESSAGE和$LANG。使用该选项提供一个locale字符串来临时更改本地化信息。
32-C file, --config-file=file:使用这个用户配置文件而不是默认的~/.manpath。
33-h, --help:打印帮助信息并退出。
34-V, --version:打印版本信息并退出。
35```
36
37### 返回值
38
39返回0表示成功,1表示用法、语法或配置文件错误,2表示操作错误,16表示没有找到匹配的内容。
40
41### 实例
42
43```shell
44[root@localhost ~]# man -k who
45at.allow [at] (5) - determine who can submit jobs via at or batch
46at.deny [at] (5) - determine who can submit jobs via at or batch
47jwhois (1) - client for the whois service
48jwhois (rpm) - Internet whois/nicname client.
49Net::LDAP::Extension::whoami (3pm) - LDAP Who am I? Operation
50w (1) - Show who is logged on and what they are doing
51who (1p) - display who is on the system
52who (1) - show who is logged on
53whoami (1) - print effective userid
54
55[root@localhost ~]# apropos who
56at.allow [at] (5) - determine who can submit jobs via at or batch
57at.deny [at] (5) - determine who can submit jobs via at or batch
58jwhois (1) - client for the whois service
59jwhois (rpm) - Internet whois/nicname client.
60Net::LDAP::Extension::WhoAmI (3pm) - LDAP Who am I? Operation
61w (1) - Show who is logged on and what they are doing
62who (1p) - display who is on the system
63who (1) - show who is logged on
64whoami (1) - print effective userid
65```
66
67查找手册页名字和描述中包含emacs和vi的手册页:
68
69```shell
70apropos -a emacs vi
71```
72
73