buku is a powerful cmdline Python3 SQLite3 bookmark management utility. buku v1.8 adds the capability of handling piped input. Besides the obvious, this adds the possibility of adding bookmarks from anywhere in your system to the buku database. On Linux, copied text or mouse selected text can be added directly with a shortcut. The other tool you need is xsel. Let’s try it out!

The steps are tested on Ubuntu 14.04 which I am running. Should be similar for other Linux distros other than the command to install packages etc. I am also assuming that you have installed buku already. If not, head here.

Install xsel:

$ sudo apt-get install xsel

Create a new script bukuadd with the following content:

#!/bin/bash xsel | buku -a

Here,

-a: add

Make the script executable:

$ chmod +x bukuadd

Copy it somewhere in your PATH.

Now add a new keyboard shortcut to run the script. I use <Alt-b> .

Select a URL anywhere or copy a link and press the keyboard shortcut to add it to buku database. The addition might take a few seconds to reflect depending on your internet speed and the time buku needs to fetch the title from the URL. If you don’t want to fetch the title, remove the w option from the script.

To verify that the bookmark has indeed been added, run:

$ buku -P | tail -3

and check the entry.

TIP: If you want to skip the mouse completely and add the last visited URL in Firefox to buku, use the following script:

#!/bin/bash sqlite3 $HOME/.mozilla/firefox/*.default/places.sqlite "select url from moz_places where last_visit_date=(select max(last_visit_date) from moz_places)" | buku -a

Wanna tag these bookmarks? Run:

$ buku -S blank

to list the entries with (empty titles or) no tags. Add the tags using the -u option whenever you get time.