Search
which
Locate a command's executable file in the user's PATH.
Synopsis
syntax
which [OPTION]... NAME...
Examples
Find path to python3 executable
which python3
Show all node executables in PATH
which -a node
Locate multiple build tools
which gcc make cmake
Common options
| Flag | Description |
|---|---|
| -a | Print all matching executables, not just the first |
About which
The `which` command locate a command's executable file in the user's PATH. Search commands help you locate files, text patterns, and executables across the filesystem.
Efficient searching is critical when working with large codebases or troubleshooting system issues. These tools range from simple filename lookups to full regular-expression pattern matching across file contents.
The command accepts 1 commonly used flag shown above, though the full set of options is available in the man page (`man which`). The 3 examples on this page cover typical real-world usage patterns that you can copy and adapt for your own workflows.
Related commands
More Search Commands
Other commands in the Search category