Can 'which' find all executables?

097

Yes, the which command can find all executables associated with a command by using the -a option. This option tells which to display all matching executables in the directories listed in the PATH environment variable, rather than just the first one it finds.

Usage:

The syntax to find all executables is:

which -a command_name

Example:

For example, to find all installations of Python, you would use:

which -a python

Output:

The output might look like this:

/usr/local/bin/python
/usr/bin/python
/bin/python

This indicates that there are multiple Python executables available in the specified directories. The -a option is particularly useful for discovering all versions of a command that may be installed on the system.

0 Comments

no data
Be the first to share your comment!