Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
Location of file folders of installed programs

For example the following are the same

# /usr/bin/php updateDatabase.php

# php updateDatabase.php

But how would I infer the location of the php command to be in /usr/bin?

share|improve this question

marked as duplicate by Jorge Castro, James Feb 27 '12 at 23:03

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

up vote 15 down vote accepted

You can use the whereis command to find the location of an executable binary on your system.


$ whereis ls
ls: /bin/ls /usr/share/man/man1/ls.1.gz

EDIT: From this answer to a similar question, you can also use the which command.


$ which ls
share|improve this answer

When the program can be run without specifying the full path, then its directory is in your $PATH variable.


$ echo $PATH
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.