Forrest logo
back to the which tool

which:tldr:1e376

which: Search the PATH environment variable and display the location of any matching executables.
$ which ${executable}
try on your machine

The command "which ${executable}" is used to locate the path of an executable file in Linux or Unix systems.

Here is a breakdown of the command:

  • "which" is a command-line utility that searches for the location of a given executable file in the system's PATH environment variable.
  • "${executable}" is a placeholder that should be replaced with the actual name of the executable file you want to find.

When you execute this command in the terminal, it will search for the specified executable in the directories listed in the PATH variable, and it will display the full path of the first occurrence found. This is useful to determine the exact location of a command or program that you need to run or reference in a script.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.

Questions that are answered by this command:

  • is a program installed?
back to the which tool