Nifty BASH Function
At work, I end up spending a lot of time on servers, constantly working out of multiple directories. The directories are always the same, and sometimes cd - works for what I'm doing. However, if I am working out of three or more directories that is no longer the case, which is typical.
Today, one of my fellow nerds at the nerdery passed along two BASH functions that will make my life WAY easier. He didn't write them, and I'm not sure who did. But, just add them to your ~/.bash_profile or ~/.bashrc file and your ready to go after you re-login:
mk() { eval ${1:-MKPWD}=\"`pwd`\"; }
rt() { eval cd \"\$${1:-MKPWD}\";pwd; }
When your in a directory that you want to "bookmark", just type mk like so:
~/sandbox/$ mk sandbox
Then later:
/var/www/logs/$ rt $sandbox
Since it is exported as an ENV var, you can also copy things to it, for instance:
/var/www/logs/$ tail -n 20 error_log > $sandbox/last_20.log