How to Find Where a Command Is Installed in Linux (which)

which shows the full path to the executable that would run when you type a given command name.

Published October 2, 2026

which prints the full path of the executable that would run when you type a command, searching the directories in PATH in order.

How it works

It helps debug 'wrong version' problems: if python points to /usr/bin/python instead of your virtualenv, which shows it.

type -a shows all matches, including aliases and functions.

Try it

which python3
/usr/bin/python3
type -a python3

Practical examples

Where is it

which node

All matches

type -a python3

Is it an alias?

type ll

Windows equivalent

where node

Common mistakes

  • Assuming which sees shell builtins and aliases (it does not always).
  • Ignoring PATH order.
  • Running a different binary from cron than from your shell.

Key takeaways

  • which shows the resolved executable.
  • type -a shows everything.
  • PATH order decides.

FAQ

which vs whereis?

whereis also finds man pages and sources.

Why different in cron?

Cron has a minimal PATH.

More Linux articles