whereis 命令主要用于查找程序文件,并提供这个文件的二进制可执行文件、源代码文件和使用手册存放位置。java
例如,查找 touch 命令node
[root@node1 /]# whereis touch touch: /usr/bin/touch /usr/share/man/man1/touch.1.gz
执行效果以下:nginx
若是只须要查找 touch 命令的二进制文件,可使用 -b 选项实现:spa
[root@node1 /]# whereis -b touch touch: /usr/bin/touch
效果以下:code
例如,查找 nginx 服务blog
[root@node1 /]# whereis nginx nginx: /usr/sbin/nginx /usr/lib64/nginx /etc/nginx /usr/share/nginx /usr/share/man/man8/nginx.8.gz
例如,查找 java 字符串
[root@node1 /]# whereis java java: /usr/java/jdk1.8.0_191/bin/java /usr/local/jdk1.8.0_191/bin/java
若是查询的程序不存在,则返回一个空字符串。class
例如,查找 hello 程序jdk
[root@node1 /]# whereis hello hello: