linux下apropos命令实战

  • linux下apropos命令实战已关闭评论
  • 54 views
  • A+
所属分类:未分类

实例一:

基本用法以及与man -k对比如下:

使用命令apropos 关键字,例如查找find关键字,如下:

apropos find

结果如下:

[root@izm5e9scdftrqdnflz2nzgz xubo]# apropos find
btrfs-find-root (8) - filter to find btrfs root
db_archive (1) - Find unused log files for archival
dracut-initqueue.service (8) - runs the dracut main loop to find the real root
File::Find (3pm) - Traverse a directory tree.
find (1) - search for files in a directory hierarchy
find2perl (1) - translate find command lines to Perl code
FindBin (3pm) - Locate directory of original perl script
findfs (8) - find a filesystem by label or UUID
findmnt (8) - find a filesystem
oldfind (1) - search for files in a directory hierarchy
perlmodlib (1) - constructing new Perl modules and finding existing ones
pidof (8) - find the process ID of a running program.
Pod::Simple::Search (3pm) - find POD documents in directory trees
systemd-delta (1) - Find overridden configuration files

使用命令:

man -k find

结果如下:

[root@izm5e9scdftrqdnflz2nzgz xubo]# man -k find
btrfs-find-root (8) - filter to find btrfs root
db_archive (1) - Find unused log files for archival
dracut-initqueue.service (8) - runs the dracut main loop to find the real root
File::Find (3pm) - Traverse a directory tree.
find (1) - search for files in a directory hierarchy
find2perl (1) - translate find command lines to Perl code
FindBin (3pm) - Locate directory of original perl script
findfs (8) - find a filesystem by label or UUID
findmnt (8) - find a filesystem
oldfind (1) - search for files in a directory hierarchy
perlmodlib (1) - constructing new Perl modules and finding existing ones
pidof (8) - find the process ID of a running program.
Pod::Simple::Search (3pm) - find POD documents in directory trees
systemd-delta (1) - Find overridden configuration files

 

总结:通过上述,输出都一样。

实例二:

多个关键字查询

多个关键字的话,用空格隔开,查询的时候只要匹配到任意一个就输出,命令如下:

man -k find mkdir

结果如下:

[root@izm5e9scdftrqdnflz2nzgz xubo]# man -k find mkdir
btrfs-find-root (8) - filter to find btrfs root
db_archive (1) - Find unused log files for archival
dracut-initqueue.service (8) - runs the dracut main loop to find the real root
File::Find (3pm) - Traverse a directory tree.
find (1) - search for files in a directory hierarchy
find2perl (1) - translate find command lines to Perl code
FindBin (3pm) - Locate directory of original perl script
findfs (8) - find a filesystem by label or UUID
findmnt (8) - find a filesystem
mkdir (1) - make directories
oldfind (1) - search for files in a directory hierarchy
perlmodlib (1) - constructing new Perl modules and finding existing ones
pidof (8) - find the process ID of a running program.
Pod::Simple::Search (3pm) - find POD documents in directory trees
systemd-delta (1) - Find overridden configuration files
[root@izm5e9scdftrqdnflz2nzgz xubo]# apropos find mkdir
btrfs-find-root (8) - filter to find btrfs root
db_archive (1) - Find unused log files for archival
dracut-initqueue.service (8) - runs the dracut main loop to find the real root
File::Find (3pm) - Traverse a directory tree.
find (1) - search for files in a directory hierarchy
find2perl (1) - translate find command lines to Perl code
FindBin (3pm) - Locate directory of original perl script
findfs (8) - find a filesystem by label or UUID
findmnt (8) - find a filesystem
mkdir (1) - make directories
oldfind (1) - search for files in a directory hierarchy
perlmodlib (1) - constructing new Perl modules and finding existing ones
pidof (8) - find the process ID of a running program.
Pod::Simple::Search (3pm) - find POD documents in directory trees
systemd-delta (1) - Find overridden configuration files

总结:包含find和mkdir的关键字都搜索出来了。

实例三

精确查询

-e, --exact:每个keyword将精确匹配手册页名字和描述。

我们这里先通过who关键字搜索对比一下,命令如下:

apropos who

结果如下:

root@izm5e9scdftrqdnflz2nzgz xubo]# apropos who
at.allow (5) - determine who can submit jobs via at or batch
at.deny (5) - determine who can submit jobs via at or batch
btrfs-filesystem (8) - command group of btrfs that usually work on the whole ...
jwhois (1) - client for the whois service
w (1) - Show who is logged on and what they are doing.
who (1) - show who is logged on
whoami (1) - print effective userid
whois (1) - client for the whois service
whois.jwhois (1) - client for the whois service

然后再加上-e参数搜索一下,命令如下:

apropos -e who

结果如下:

[root@izm5e9scdftrqdnflz2nzgz xubo]# apropos -e who
at.allow (5) - determine who can submit jobs via at or batch
at.deny (5) - determine who can submit jobs via at or batch
w (1) - Show who is logged on and what they are doing.
who (1) - show who is logged on

总结:很明显,加上-e参数后,whoami和whois这些都没了。

实例四

匹配所有关键字

-a, --and:只显示匹配所有keyword的手册页和描述

之前我们查询多个关键字的时候,是or的关系,现在我们通过-a来and一下,命令如下:

apropos -a find mkdir

结果如下:

[root@izm5e9scdftrqdnflz2nzgz ~]# apropos -a find mkdir

总结:通过实例二查询到了好多条,但是加上-a参数后,就连一条都没了。

实例五

完整输出结果

-l, --long:不根据终端宽度缩减输出。

我们先看看不带-l参数的情况,我们通过查找cmsutil关键字,不带参数命令如下:

apropos cmsutil

结果如下:

[root@izm5e9scdftrqdnflz2nzgz xubo]# apropos cmsutil
cmsutil (1) - Performs basic cryptograpic operations, such as encryption and decryption, on Cryptographic Message Syntax...

然后我们带上参数,命令如下:

apropos -l cmsutil

结果如下:

[root@izm5e9scdftrqdnflz2nzgz xubo]# apropos -l cmsutil
cmsutil (1) - Performs basic cryptograpic operations, such as encryption and decryption, on Cryptographic Message Syntax (CMS) messages.

总结:很明显,-l加上后就可以把不带参数的...显示出来了

其他的参数就不一一列举了。

 

  • 安卓客户端下载
  • 微信扫一扫
  • weinxin
  • 微信公众号
  • 微信公众号扫一扫
  • weinxin
avatar