Note that there are some explanatory texts on larger screens.

plurals
  1. PODirectory bookmarking for bash
    text
    copied!<p>Is there any directory bookmarking utility for bash to allow move around faster on the command line?</p> <p><strong>UPDATE</strong></p> <p>Thanks guys for the feedback however I created my own simple shell script (feel free to modify/expand it)</p> <pre><code>function cdb() { USAGE="Usage: cdb [-c|-g|-d|-l] [bookmark]" ; if [ ! -e ~/.cd_bookmarks ] ; then mkdir ~/.cd_bookmarks fi case $1 in # create bookmark -c) shift if [ ! -f ~/.cd_bookmarks/$1 ] ; then echo "cd `pwd`" &gt; ~/.cd_bookmarks/"$1" ; else echo "Try again! Looks like there is already a bookmark '$1'" fi ;; # goto bookmark -g) shift if [ -f ~/.cd_bookmarks/$1 ] ; then source ~/.cd_bookmarks/"$1" else echo "Mmm...looks like your bookmark has spontaneously combusted. What I mean to say is that your bookmark does not exist." ; fi ;; # delete bookmark -d) shift if [ -f ~/.cd_bookmarks/$1 ] ; then rm ~/.cd_bookmarks/"$1" ; else echo "Oops, forgot to specify the bookmark" ; fi ;; # list bookmarks -l) shift ls -l ~/.cd_bookmarks/ ; ;; *) echo "$USAGE" ; ;; esac } </code></pre> <p><em>INSTALL</em></p> <p>1./ create a file ~/.cdb and copy the above script into it.</p> <p>2./ in your ~/.bashrc add the following</p> <pre><code>if [ -f ~/.cdb ]; then source ~/.cdb fi </code></pre> <p>3./ restart your bash session</p> <p><em>USAGE</em></p> <p>1./ to create a bookmark</p> <pre><code>$cd my_project $cdb -c project1 </code></pre> <p>2./ to goto a bookmark</p> <pre><code>$cdb -g project1 </code></pre> <p>3./ to list bookmarks</p> <pre><code>$cdb -l </code></pre> <p>4./ to delete a bookmark</p> <pre><code>$cdb -d project1 </code></pre> <p>5./ where are all my bookmarks stored?</p> <pre><code>$cd ~/.cd_bookmarks </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload