

Nice commandline directory bookmarker. (Saves you typing and tabbing too much) - BjornW
http://www.bookmark-tools.com/articles/1.html

======
char_pointer
Hey! I'm the writer of these tools and was kind of surprised to run into it
here, since I have not posted about this before — the submitter must have been
an adventurous PyPI visitor ;)

This particular tool was mostly written to replace all the ad-hoc aliases and
symlinks with something that could be easily maintained and brought to other
commands (eg. cdbm, lsbm, mvbm, cpbm, etc.). To speed things up some more
there's also tab completion and prefix matching, which is pretty convenient
IMO.

~~~
BjornW
Well, actually I was using cdbm and thought it might be nice to mention it on
HN. Then I noticed you added some other interesting stuff as well, so even
more reason to submit it to HN :)

So not an adventerous PyPi visitor, just someone who was looking throught his
bookmarks ;)

Oh and thanks a lot for creating and sharing it. It's a great tool which IMHO
should become part of the 'default' cd, mv and cp.

------
silentbicycle
Instead of needing to have bookmark-aware commands in the first place
("commands that are available are and bookmark-aware: lsbm, cpbm, mvbm, mkbm,
...") , it would probably be better to use backtick:

    
    
       cd `bm shortcutname`
    

Forking loads of common utilities is going to add lots of superfluous
complexity. Of course, at that point you could replace the whole bm suite with
shell aliases or a script that contains

    
    
       #!/bin/sh
       # find relevant line by key, get the second field
       grep "$1 " ~/.bms | cut -d " " -f 2
    

. Put that in your path, chmod u+x bm, and there you go. In this case, the
bookmarks file is hardcoded to ~/.bms and you edit it by hand, but that's
probably good enough. If you want to add from the shell, here's bm-add:

    
    
       #!/bin/sh
       echo $1 $2 >> ~/.bms
    

Put it in your path, chmod u+x bm-add, good to go.

If you'd rather have the bookmark file separated by tabs, just remove the -d "
" from bm, change the grep to "$1\\\t", and change bm-add to echo $1\\\t$2 >>
~/.bms. Simple.

For an excellent intro on how to work with Unix's strengths, read _The Unix
Programming Environment_ by Kernighan and Pike.

------
bluishgreen
I have these functions in my .bashrc

addpi() { echo "cd `pwd` $1" >> ~/.pi; echo }

pi() { `cat ~/.pi | grep $1`; }

Usage: when you are in a dir that you want to bookmark say addpi <name>

when you want to return to that dir from anywhere say pi <name>

Ofcourse you need some kind of resolution if you have 2 matches in the grep,
but it works for me.

~~~
akkartik
I took the next step in disambiguation: <http://akkartik.name/bash.html#cd>

------
iamaleksey
There is also autojump <http://wiki.github.com/joelthelion/autojump>

~~~
joelthelion
Autojump is awesome! (i'm the author ;-) )

------
DannoHung
The blogging and animated gif stuff seems pretty out of place in this
package...

------
stcredzero
Actually, this is one of the things I used to use _screen_ for.

------
vijaydev
how is this different from using aliases?

~~~
char_pointer
It's different in that it's less cumbersome to maintain and that you can do
more with the bookmarks than just 'cd' to it. For example, some other commands
that are included are lsbm, mvbm and cpbm, which allows you to resp. list the
files in a bookmark, and move or copy files to a bookmark. It's overall a lot
more flexible and easier to extend common commands.

~~~
silentbicycle
Is forking lots of common commands really less cumbersome to maintain than
just using shell aliases or `expansion`?

EDIT: By forking, I mean "having to maintain separate frontends to", not the
process startup overhead. (That's obviously inconsequential.) E.g. if I want
to use a shortcut for a default path to clone a git repository from, then I
would need gitbm. Etc.

~~~
char_pointer
The forking is not noticeable on today's machines; especially on this rather
small scale. And yes, I would say that typing "cd `bm log`" is more cumbersome
than typing "cdbm l". cdbm does pretty much the same behind the scenes anyway
(with some error and argument checking), so why worry about that one extra
mini process?

~~~
silentbicycle
As noted above, I meant forking in the "fork a project" sense, not the fork(2)
call.

I'm being a bit nitpicky, though, so I'm going to let it go.

------
CamperBob
I've done this for years in my DOS sessions. A small program called qcd
("quick cd") reads the current working directory and writes a corresponding
"cd" command to a batch file in c:\windows:

\------------------

c:\foo\bar\bat>qcd 1

(creates file called c:\windows\1.bat containing "cd \foo\bar\bat")

c:\foo\bar\bat>cd \frotz\ozmoo

c:\frotz\ozmoo>1

c:\foo\bar\bat>

