Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Is there a shell command for outputing absolute path for specified program? I'd like to know where executable binary file is.

share|improve this question

4 Answers 4

up vote 15 down vote accepted

Try which ls to discover full path to ls command

share|improve this answer

In bash, the command

type name

will give you every information about name, if executable (returning also the path), shell alias, shell function, shell builtin.

share|improve this answer

whereis -b yourBinary will output the location of a program.

share|improve this answer

All of the above, with some caveats:

whereis -- searches for matches (by default) on some pre-set directories. The list is available on 'man whereis', and can be passed as a parameter

which -- searches for executable files in the current environment (in other words, executables that can be found in the directories listed in the environment variable PATH

(bash) type -- if 'name' is an alias, it lists the alias definition, but not necessarily the path of any executables in the definition.

Another option, more generic, is mlocate.

share|improve this answer
    
type -P always performs a PATH search, mlocate would return many unrelated results (unrelated to what OP asked: "absolute path for specified program") –  enzotib Oct 5 '11 at 12:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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