Manage web bookmarks with buku(1)

Table of Contents:
2022-08-19 | 4 minute read | 666 Words
 #tech
 #guide

Introduction

We all have that list of cool, useful, interesting, or forgettable websites that we have found. Often, many of us do the familiar C-d to bookmark a site to the forget about it and lose the link. In this post I will show you the most useful cli utility for any hardcore internet surfer: buku(1)

Setup

In order to use buku, you need to have these dependencies1 installed on your system:

You can either install it from your distro’s package manager, or install it with pip:

$ python -m pip install buku

buku also has an interactive prompt that is super annoying at times and serves no actual purpose other than making your current shell session a bit less useful. I recommend adding this alias to your shell’s rc (bash for example):

$ echo 'alias buku="buku --np"' >> ~/.bashrc

Usage

Buku is straightforward to use, you add a link, and it handles (most) of the rest. For instance, lets add my site to the collection of bookmarks with the -a flag. We will net put in the link we want to save, followed by tags we wish to add.The benefit of using tags is that they allow organization of links based off of comma-separated keywords, giving the ability to filter marks based on tags.

$ buku -a https://theoryware.net epic,dev,site

We can already see quite a few things. Most importantly we can see the link in the '>' list item. Buku has some syntax when you list bookmarks, those being:

N. Title
   >  Link
   +  Description/Summary
   #  Tags

Each item is mostly self-explanatory. Most of these fields will populated automatically upon adding the bookmark, minus tags, which are defined when adding or editing a bookmark. Use the -d flag with an index to delete a bookmark.2

$ buku -d 1

Finally, you

Editing Bookmarks

Generally, buku handles all of the heavy lifting with bookmark metadata. It fetches both the title and description automatically without intervention, leaving tags to human entry. However, sometimes we want to control the content of a bookmark after we actually add it to the buku database. Of course, buku allows us to do this with the -w flag.

buku -w 1

This will open up the bookmark for editing in your $EDITOR. It fairly straightforward, just put the information into the lines, and let buku do the rest.

Filtering Bookmarks

As the bookmark database grows, you’ll probably want to have some way to filter your bookmarks as you sort through your collection. First of all, to print bookmarks with buku, use the -p flag the optional argument specifies numerical range of bookmarks to print.

$ buku -p 1
$ buku -p 20-25
$ buku -p 18-50

To look for specific keywords, use the -s flag. This looks through all bookmark fields and prints a list of bookmarks.

$ buku -s cooking

1. Based Cooking [32]
   > https://based.cooking/
   + The fast-loading recipe site with cooking only and no ads.
   # cooking,recepies
   
2. 100R — home [54]
   > https://100r.co/site/home.html
   + hundred rabbits primary site
   # blog,boat,cooking,personal-site

You may notice the number in brackets. This is the actual index of the link in the bookmark database. If you want to open up a bookmark, you will have to use this number. We can also query by tag, using the -t flag. Results with match the tag given in the argument.

$ buku -s recepies

1. Based Cooking [32]
   > https://based.cooking/
   + The fast-loading recipe site with cooking only and no ads.
   # cooking,recepies

Other information can be found in the manpage buku(1).

Final Thoughts

Buku is one of the best cli bookmark managers out there, it can be operated entirely with command line arguments, only being interactive when you want it to be. Out of all the bookmark managers I have used, this one is hands down the best.


  1. Technically everything is a python dependency. ↩︎

  2. The '-d' flag without any args will delete the entire bookmark database. ↩︎

<= Previous Next =>

Liked the article? Send it to a friend!