Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I installed an application and now I can access it via terminal as myapplication. It is an alias, though. How can I find the full path to the file?

share|improve this question

3 Answers 3

up vote 4 down vote accepted

You can use type and which to determine what a certain command in bash is, and, if it's an application, where it resides.

$ type type
type is a shell builtin
$ type cd
cd is a shell builtin
$ type ls
ls is aliased to `ls --color=auto'
$ type -P ls
/Users/danielbeck/bin/ls
$ which which
/usr/bin/which
$ which ls
/Users/danielbeck/bin/ls

The commands which and type -P only work for programs on your PATH, of course, but you won't be able to run others by just typing their command name anyway.


If you're looking for a simple way to determine where an OS X (GUI) application bundle is installed (as used e.g. by the open command), you can execute the following short AppleScript from the command line:

$ osascript -e 'tell application "System Events" to POSIX path of (file of process "Safari" as alias)'
/Applications/Safari.app

This requires that the program in question (Safari in the example) is running.

share|improve this answer
    
thank you very much –  Xitrum Mar 22 '13 at 21:30

You can use "alias" command in terminal to list all of your aliases. Or if you are in a directory you can use "pwd" to show your current path.

If you know the filename or a part of filename, then you can use "find" to locate your file.

find / -name things.jpeg
share|improve this answer

The path of binaries is referenced in the $PATH variable.

You can see its content with env.

share|improve this answer
    
error in os... sorry :'( –  user209678 Mar 22 '13 at 21:42
    
Your answer isn't entirely clear, sorry. What do you mean with "error in os… sorry"? Also the $PATH can be viewed with env, but echo $PATH would be less verbose. –  slhck Mar 22 '13 at 22:07

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.