terminal shortcuts

Elliotjnewman

Registered
is there a way of creating shortcuts for directories and applications so that when, say you want to open Safari.app you dont have to goto ~/Applications and then open Safari.app.

It would be nice if I could open a shell and type safari - and there it pops up! I work with Linux in a big company and I can open any application by just typing it in, I dont have to be in the correct directory...

Sorry for the newbee question. And I have tried searching for it...

E.
 
To open Safari from cli directly you have type:
/Applications/Safari.app/Contents/MacOS/Safari
You could add the path to safari by adding the following to your .bash_profile :
PATH=${PATH}:/Applications/Safari.app/Contents/MacOS/Safari , but then you will start a new instance of Safari on each invocation.
Better to add: alias safari="open -a Safari" to .bashrc
 
so doing "Better to add: alias safari="open -a Safari" to .bashrc" means I can open safari from a shell by just typing "open -a Safari"?

Could you explain how I would do this? and does it refere to other apps too?

Is this quite a tricky thing to do with terminal? I would have though it was quite straight forward to set up alias commands to open things...
 
You probably don't have a file called ".bashrc" in your home directory, check with "ls -a" in terminal, files beginning with "." are invisible in the Finder.

.bashrc is a simple textfile in you home directory, you can create it with any text editor, just be sure to save it as "text only". After you create and save ".bashrc" it is read avery time you open a new terminal window. Then you only have to type "safari" to open Safari, but you could open Safari from the terminal with "open -a Safari" directly without messing with any files at all.
The alias entry in ". bashrc" just replaces "safari" with "open -a Safari" to save some typing effort.
Try "man open" in a terminal to learn more.
 
Well, a nice free program that will allow you to launch and manipulate files without having to type a full path is Quicksilver. All you do is activate it with a hotkey (command-space for example) and start typing in safari and it will pop up with the option to launch. Of course, there are many more things you can do with Quicksilver, but it makes launching programs easier and keeps your dock neat. :)
 
Back
Top