Copied to clipboard

which

The which command helps users find the path of an executable file. It searches for the specified command or filename in the paths specified by the PATH environment variable and returns the first complete path found.

Example

  • which python, find the path of the python executable file
  • which -a python, find the paths of all python executable files
  • which -s python, do not display error messages, only return the status code
  • which -v python, display detailed information, including the search process
  • which -p python, search for paths that are the same as the PATH environment variable
  • which -i python, search for the path of the python executable file without differentiating between uppercase and lowercase letters