The Bookmarker is a set of bash shell scripts that aim to simplify the navigation through *nix file system by acting as a bookmarking tool to bookmark/unbookmark directory paths and assigning short aliases for them that are easy to remember.
So say goodbye to remembering lengthy directory names and typing what seems like a train wreck of directories everytime you want to navigate to one.
To mark a directory using an absolute path
mark /this/is/a/very/very/looooong/path mydir
To navigate to the marked directory, simply type the aliased directory name
mydir
To list all the marked directories, you can use the marks
command, here is a sample output:
bin -> /Users/khafaji/bin
eBooks -> /Users/khafaji/eBooks
To un-bookmark a directory
umark myDir
Bookmarking a directory using its absolute path is not the only way, we can bookmark a directory using its:
- A relative path, e.g.
mark relative/path/to/some/directory dirA
- Marking the current directory, e.g.
mark . myCurrentDir
- Marking the parent directiry, e.g.
mark .. myParentDir
- Unpack the source of the Bookmarker shell script into a directory of your choice and make sure that directory is included in your PATH environment variable.
- Edit your bash profile and add the following blocks of code.
# Include aliases file created by the marker script
if [ -f ~/.marker_functions ] ; then
source ~/.marker_functions
fi
function mark()
{
markme $*
. ~/.bash_profile
}
function umark()
{
umarkme $*
unset $*
}
If you are a big fan of test driven development (TDD) like myself, have a look at the marker_test script included with the Bookmarker source which is my attempt to do TDD in bash scripts, how cool is that :)