Locate exactly which executable runs when you type a command. 30.05.2026 | reading time: 2 min You type a command and want to know which binary will run; `which` answers that by searching the directories in your PATH and printing the first matching executable it finds, fast and practical. Hands-on example Try this on a shell to see `which` in action: ``` $ which python3 /usr/bin/python3 $ which -a python /usr/bin/python /usr/local/bin/python $ ls -l $(which python3) lrwxrwxrwx 1 root root 9 Jun 1 12:00 /usr/bin/python3 -> python3.8 ``` This shows the primary match, all matches with `-a`, and how to inspect a symlink target. Beyond the basics `which` is simple and useful, but not infallible; on some systems it is an external program and on others a shell alias, and it may not report shell builtins or functions, so prefer `type` or `command -v` in scripts for reliable results, and use `which -a` when duplicate binaries are a concern. Related helpers Combine `which` with tools like `readlink` or `ls -l` to reveal symlink targets, use `whereis` to find related documentation and binaries, and remember that `type` shows whether a name is an alias, function, builtin, or file. Finish line Knowing which executable runs removes guesswork and prevents surprises in scripts and deployments; keep exploring command visibility and PATH mechanics, and consider deepening Linux knowledge for certification such as CompTIA Linux+ or LPIC-1 with intensive exam preparation at bitsandbytes.academy. Join Bits & Bytes Academy First class LINUX exam preparation. utilities scripting troubleshooting processes