Linux基础命令:which

which [options] [--] programname [...]

  • shows the full path of (shell) commands 按$PATH查找可执行文件

  • 内部命令不是可执行文件,所以找不到

  • 常用选项

    -a:Print all matching executables in PATH, not just the first显示全部结果,默认第一项
    
  • 示例

    [xzt7566@centos7-test ~]$ which -a ll
    alias ll='ls -l --color=auto'
      /usr/bin/ls
      /bin/ls
    /usr/bin/which: no ll in (/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/home/xzt7566/.local/bin:/home/xzt7566/bin)
    [xzt7566@centos7-test ~]$ which ll
    alias ll='ls -l --color=auto'
      /usr/bin/ls
    

你可能感兴趣的:(Linux基础命令:which)