Linux 查找特定程序 whereis
whereis 命令主要用于查找程序文件,并提供這個文件的二進制可執行文件、源代碼文件和使用手冊存放位置。
1、查找命令程序
例如,查找 touch 命令
[root@node1 /]# whereis touch
touch: /usr/bin/touch /usr/share/man/man1/touch.1.gz
執行效果如下:

如果只需要查找 touch 命令的二進制文件,可以使用 -b 選項實現:
[root@node1 /]# whereis -b touch
touch: /usr/bin/touch
效果如下:

2、查找應用程序
例如,查找 nginx 服務
[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
如果查詢的程序不存在,則返回一個空字符串。
例如,查找 hello 程序
[root@node1 /]# whereis hello
hello:
以上就是本次介紹的全部相關知識點,感謝大家的學習和對腳本之家的支持。