bm is a program that can make life at the terminal a little easier when you often have to deal with a couple of directories at the same time. It can be used to keep bookmarks of directories you use regularly, but are a drag to type and switch between.
Of course, there are the popd, pushd and dirs commands, but a stack is often not sufficient to work fast. That's why I wrote bm.
bm is a tiny program written in C that reads from a simple, clear text bookmark file to generate an index. All you need to do to set it up is type the following in a terminal:
wget http://cdbm.googlecode.com/files/bm-1.0.tar.gz
tar -xvf bm-1.0.tar.gz
cd bm-1.0
make && sudo make installNow you can type the bm command and it will show you nothing, because you haven't added any bookmarks yet. Lets add the current directory:
$ bm -a
0. /home/bspaans/bm-1.0The directory has been added! Lets add another one:
$ bm -a /var/log/apache2/
0. /home/bspaans/bm-1.0
1. /var/log/apache2/As you can see we have built up a very small index. Using the index as the only argument we can now get the data out and use it with cd, for instance.
$ bm 0
/home/bspaans/bm-1.0
$ bm 1
/var/log/apache2/
$ cd `bm 1`This works, but the backticks get a little tiring. It would be nicer if we could just type something like:
$ cdbm 1And be done with it. This is possible by adding a tiny function to your ~/.bashrc script: [...]. Update @ Oct 17, 22:24: The last version automatically adds the commands cdbm and lsbm to the global bashrc file, so you can use them right after you have restarted your terminal.
You can see more options by using the --help switch or by reading README.txt.
UPDATE @ Oct 17, 21:22: I added tags to the program to make it more usable. When you add a directory you can now give a third argument that specifies the tag (use '.' or './' to add the current directory as a tag in this mode). The remove and list commands support tags as well, as you can see in this little example:
$ bm -a /var/log/apache2 aplogs
0. /var/log/apache2 [aplogs]
$ bm aplogs
/var/log/apache2
$ cdbm aplogs:wq
No Comments
Be the first to leave a comment for this article ;)