1. 查找可执行文件的位置、显示命令所在路径
命令:
which pwd
输出:
hc@hc-virtual-machine:~/test$ which pwd
/bin/pwd
hc@hc-virtual-machine:~/test$ which head
/usr/bin/head
说明:
which 是根据使用者所配置的 PATH 变量内的目录去搜寻可运行档的,所以,不同的 PATH 配置内容所找到的命令是不一样的
2. 用 which 去找出 which
命令:
which which
输出:
Ubuntu18.04下:
hc@hc-virtual-machine:~/test$ which which
/usr/bin/which
Centos7中:
[root@localhost ~]# which which
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
/usr/bin/alias
/usr/bin/which