LOGO

Find Running Application Path - Solaris, Linux (Ubuntu, Suse, Redhat)

December 1, 2006
Find Running Application Path - Solaris, Linux (Ubuntu, Suse, Redhat)

Determining Executable Paths with the 'which' Command

When several versions of an application are present on your system, identifying the specific command being executed from the command line can be crucial. This is particularly relevant when working with languages like PHP on a shared hosting environment.

Shared servers often accommodate multiple PHP versions, such as both PHP 4 and PHP 5. Knowing the exact path of the PHP executable being utilized is therefore essential for configuration and troubleshooting.

Using the 'which' Command

The which command is a straightforward utility for discovering the full path to an executable. Simply prefix the command name you wish to investigate with 'which'.

The syntax is as follows: which . The output will display the absolute path to the executable that would be run when you type that command.

Here are a couple of illustrative examples:

# which svn
/usr/bin/svn

# which php
/usr/local/bin/php

As demonstrated, the 'which' command quickly reveals the location of the 'svn' and 'php' executables on the system. This information is invaluable for ensuring you are utilizing the intended application version.

Understanding which executable is being invoked allows for precise control and avoids potential compatibility issues arising from using an unexpected PHP or other application version.

#find process path#application path#linux#solaris#ubuntu#suse