$which
Locate the executable binary path of a command in system PATH.
which [OPTIONS] [COMMAND...]Try `which` Live in Interactive Sandbox
Zero-install client simulation with real-time feedback.
Overview & How which Works
`which` searches the directories listed in your `$PATH` environment variable to find and display the absolute location of an executable binary file.
Common Flags & Command Options
| Flag / Option | Description |
|---|---|
| -a | Print all matching pathnames of each argument across PATH. |
Practical Real-World Examples
which grep python3Outputs the binary paths in /usr/bin or /bin.
Frequently Asked Questions
What is the difference between which and whereis?
`which` locates only the executable binary in `$PATH`, while `whereis` also locates source files and man documentation pages.
Related Linux Commands
Search for files and directories in a directory hierarchy based on name, type, size, or modification date.
List directory contents including file sizes, permissions, ownership, and modification timestamps.
Change the current working directory in the shell workspace.
Print the absolute path of the current working directory.
Display directory structure in a recursive visual tree diagram.