UnixDroid

Shell · Linux command

which command in Linux

What does which do?

which shows the full path of the program that runs when you type a command.

which command

Most useful options

OptionWhat it does
-aall matches in PATH

which examples

$ which python3 Try it ›

/usr/bin/python3

$ which curl gcc Try it ›

check which tools are installed

In security work

which quickly tells you whether a tool is installed and which copy on PATH will run.

Questions about which

What is PATH?

A list of folders the shell searches for programs. echo $PATH shows it.