发布时间:2025-12-10 23:54:44 浏览次数:19
linux/Unix可以使用 whereis 这个命令来查找某个特定的程序和命令的二进制文件()、源代码和man手册的位置,貌似现在还能看到软件的配置文件的位置(路径)。
命令作用:
查找二进制文件位置
查找软件的配置文件的位置
查找源代码文件位置
查看man手册位置
语法
基本语法如下:
代码如下:
whereis command
OR
代码如下:
whereis program
OR
代码如下:
whereis [options] program
OR
代码如下:
whereis -BMS directory -f command
代码如下:
$ whereis date
Animated gif 01: whereis command running on my Debian based server
如何只搜索二进制文件的位置?
使用 -b 参数 :
代码如下:
$ whereis -b date
代码如下:
$ whereis -m date
代码如下:
$ whereis -s date
问题:whereis -u参数是有问题的,按照man whereis 的说明,-u的就是搜索那些没有二进制文件或者源代码文件或者man手册的文件的。但是实际测试发现,和这毛关系都没有啊。
man手册上的一个例子:
A file is said to be unusual if it does not have one entry of each requested type. Thus the following example, asks for those files in the current directory which have no documentation(意思是搜索当前目录下,没有man文档的文件):
代码如下:
$ whereis -m -u *
代码如下:
$ whereis -B /bin -f ls gcc
代码如下:
ls: /bin/ls /usr/share/man/man1/ls.1.gz
gcc:
代码如下:
# cd /usr/bin
# whereis -u -ms -M /usr/man/man1 -S /usr/src -f *
代码如下:
#cd /bin
#whereis -u -m -M /root -f *
“linux下whereis命令的使用方法”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注本站网站,小编将为大家输出更多高质量的实用文章!