buku in action!
buku is a powerful bookmark manager and a personal textual mini-web.
For those who prefer the GUI, bukuserver exposes a browsable front-end on a local web host server. See bukuserver page for config and screenshots.
When I started writing it, I couldn't find a flexible command-line solution with a private, portable, merge-able database along with seamless GUI integration. Hence, buku.
buku can import bookmarks from browser(s) or fetch the title, tags and description of a URL from the web. Use your favourite editor to add, compose and update bookmarks. Search bookmarks instantly with multiple search options, including regex and a deep scan mode (handy with URLs).
It can look up broken links on the Wayback Machine. There's an Easter Egg to revisit random bookmarks.
There's no tracking, hidden history, obsolete records, usage analytics or homing.
To get started right away, jump to the Quickstart section. buku has one of the best documentation around. The man page comes with examples. For internal details, please refer to the operational notes.
buku is a library too! There are several related projects, including a browser plug-in.
| Feature | Dependency |
|---|---|
| Lang, SQLite | Python 3.10+ |
| HTTPS | certifi, urllib3 |
| Encryption | cryptography |
| HTML | beautifulsoup4, html5lib |
To copy URL to clipboard buku uses xsel (or xclip) on Linux, pbcopy (default installed) on OS X, clip (default installed) on Windows, termux-clipboard on Termux (terminal emulation for Android), wl-copy on Wayland. If X11 is missing, GNU Screen or tmux copy-paste buffers are recognized.
To install buku with all its dependencies from PyPI, run:
# pip3 install buku
You can also install buku from your package manager. If the version available is dated try an alternative installation method.
Packaging status (expand)
Unlisted packagers:
● PyPI (pip3 install buku)
● Termux (pip3 install buku)
Auto-generated packages (with only the cli component) for Arch Linux, CentOS, Debian, Fedora, openSUSE Leap and Ubuntu are available with the latest stable release.
NOTE: CentOS may not have the python3-beautifulsoup4 package in the repos. Install it using pip3.
If you have git installed, clone this repository. Otherwise download the latest stable release or development version (risky).
Install the dependencies. For example, on Ubuntu:
$ apt-get install ca-certificates python3-urllib3 python3-cryptography python3-bs4
Install the cli component to default location (/usr/local):
$ sudo make install
To remove, run:
$ sudo make uninstall
PREFIX is supported, in case you want to install to a different location.
buku is a standalone utility. From the containing directory, run:
$ chmod +x buku.py
$ ./buku.py
Shell completion scripts for Bash, Fish and Zsh can be found in respective subdirectories of auto-completion/. Please refer to your shell's manual for installation instructions.
``` usage: buku [OPTIONS] [KEYWORD [KEYWORD ...]]
Bookmark manager like a text-based mini-web.
POSITIONAL ARGUMENTS: KEYWORD search keywords
GENERAL OPTIONS: -a, --add URL [+|-] [tag, ...] bookmark URL with comma-separated tags (prepend tags with '+' or '-' to use fetched tags) -u, --update [...] update fields of an existing bookmark accepts indices and ranges refresh title and desc if no edit options if no arguments: - update results when used with search - otherwise refresh all titles and desc -w, --write [editor|index] edit and add a new bookmark in editor else, edit bookmark at index in EDITOR edit last bookmark, if index=-1 if no args, edit new bookmark in EDITOR -d, --delete [...] remove bookmarks from DB accepts indices or a single range if no arguments: - delete results when used with search - otherwise delete all bookmarks --retain-order prevents reordering after deleting a bookmark -h, --help show this information and exit -v, --version show the program version and exit
EDIT OPTIONS: --url keyword bookmark link --tag [+|-] [...] comma-separated tags clear bookmark tagset, if no arguments '+' appends to, '-' removes from tagset --title [...] bookmark title; if no arguments: -a: do not set title, -u: clear title -c, --comment [...] notes or description of the bookmark clears description, if no arguments --immutable N disable web-fetch during auto-refresh N=0: mutable (default), N=1: immutable --swap N M swap two records at specified indices
SEARCH OPTIONS: -s, --sany [...] find records with ANY matching keyword this is the default search option -S, --sall [...] find records matching ALL the keywords special keywords - "blank": entries with empty title/tag "immutable": entries with locked title --deep match substrings ('pen' matches 'opens') --markers search for keywords in specific fields based on (optional) prefix markers: '.' - title, '>' - description, ':' - URL, '#' - tags (comma-separated, PARTIAL matches) '#,' - tags (comma-separated, EXACT matches) '*' - any field (same as no prefix) -r, --sreg expr run a regex search -t, --stag [tag [,|+] ...] [- tag, ...] search bookmarks by tags use ',' to find entries matching ANY tag use '+' to find entries matching ALL tags excludes entries with tags after ' - ' list all tags, if no search keywords -x, --exclude [...] omit records matching specified keywords --random [N] output random bookmarks out of the selection (default 1) --order fields [...] comma-separated list of fields to order the output by (prepend with '+'/'-' to choose sort direction)
ENCRYPTION OPTIONS: -l, --lock [N] encrypt DB in N (default 8) # iterations -k, --unlock [N] decrypt DB in N (default 8) # iterations
POWER TOYS: --ai auto-import bookmarks from web browsers Firefox, Chrome, Chromium, Vivaldi, Brave, Edge (Firefox profile can be specified using environment variable FIREFOX_PROFILE) -e, --export file export bookmarks to Firefox format HTML export XBEL, if file ends with '.xbel' export Markdown, if file ends with '.md' format: title export Orgfile, if file ends with '.org' format: [[url][title]] :tags: export rss feed if file ends with '.rss'/'.atom' export buku DB, if file ends with '.db' combines with search results, if opted -i, --import file import bookmarks from file supports .html .xbel .json .md .org .rss .atom .db (.json = Firefox backup; .db = another Buku DB) -p, --print [...] show record details by indices, ranges print all bookmarks, if no arguments -n shows the last n results (like tail) -f, --format N limit fields in -p or JSON search output N=1: URL; N=2: URL, tag; N=3: title; N=4: URL, title, tag; N=5: title, tag; N0 (10, 20, 30, 40, 50) omits DB index -j, --json [file] JSON formatted output for -p and search. prints to stdout if argument missing. otherwise writes to given file --colors COLORS set output colors in five-letter string --nc disable color output -n, --count N show N results per page (default 10) --np do not show the subprompt, run and exit -o, --open [...] browse bookmarks by indices and ranges open a random bookmark, if no arguments --oa browse all search results immediately --default-scheme S if scheme is missing from uri, assume S when opening in browser (default http) --replace old new replace old tag with new tag everywhere delete old tag, if new tag not specified --url-redirect when fetching an URL, use the resulting URL from following permanent* redirects (when combined with --export, the old URL is included as additional metadata) --tag-redirect [tag] when fetching an URL that causes permanent redirect, add a tag in specified pattern (using 'http:{}' if not specified) --tag-error [tag] when fetching an URL that causes an HTTP error, add a tag in specified pattern (using 'http:{}' if not specified) --del-error [...] when fetching an URL causes any