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


Leave a Reply