• which
  • whereis
  • Which && whereis

    which

    显示命令的全路径,即命令在哪里,which命令查找的范围是PATH环境变量的路径 -a 默认情况找到了就停止,-a会遍历所有路径,输出所有匹配项

     ~/Documents/vnote   dev ●  which ls       
    ls: aliased to ls --color=tty
     ~/Documents/vnote   dev ●  which -a ls
    ls: aliased to ls --color=tty
    /bin/ls
    

    whereis

    显示命令及其相关文件全路径 -b 查找可执行文件 -m 查找 man帮助文件 -s 查找源代码文件

     ~/Documents/vnote   dev ●  whereis ls 
    ls: /bin/ls /usr/share/man/man1/ls.1.gz
     ~/Documents/vnote   dev ●  whereis -b ls
    ls: /bin/ls
     ~/Documents/vnote   dev ●  whereis -m ls
    ls: /usr/share/man/man1/ls.1.gz
     ~/Documents/vnote   dev ●  whereis -s ls
    ls:
    

    上一篇:Watch 命令

    下一篇:Tar命令