【Linux】一步一步学Linux——whereis命令(15)

00. 目录

文章目录

    • 00. 目录
    • 01. 命令概述
    • 02. 命令格式
    • 03. 常用选项
    • 04. 参考示例
    • 05. 附录

01. 命令概述

whereis命令用来定位命令的二进制程序、源代码文件和man手册页等相关文件的路径。

whereis命令查找速度非常快,因为它不是在磁盘中乱找,而是在一个数据库中查询; 数据库是linux系统自动创建的,包含有本地所有文件的信息,并且每天通过自动执行updatedb命令更新一次。正因为这样,whereis命令的搜索结果有时候会不准确,比如刚添加的文件可能搜不到, 原因就是该数据库文件没有被更新。

02. 命令格式

whereis [选项] 文件

03. 常用选项

用法:
 whereis [选项] 文件

选项:
 -b         只搜索二进制文件
 -B <目录>  定义二进制文件查找路径
 -m         只搜索 man 手册
 -M <目录>  定义 man 手册查找路径
 -s         只搜索源代码
 -S <目录>  定义源代码查找路径
 -f         终止 <目录> 参数列表
 -u         搜索不常见记录
 -l         输出有效查找路径

04. 参考示例


[root@localhost ~]# whereis git
git: /usr/bin/git /usr/share/man/man1/git.1.gz

[root@localhost ~]# whereis -b git
git: /usr/bin/git

[root@localhost ~]# whereis -m git
git: /usr/share/man/man1/git.1.gz

[root@localhost ~]# whereis -s git
git:

[root@localhost ~]# whereis -u git
git: /usr/bin/git /usr/share/man/man1/git.1.gz

[root@localhost ~]# whereis -l git
bin: /usr/bin
bin: /usr/sbin
bin: /usr/lib

05. 附录

参考:【Linux】一步一步学Linux系列教程汇总

你可能感兴趣的:(whereis,whatis,whereis命令,帮助命令,man命令,Linux基础)