Skip to content

Instantly share code, notes, and snippets.

@znbailey
znbailey / bash_bookmarks.sh
Created February 18, 2011 23:31
Add this to your .bashrc or .bash_profile to set up "bookmarks" for your directories. When in a directory, type "s <name>" to store the current path as a bookmark with that name. To move to a bookmark, type "g <name>". Tab completion also works! To l
# Add this to your .bashrc or .bash_profile to set up "bookmarks" for your directories.
# When in a directory, type "s <name>" to store the current path as a bookmark with that name.
# To move to a bookmark, type "g <name>". Tab completion also works!
# To list all bookmarks, type "l".
#
# Credit to: Karthick from http://www.huyng.com/archives/quick-bash-tip-directory-bookmarks/492/
function s {
cat ~/.sdirs | grep -v "export DIR_$1=" > ~/.sdirs1
mv ~/.sdirs1 ~/.sdirs