cmd line tutorials - gencmd

cmd line tutorials - gencmd

The which Command

Unix-Linux Mac

The which is used to locate the executable file for a given command. It is a very useful tool for troubleshooting problems with commands and for finding out where commands are located on your system.

Syntax

The basic syntax for the which command is as follows:

which [command]

The [command] argument is the name of the command that you want to locate.

Examples

Locate the executable file for the ls command.

which ls

List all of the python executables that are available in the PATH on the system.

which -a python

Here are some additional tips for using the which command:

With gencmd

gencmd where is the executable

  • which <command>