Site icon LinuxCommands.site

which command tutorial in linux/unix with examples and use cases

linux which command – locate a command in the user’s path.

Which command does this by searching the PATH for executable files matching the names of the arguments. It returns the pathnames of the files (or links) which would be executed in the current environment.

Syntax

       which [-a] filename ...

Options

Examples

Locate a command

➜  ~ which env
/usr/bin/env

Print all matching pathnames of each argument

➜  ~ which -a env
/usr/bin/env
/bin/env

Exit mobile version