Beginner Package: debianutils / util-linux

which

Show the full path of a command that would run.

Syntax

which command

Description

which searches your PATH and reports the exact executable that would run if you typed that command name, which is useful for confirming you're running the version you expect when multiple copies exist.

Examples

which python3
Show which python3 binary is found first on your PATH
which -a python3
List every matching binary on your PATH, not just the first
type ls
A shell-builtin alternative that also reports aliases and builtins

Applies to

Ubuntu Debian Linux Mint RHEL CentOS / Rocky / AlmaLinux Fedora Arch Linux openSUSE Alpine Linux