Thursday, April 03, 2008

Command Line Bookmarks

I wish I'd known about this tool years ago. Today I discovered a little utility called cdargs. Basically it lets you browse your directory tree very quickly, and allows you to create bookmarks to your most often used directories.

The bookmarks are stored at ~.cdargs in a simple format that's easily edited whenever you want to modify them, but I'm getting ahead of myself now...

cdargs has a directory browsing tool which is invoked by the cv command. In this tool, you can use arrow keys, Vim bindings, or even Emac bindings to navigate. Pressing a on a directory in the browser adds it as a bookmark, and pressing Enter opens it back in the shell. To see more of the available commands, press H or ? in the browser.

Outside, back in the shell, you can copy files and move files to your bookmarked directories using the cpb and mvb commands respectively. For example, cpb foo bar will move the file called foo from the current directory to the directory that I have bookmarked as bar. You guessed it, cdb bar would change you to the directory bookmarked by bar as well.

This tool has several more features as well, but I'll leave those up to you to discover. The man page is a good read, and I don't want to take all the fun away from you :). The only problem I can see with this tool is that it may be difficult getting used to the different commands. Typically the commands they replace or supplement are used quite quickly. By the time I stop to recall the applicable cdargs command I've waited too long. If I can get past that, there's no doubt I'll get some good use out of this one.