Centos之命令搜索命令whereis与which

Centos之命令搜索命令whereis与which

whereis 命令名

#搜索命令所在路径及帮助文档所在位置

选项:

 -b :只查找可执行文件位置

 -m:只查找帮助文件

[root@localhost ~]# whereis ls

ls: /usr/bin/ls /usr/share/man/man1/ls.1.gz

[root@localhost ~]# whereis -b ls

ls: /usr/bin/ls

[root@localhost ~]# whereis -m ls

ls: /usr/share/man/man1/ls.1.gz

我们可以查到ls命令的位置以及帮助文档的位置

which 文件名

搜索命令所在路径及别名

[root@localhost ~]# which ls

alias ls='ls --color=auto'

/usr/bin/ls

相比 ,多了个别名;

原文地址:https://www.cnblogs.com/soymilk2019/p/11840166.html