Alias your cd commands and save time

When you're bouncing around from one directory to another in Linux or OSX, or even Cygwin in windows, remember you can use alias to save you time.

For example, I've been working a lot on these two directories in my pxeboot server ((The xxxx is just a placeholder)).

/opt/xxxx/sources/linuxdistros/centos/x86_64/5.3
/opt/xxxx/sources/linuxdistros/centos/x86/4.4

Typing those in each time, using tabs, and even using relative paths can be quite a pain in the butt. So I set two alias to get me back to those directories quickly after I wonder off and need to come back.

I added these two lines to my .bashrc file:

alias nn='cd /opt/xxxx/sources/linuxdistros/centos/x86_64/5.3/'
alias oo='cd /opt/xxxx/sources/linuxdistros/centos/x86/4.4'

Then either source .bashrc, or logout and log back in. Now when I type "nn" or "oo" I get sent to those directories.

2 Comments

  1. pushd is pretty convenient also at times

Comments are closed.