When I’m building websites especially, I have to work with a lot of deeply nested files. But typing cd ~/public_html/websitename/wp-content/themes/themename/ in the terminal every time is giving me carpal tunnel, so I found a better way:
First open ~/.barshrc in a text editor and uncomment lines 73 through 75 so they look like this:
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
Then create a file called .bash_aliases in your home directory (if it doesn’t already exist). Edit that file like so:
alias themename="cd ~/public_html/websitename/wp-content/themes/themename/"
Restart terminal (or source .bashrc with $ source ~/.bashrc, or even terser $. .bashrc), type in themename and press enter. Voila! Your are cd’ed all the way into that deeply nested file without having to type the whole thing. This works great for lots of other common commands that are a little too verbose:
alias ins="sudo apt-get install"
Once those lines are added to your .bash_aliases file and you restart terminal, you will be able to install new packages like so:
ins packagename
Handy eh? (That last suggestion is courtesy of the always useful Lifehacker)