which and whereis on Linux are top searches when a script says “command not found” or when two Python versions fight on PATH. which shows what your shell would run; whereis also lists man pages and source paths when installed.
See: environment variables,
bash aliases,
test.
which for PATH
Reports the first executable matching the name on PATH.
bashwhich
which python3
which nginx

whereis broader
Shows binary, source, and man page locations.
bashwhereis
whereis sshd
whereis -b grep

type and command -v
Shell builtins need type; scripts should use command -v for POSIX.
bashscripts
type cd
command -v curl

After install or update
Refresh command hash table or open a new shell when PATH changes.
TipCompare
which python3 with readlink -f $(which python3) to see the real file behind a symlink.
Quick Reference
- Runtime binary:
which name - Man/binary tree:
whereis name - Scripts:
command -v name
Related tutorials
Diagrams are original illustrations by Gnome IT Solutions. Tutorial text © Gnome IT Solutions.