Skip to content

Which command on Linux (find files)

The which command in Linux takes the name of a command as an argument and results in the location of that command on disk, in the directories referenced in the PATH variable. It’s especially useful when you’re testing multiple versions of a command and want to make sure that you’re running the correct version.

Examples:

$ which php /usr/bin/php
$ which nginx /usr/sbin/nginx
$ which python /usr/bin/python
$ which perl /usr/bin/perl

The command is similar to whereis, but it only returns the full path of the executables.

Learn much more about Linux in our online course. You can register here. If you already have an account, or want to create one, just log in or create your user here.

Did you like it?

Share