apropos (在手册页面中搜索关键字或正则表达式)

小猪老师 发表于 2020-07-05 08:17
浏览次数:
在手机上阅读

在手册页面中搜索关键字或正则表达式。

查看英文版

目录

1 apropos 运行系统环境

2 apropos 语法

3 apropos 环境

4 apropos 示例

apropos 运行系统环境

Linux

apropos 语法

apropos [-dalhvV] [-e|-w|-r] [-s list] [-m system[,...]] [-M path]
        [-L locale] [-C file] keyword ...

-d, --debug

打印调试信息。

-v, --verbose

打印冗长的警告信息。

-r, --regex

将每个关键字解释为正则表达式。
这是默认行为。
每个关键字将与页面名称和描述相匹配。
它可以匹配任何一个的任何部分。
匹配并不局限于单词边界。

-w, --wildcard

将每个关键字解释为包含shell样式通配符的模式。
每个关键字将与页面名称和描述相匹配。
如果还使用了——exact,则仅当扩展的关键字与整个描述或页面名称匹配时才能找到匹配项。
否则,还允许关键字匹配描述中的单词边界。

-e, --exact

每个关键字将与页面名称和描述精确匹配。

-a, --and

仅显示与所有提供的关键字匹配的项。
默认情况下显示匹配任何关键字的项。

-l, --long

不要将输出修剪到终端宽度。
通常,输出将被截断到终端宽度,以避免由于名称部分写得不好而产生难看的结果。

-s list, --sections list, --section list

只搜索给定的手册部分。
列表是一个冒号或逗号分隔的部分列表。
如果列表中的条目是一个简单的部分,例如“3”,那么显示的描述列表将包括“3”、“3perl”、“3x”等章节中的页面;
如果列表中的条目有扩展名,例如“3perl”,那么列表将只包含手册部分中那个部分的页面。

-m system[,...], --systems=system[,...]

如果该系统可以访问其他操作系统的手册页面描述,则可以使用此选项进行搜索。
例如,要搜索名为“NewOS”的操作系统的手册页描述,请使用-m NewOS选项。
指定的系统可以是以逗号分隔的操作系统名称的组合。
(要包含对本机操作系统的whatis描述的搜索,请在参数字符串中包含系统名man。
此选项将覆盖$SYSTEM环境变量)。

-M path, --manpath=path

指定要搜索的一组以冒号分隔的手动页面层次结构。
默认情况下,apropos使用$MANPATH环境变量,除非它是空的或未设置的,在这种情况下,它将根据您的$PATH环境变量确定适当的“MANPATH”。
此选项将覆盖$MANPATH的内容。

-L locale, --locale=locale

apropos通常通过调用C函数setlocale来确定当前的语言环境,该函数询问各种环境变量,可能包括$LC_MESSAGES和$LANG。
若要临时覆盖所确定的值,请使用此选项直接提供一个地区设置字符串。
注意,直到页面搜索真正开始,它才会生效。
诸如帮助消息之类的输出将始终在最初确定的语言环境中显示。

-C file, --config-file=file

使用此用户配置文件,而不是默认的~/.manpath。

-h, --help

打印帮助信息并退出。

-V, --version

UDisplay版本信息。

apropos [-dalhvV] [-e|-w|-r] [-s list] [-m system[,...]] [-M path]
        [-L locale] [-C file] keyword ...

-d, --debug

Print debugging information.

-v, --verbose

Print verbose warning messages.

-r, --regex

Interpret each keyword as a regular expression. This is the default behavior. Each keyword will be matched against the page names and the descriptions independently. It can match any part of either. The match is not limited to word boundaries.

-w, --wildcard

Interpret each keyword as a pattern containing shell-style wildcards. Each keyword will be matched against the page names and the descriptions independently. If --exact is also used, a match will only be found if an expanded keyword matches an entire description or page name. Otherwise, the keyword is also allowed to match on word boundaries in the description.

-e, --exact

Each keyword will be exactly matched against the page names and the descriptions.

-a, --and

Only display items that match all the supplied keywords. The default is to display items that match any keyword.

-l, --long

Do not trim output to the terminal width. Normally, output will be truncated to the terminal width to avoid ugly results from poorly-written NAME sections.

-s list, --sections list, --section list

Search only the given manual sections. The list is a colon- or comma-separated list of sections. If an entry in list is a simple section, for example "3", then the displayed list of descriptions will include pages in sections "3", "3perl", "3x", and so on; while if an entry in list has an extension, for example "3perl", then the list will only include pages in that exact part of the manual section.

-m system[,...], --systems=system[,...]

If this system has access to other operating system's manual page descriptions, they can be searched using this option. For example, to search the manual page descriptions of an operating system called "NewOS", use the option -m NewOS. The system specified can be a combination of comma-delimited operating system names. (To include a search of the native operating system's whatis descriptions, include the system name man in the argument string. This option will override the $SYSTEM environment variable).

-M path, --manpath=path

Specify an alternate set of colon-delimited manual page hierarchies to search. By default, apropos uses the $MANPATH environment variable, unless it is empty or unset, in which case it will determine an appropriate "manpath" based on your $PATH environment variable. This option overrides the contents of $MANPATH.

