Tag Archives: bookmark

bashmarks: The simple solution

We’ve been through plenty of fast-directory switchers, like j and j2, or z or popd and pushd, and a lot of others (and there are still more to come šŸ™„ ). But I don’t recall seeing something like bashmarks before, which lets you give a nickname to your path, and recall it in the future.

bashmarks works as a shell script you can either trigger through your .bashrc file, or source directly as you need it. The git package offers to “install” it to .local/bin, but I found it just as usable in its raw form, sourced with . bashmarks/bashmarks.sh whenever I felt I wanted it.

Once you’re hooked in, bashmarks gives you about five commands, all single letters that trigger or control nicknames to folders in your system: “s” saves a path, “g” goes to a path, “l” lists the bookmarks, “d” deletes one and “p” prints the path held in a bookmark.

And basically, that’s all.

kmandla@6m47421: /usr/src/nvidia-96.43.23$ l
downloads            /home/kmandla/downloads
home                 /home/kmandla
nvidia               /usr/src/nvidia-96.43.23

kmandla@6m47421: /usr/src/nvidia-96.43.23$ g home

kmandla@6m47421: ~$ g nvidia

kmandla@6m47421: /usr/src/nvidia-96.43.23$

bashmarks saves its data in ~/.sdirs, and I doubt anyone would complain if you wanted to hand-edit that file, and still move seamlessly around your system.

There are two big reasons I enjoy using this. The first is tab completion with bashmarks, which is such an obvious addition that it would be a huge mistake if it hadn’t been included. The difference between g d[TAB] to get to /home/kmandla/downloads and cd /h[TAB]/k[TAB]/d[TAB] is enough to make bashmarks a useful tool.

The other reason is more philosophical, I suppose: If I was going to create some sort of “fast directory switching” tool, it would probably work like this. It’s the most obvious solution to me.

I’ve seen a lot of other directory switching tools that use stacks or frequency or priorities to try and analyze and predict where I want to go. bashmarks takes the simple path, lets you assign names, and goes where you tell it. And it does that without compiling intricate binaries, background daemons or gnarled dependencies.

It’s even got a tiny bit of color. šŸ˜‰

And since I’m feeling generous today, and because it does such a bang-up job, I’m going to give out a K.Mandla gold star to bashmarks: ā­ Don’t spend it all in one place. šŸ˜‰ Enjoy!

bm: A console bookmark manager

I never really thought about a bookmark manager for the console; the browsers that I use these days — specifically elinks or Pale Moon — have onboard bookmarking systems already.

bm does add the ability to bounce straight to a link from the command line, something like surfraw does.

2014-07-19-6m47421-bm

Which might be preferable in some cases, rather than opening a specific browser, then working through the bookmarks to get to a site. Or using surfraw’s search tools to circumnavigate and end up in that spot.

bm can also tally some basic statistics about the number of bookmarks you have, and the popularity of particular categories. A nice touch.

Add to that the ability to sync bookmarks with Dropbox, and its ability to generate page snapshots, and bm appears to be a very good option for leaping straight from the CLI to a web page … particularly if you’re using a graphical desktop.

I had only one problem with bm as it stands now: The actual command to trigger the browser — whether through bm open or just bm — spat out a short error, which I attribute to my screwball setup. I trigger a lot of programs through specific scripts, and there’s just no way for bm to know about that.

I’m willing to give a thumbs-up to bm, even if I don’t anticipate using it much. I can see integrating it into a complete text-only machine, because it provides a good shortcut between the cursor and the browser. Enjoy, with my blessing. šŸ˜‰