Nov 19 2009

Making permanent aliases for Terminal

OK, so yesterdays post was alright. It got you making an alias for Terminal. But if you tried it you probably noticed that you lost the alias after you quit Terminal. That’s usually not what you want. Let’s make it stick around.

Assuming you’re using bash:

Launch Terminal

% pico ~/.bash_profile

Add a line with a variable followed by whatever command you what it to perform, such as:

webroot='cd /Volumes/apache/webroot'

CNTRL-X, then press ‘y’ to save the file and exit edit mode
now restart bash_profile;

% source ~/.bash_profile

That’s it!
Now anytime you want you can launch Terminal, simple type % webroot, and you’ll be taken to ‘/Volumes/apache/webroot’

Now will all the typing this will save you, there’ll be more time for beer at the end of the day.

Post to Twitter


Nov 18 2009

Creating aliases in Terminal

I launch Terminal many times per day, and usually go to one of a handful of directories right off the bat. I just discovered the handiness of creating aliases in Terminal.

Let’s say you often go to /Volumes/development/depot/mainbranch. Let’s create an alias to that called ‘mb’ for ‘mainbranch’ (this can be whatever you want, of course.
Simply launch terminal.
Type: alias mb=’cd /Volumes/development/depot/mainbranch’
Done!
Now just type ‘mb’ at the command prompt and you’ll be taken directly to that directory!
Sweet!

Note, you can also do the same to launch applications:
alias tx=‘open /Applications/TextEdit.app/’

Post to Twitter