Avoid cd-ing in Terminal

Saw an article this morning and immediately I’m excited by it! It is a bash script which can let you create bookmark for a directory and you can immediately jump across different directories without needing to “cd” in terminal.

Just add the bash script inside ~/.bashrc and source it.

# Bash Directory Bookmarks
alias m1='alias g1="cd `pwd`"'
alias m2='alias g2="cd `pwd`"'
alias m3='alias g3="cd `pwd`"'
alias m4='alias g4="cd `pwd`"'
alias m5='alias g5="cd `pwd`"'
alias m6='alias g6="cd `pwd`"'
alias m7='alias g7="cd `pwd`"'
alias m8='alias g8="cd `pwd`"'
alias m9='alias g9="cd `pwd`"'
alias mdump='alias|grep -e "alias g[0-9]"|grep -v "alias m" > ~/.bookmarks'
alias lma='alias | grep -e "alias g[0-9]"|grep -v "alias m"|sed "s/alias //"'
touch ~/.bookmarks
source ~/.bookmarks

Source: http://www.huyng.com/archives/quick-bash-tip-directory-bookmarks/492/

Advertisements