I’m sick and tired of having to remember and ‘cd’ long paths.
I decided to create my own console based Favorites-script which makes use of a definition file which is easy to change.
A newer version has been released, please visit:
“cd /home/petur/Documents/school/2010/fall/chemistry” becomes “cdf chemistry”
and “cd /var/log” becomes “cdf log”
The setup process is pretty straight forward, here we go (single user setup):
Save the following script as ~/bin/cdf
# Pétur Ingi Egilsson ( firstname.lastname@example.org )
# cdf (Change to favorites)
# Usage: cdf favoriteALIASES=~/bin/cdf.conf
echo "Error: '$1' has not been defined in $ALIASES"
echo -n "Do you want to edit the file? (y/n): "
if [ ! -n "$EDITOR" ]
# Use the nano editor because
# the EDITOR env has not been set.
echo "Please use y,Y,n or N."
Make it executable
Save the following file as ~/bin/cdf.conf
# ATTENTION: Do not use the ~ (tilda).
# WRONG: documents,~/Documents
# RIGHT: documents,/home/petur/Documents
# format: name,/path/to/directoryetc,/etc
Bash scripts are executed in a subshell as child processes.
This behavior is undesirable as the bash child-process cannot tell the parent to change to the new directory.
In order to work around this you’ll need to execute the script by placing a dot-space(. ) in front of it.
If you are like me you would like to avoid having to do that so create an alias like this in .bashrc :
Do you have any comments?