Skip to content

Bookmarks’ last frontier

Bookmarks are ubiquitous these days. You can find them in your browser, code editor, desktop manager, web applications, the internet, anywhere. But there’s a place where bookmarks haven’t arrived yet: the command line.

Or so I though… until recently. It turns out that to be sure, I searched for command-line bookmarks on google and after a while digging for it, I managed to find three different projects that aim at providing this feature to my favorite shell.

I downloaded and installed all these packages and I am sharing my thoughts about them here.

go-tool project to provide bookmarks for the command line

go-tool

go-tool

This was the first one I found and the one I have used the most. The project is hosted at http://code.google.com/p/go-tool/ and it is developed in Python.

It has a command-line automated setup process that installs the python module system-wide, and there’s also a command to automatically setup shell integration.

Shell integration is achieved by registering some bash functions that do the actual directory change (this is needed because spawned processes do not change the working directory of the parent process, so a python script cannot actually change the working directory of the shell session that started the script). As you can imagine, this feature is common to all the three projects.

Directories are aliased to a short keyword that you can later use to change your current directory. You can add a bookmark for the current directory, or for any other directory, you can delete bookmarks, etc. The details are better covered in the project’s homepage.

The main downside of this solution is that once you start using it, you start missing bash completion with the TAB key. Although I guess it shouldn’t be difficult to implement it ourselves. The program stores its bookmarks in ~/.go/bookmarks. The main advantage is that it is multi-platform, supporting Unix-like environments (including Apple’s Mac) and Windows.

CDBM project to provide bookmarks for the command line

CDBM

cdbm

The name is an acronym for ‘cd bookmarks’ and the project is hosted at google code too (http://code.google.com/p/cdbm/) although I found more information about it from its author’s blog. It is programmed in c.

This is the most simple of the three projects I found. It is simple to install and simple to use, but it is also the simplest in terms of features and possibilities, although unlike the previous one, it features auto-completion.

Shell integration is achieved in a similar way, through bash functions that have to be programmed into our ~/.bashrc file.

Its main disadvantage is that is oriented to bookmarks indexed by numbers instead of aliases or keywords. In a more recent version the author added keyword support on top of the previous design, without removing the numeric index. However, keywords support still doesn’t feel natural.

Apparix project providing bookmarks for the command line

Apparix

apparix

This was the last project I found and it is the most complete in terms of features. It is hosted at http://www.micans.org/apparix/ and implemented in c as well.

It features shell integration, bash auto-completion support, and it extends bookmarks to more than just a simple super-cd utility. For instance, bookmarked directories’ contents can be listed remotely, without actually changing the current directory.

Shell integration si great, but its configuration could be more automated into the setup process, like the go-tool project does. But the bundled auto-completion is great. You can even auto-complete further into the subdirectories of the bookmark you are using in the command.

Take a look at the following sequence of commands:

ernesto@ubuntu:~$ cd /var/cache/
ernesto@ubuntu:/var/cache$ bm
added: cache - /var/cache
ernesto@ubuntu:/var/cache$ apparix
--- portals
--- expansions
--- bookmarks
j cache        /var/cache
ernesto@ubuntu:/var/cache$ cd
ernesto@ubuntu:~$ to cache apt/archives/partial
ernesto@ubuntu:/var/cache/apt/archives/partial$

We change into the /var/cache directory, and then we register a bookmark for it with the 'bm' command. The 'apparix' command then lists the available bookmarks, where you can see our recent addition. Then we go back to our home directory, and use the 'to' command to change into a subdirectory of the directory represented by the bookmark, instead of just changing into the bookmarked directory only.

And the winner is…

Clearly apparix is the most complete of the three alternatives I found, although I have been using the go-tool for some time already, and I was getting used to it. However, I always missed auto-completion for the go-tool, never decided to implement it my self, and now that I have found apparix with it, I guess I’ll make the switch.

You go and play with them and make your own choice. The command line will never be the same after you start using this.

Categories: Programming, Software.

Tags: , ,

Comment Feed

No Responses (yet)



Some HTML is OK

or, reply to this post via trackback.