Linux Command - which

which - Locate a program in the user’s path.

Syntax

1
which [options] programname [...]

Description

Which takes one or more arguments. For each of its arguments it prints to stdout the full path of the executables that would have been executed when this argument had been entered at the shell prompt.

Option Description
–all, -a Print all matching executables in PATH, not just the first.

Example

locate pwd command path

1
which cd

output:

1
/bin/pwd

locate head command path

1
which head

output:

1
/usr/bin/head

show all java command path

1
which -a java

Reference