Finding executable files

NoOp glgxg at sbcglobal.net
Mon Jan 12 20:14:16 UTC 2009


On 01/12/2009 09:17 AM, Matthew Flaschen wrote:
> Leonard Bussey wrote:
>> Hello all,
>> 
>> Where can I find where Ubuntu puts the executable file to launch an
>> application.  I'm trying to set up IceWM and have to manually set up the
>> menu items.  Thank You.
> 
> Do you know the executable name (e.g. gedit), but not the path
> (/usr/bin/gedit)?  If so, run e.g.:
> 
> which gedit
> 
> Otherwise, try to explain better (what do you know and what do you want
> to know).
> 
> Matt Flaschen
> 

The only problem is 'which' will only return information if the command
is in your PATH:

DESCRIPTION
which returns the pathnames of the files which would be executed in the
current environment, had its arguments been  given  as  commands  in  a
strictly  POSIX-conformant  shell.   It does this by searching the PATH
for executable files matching the names of the arguments.

For example, I have multiple instances of OpenOffice.org and StarOffice
on my system:

$ which soffice
/usr/bin/soffice
only returns the soffice in my path.

However:
~$ locate -b "\soffice"
/home/<user>/OOo241/opt/openoffice.org2.4/program/soffice
/opt/ooo-dev3/program/soffice
/opt/openoffice.org3/program/soffice
/opt/staroffice8/program/soffice
/opt/staroffice9/program/soffice
/usr/bin/soffice
/usr/lib/openoffice/program/soffice

shows that I have multiple instances of soffice (an executable) that I
can run. So I wouldn't necessarily rely on 'which' to provide the
information if there is a possibility that the executable is outside of
the PATH.

I still get confused on path's & environment variables, so I have this
page bookmarked:
https://help.ubuntu.com/community/EnvironmentVariables






More information about the ubuntu-users mailing list