-L locale, --locale=locale

apropos will normally determine your current locale by a call to the C function setlocale which interrogates various environment variables, possibly including $LC_MESSAGES and $LANG. To temporarily override the determined value, use this option to supply a locale string directly to apropos. Note that it will not take effect until the search for pages actually begins. Output such as the help message will always be displayed in the initially determined locale.

-C file, --config-file=file

Use this user configuration file rather than the default of ~/.manpath.

-h, --help

Print a help message and exit.

-V, --version

Display version information.

查看英文版

查看中文版

apropos 环境

SYSTEM

如果设置了$SYSTEM,它将具有与指定为-m选项的参数相同的效果。

MANPATH

如果设置了$MANPATH,则将其值解释为要使用的以冒号分隔的手动页面层次结构搜索路径。

MANWIDTH

如果设置了$MANWIDTH,它的值将用作终端宽度(参见——long选项)。
如果没有设置,则在可用的情况下使用ioctl计算终端宽度,或者使用$COLUMNS的值,如果其他方法都失败,则返回到80个字符。

POSIXLY_CORRECT

如果$POSIXLY_CORRECT被设置为null值,则默认的apropos搜索将作为扩展的regex (-r)。
在较新的系统上,这通常已经是默认行为。

SYSTEM

If $SYSTEM is set, it will have the same effect as if it had been specified as the argument to the -m option.

MANPATH

If $MANPATH is set, its value is interpreted as the colon-delimited manual page hierarchy search path to use.

MANWIDTH

If $MANWIDTH is set, its value is used as the terminal width (see the --long option). If it is not set, the terminal width will be calculated using an ioctl if available, the value of $COLUMNS, or falling back to 80 characters if all else fails.

POSIXLY_CORRECT

If $POSIXLY_CORRECT is set, even to a null value, the default apropos search will be as an extended regex (-r). On newer systems, this is often already the default behavior.

查看英文版

查看中文版

apropos 示例

apropos find

在页面名称或描述中显示所有带有“查找”字样的手工条目。
输出如下:

aa_find_mountpoint (2) - find where the apparmor interface filesystem is mounted
chkdupexe (1)          - find duplicate executables
ffs (3)                - find first bit set in a word
ffsl (3)               - find first bit set in a word
ffsll (3)              - find first bit set in a word
find (1)               - search for files in a directory hierarchy
find2perl (1)          - translate find command lines to Perl code
findaffix (1)          - Interactive spelling checking
findfs (8)             - find a filesystem by label or UUID
findmnt (8)            - find a filesystem
findsmb (1)            - list info about machines that respond to SMB name quer...
glob (3)               - find pathnames matching a pattern, free memory from gl...
globfree (3)           - find pathnames matching a pattern, free memory from gl...
ippfind (1)            - find internet printing protocol printers
lfind (3)              - linear search of an array
locate (1)             - find files by name
memdiskfind (1)        - utility to search for a MEMDISK instance
mlocate (1)            - find files by name
mysql_find_rows (1)    - extract SQL statements from files
oldfind (1)            - search for files in a directory hierarchy
pidof (8)              - find the process ID of a running program.
texdoc (1)             - find & view documentation in TeX Live
tfind (3)              - manage a binary tree
tracediff (1)          - find and print differences between two traces
ttyslot (3)            - find the slot of the current user's terminal in some file
apropos find

Display all manual entries with the word find" in the page name or description. Output will resemble the following:

aa_find_mountpoint (2) - find where the apparmor interface filesystem is mounted
chkdupexe (1)          - find duplicate executables
ffs (3)                - find first bit set in a word
ffsl (3)               - find first bit set in a word
ffsll (3)              - find first bit set in a word
find (1)               - search for files in a directory hierarchy
find2perl (1)          - translate find command lines to Perl code
findaffix (1)          - Interactive spelling checking
findfs (8)             - find a filesystem by label or UUID
findmnt (8)            - find a filesystem
findsmb (1)            - list info about machines that respond to SMB name quer...
glob (3)               - find pathnames matching a pattern, free memory from gl...
globfree (3)           - find pathnames matching a pattern, free memory from gl...
ippfind (1)            - find internet printing protocol printers
lfind (3)              - linear search of an array
locate (1)             - find files by name
memdiskfind (1)        - utility to search for a MEMDISK instance
mlocate (1)            - find files by name
mysql_find_rows (1)    - extract SQL statements from files
oldfind (1)            - search for files in a directory hierarchy
pidof (8)              - find the process ID of a running program.
texdoc (1)             - find & view documentation in TeX Live
tfind (3)              - manage a binary tree
tracediff (1)          - find and print differences between two traces
ttyslot (3)            - find the slot of the current user's terminal in some file

查看英文版

查看中文版

其他命令行

apt-cache | apt-get | ar | arch | arp | as | a2p | aspell | ac | at | awk | adduser | a2p | alias | agrep | addgroup |

如此好文,分享给朋友
发表评论
验证码:
评论列表
共0条