which

Find out where a program lives

What it does

which shows the full path of the program a name runs, such as /usr/bin/python3. The shell looks for programs in the folders listed in PATH, in order, and which prints the first match.

It helps when several versions are installed and you are not sure which one runs, or when a command is "not found" and you want to check whether it exists at all.

Syntax

which <program>

Examples

Related commands

Practise · All commands