2016-04-22 16:11:16 -05:00
< h1 align = "center" > Buku< / h1 >
2015-11-10 01:15:35 -06:00
2016-04-23 00:46:27 -05:00
< p align = "center" >
2017-03-12 23:31:35 -05:00
< a href = "https://github.com/jarun/Buku/releases/latest" > < img src = "https://img.shields.io/github/release/jarun/buku.svg?maxAge=600" alt = "Latest release" / > < / a >
< a href = "https://aur.archlinux.org/packages/buku" > < img src = "https://img.shields.io/aur/version/buku.svg?maxAge=600" alt = "AUR" / > < / a >
< a href = "http://braumeister.org/formula/buku" > < img src = "https://img.shields.io/homebrew/v/buku.svg?maxAge=600" alt = "Homebrew" / > < / a >
< a href = "https://pypi.python.org/pypi/buku" > < img src = "https://img.shields.io/pypi/v/buku.svg?maxAge=600" alt = "PyPI" / > < / a >
< a href = "https://packages.debian.org/search?keywords=buku&searchon=names&exact=1" > < img src = "https://img.shields.io/badge/debian-9+-blue.svg?maxAge=2592000" alt = "Debian Strech+" / > < / a >
< a href = "http://packages.ubuntu.com/search?keywords=buku&searchon=names&exact=1" > < img src = "https://img.shields.io/badge/ubuntu-17.04+-blue.svg?maxAge=2592000" alt = "Ubuntu Zesty+" / > < / a >
2016-04-26 03:36:14 -05:00
< a href = "https://github.com/jarun/buku/blob/master/LICENSE" > < img src = "https://img.shields.io/badge/license-GPLv3-yellow.svg?maxAge=2592000" alt = "License" / > < / a >
2016-06-03 19:32:38 -05:00
< a href = "https://travis-ci.org/jarun/Buku" > < img src = "https://travis-ci.org/jarun/Buku.svg?branch=master" alt = "Build Status" / > < / a >
2016-04-23 00:46:27 -05:00
< / p >
2016-04-22 16:11:16 -05:00
< p align = "center" >
2017-02-20 08:05:55 -06:00
< a href = "https://asciinema.org/a/8pm3q3n5s95tvat8naam68ejv" > < img src = "https://asciinema.org/a/8pm3q3n5s95tvat8naam68ejv.png" alt = "Asciicast" width = "734" / > < / a >
2016-04-22 16:11:16 -05:00
< / p >
2015-11-10 01:15:35 -06:00
2017-03-29 02:07:43 -05:00
### Table of Contents
2016-05-23 04:02:46 -05:00
2017-03-12 23:31:35 -05:00
- [Introduction ](#introduction )
2016-09-05 11:27:11 -05:00
- [Features ](#features )
2016-04-19 13:57:58 -05:00
- [Installation ](#installation )
- [Dependencies ](#dependencies )
2017-03-16 22:05:27 -05:00
- [Installing with a package manager ](#installing-with-a-package-manager )
2016-04-19 13:57:58 -05:00
- [Installing from this repository ](#installing-from-this-repository )
2016-10-23 10:44:16 -05:00
- [Running as a standalone utility ](#running-as-a-standalone-utility )
- [Debian package ](#debian-package )
2016-09-11 10:24:33 -05:00
- [Shell completion ](#shell-completion )
2016-04-19 13:57:58 -05:00
- [Usage ](#usage )
- [Cmdline options ](#cmdline-options )
- [Operational notes ](#operational-notes )
2016-10-01 11:19:14 -05:00
- [GUI integration ](#gui-integration )
2016-11-11 20:38:28 -06:00
- [Add bookmarks from anywhere ](#add-bookmarks-from-anywhere )
2016-10-01 11:19:14 -05:00
- [Import bookmarks to browser ](#import-bookmarks-to-browser )
2016-11-25 10:19:34 -06:00
- [Sync database across systems ](#sync-database-across-systems )
2016-11-11 20:38:28 -06:00
- [As a library ](#as-a-library )
2016-12-06 09:24:27 -06:00
- [Related projects ](#related-projects )
- [Mentions ](#mentions )
2016-04-19 13:57:58 -05:00
- [Examples ](#examples )
2017-03-29 02:07:43 -05:00
- [Collaborators ](#collaborators )
2016-04-19 13:57:58 -05:00
2017-03-29 02:07:43 -05:00
### Introduction
2017-03-12 23:31:35 -05:00
`buku` is a powerful bookmark management utility written in Python3 and SQLite3. When I started writing it, I couldn't find a flexible cmdline solution with a private, portable, merge-able database along with browser integration. Hence, `buku` (after my son's nickname).
`buku` fetches the title of a bookmarked web page and stores it along with any additional comments and tags. You can use your favourite editor to compose and update bookmarks. With multiple search options, including regex and a deep scan mode (particularly for URLs), it can find any bookmark instantly. Multiple search results can be opened in the browser at once.
Though a terminal utility, it's possible to add bookmarks to `buku` without touching the terminal! Refer to the section on [GUI integration ](#gui-integration ). If you prefer the terminal, thanks to the [shell completion ](#shell-completion ) scripts, you don't need to memorize any of the options. There's an Easter egg to revisit random forgotten bookmarks too.
2017-03-29 02:07:43 -05:00
*Buku* is too busy to track you - no history, obsolete records, usage analytics or homing.
2017-03-12 23:31:35 -05:00
There are several [projects ](#related-projects ) based on `buku` , including a browser plug-in.
2017-03-29 02:07:43 -05:00
PRs are welcome. Please visit [#135 ](https://github.com/jarun/Buku/issues/135 ) for a list of TODOs.
2017-03-12 23:31:35 -05:00
< p align = "right" >
< a href = "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=RMLTQ76JSXJ4Q" > < img src = "https://tuxtricks.files.wordpress.com/2016/12/donate.png" alt = "Donate via PayPal!" title = "Donate via PayPal!" / > < / a >
< / p >
2017-03-29 02:07:43 -05:00
### Features
2016-09-05 11:27:11 -05:00
2017-03-12 23:31:35 -05:00
- Lightweight, clean interface
- Text editor integration
- Fetch page title, add tags and comments
- Multiple search modes (e.g. `deep` , `regex` )
- Continuous search at prompt, on the fly mode switch
2016-12-30 04:35:12 -06:00
- Open bookmarks and search results in browser
- Import/export in HTML (FF, Chrome compatible) or Markdown
- Shorten and expand URLs
2017-03-12 23:31:35 -05:00
- Password protection (manual)
2016-12-30 04:35:12 -06:00
- Portable, merge-able database to sync between systems
2017-03-12 23:31:35 -05:00
- Multithreaded full DB refresh
- Shell completion scripts, man page with examples
2016-09-05 11:27:11 -05:00
2017-03-29 02:07:43 -05:00
### Installation
2016-05-23 04:02:46 -05:00
2017-03-29 02:07:43 -05:00
#### Dependencies
2016-05-23 04:02:46 -05:00
2017-03-12 23:31:35 -05:00
| Feature | Dependency |
| --- | --- |
| Scripting language | Python 3.3+ |
| HTTP(S) | urllib3 |
| Encryption | cryptography |
| Import browser exported html | beautifulsoup4 |
| Shorten URL, check latest release | requests |
2015-11-08 16:04:49 -06:00
2017-03-16 22:05:27 -05:00
To install package dependencies using pip3, run:
2016-05-28 08:36:09 -05:00
2016-11-26 21:30:41 -06:00
$ sudo pip3 install urllib3 cryptography beautifulsoup4 requests
2016-02-28 08:11:27 -06:00
or on Ubuntu:
2016-11-26 21:30:41 -06:00
$ sudo apt-get install python3-urllib3 python3-cryptography python3-bs4 python3-requests
2016-05-23 04:02:46 -05:00
2017-03-29 02:07:43 -05:00
#### Installing with a package manager
2017-03-16 22:05:27 -05:00
- [PyPi ](https://pypi.python.org/pypi/buku/ ) (`$ pip3 install buku`)
- [AUR ](https://aur.archlinux.org/packages/buku/ )
- [Homebrew ](http://braumeister.org/formula/buku )
- [Debian ](https://packages.debian.org/search?keywords=buku&searchon=names&exact=1 )
- [Ubuntu ](http://packages.ubuntu.com/search?keywords=buku&searchon=names&exact=1 )
- [Ubuntu PPA ](https://launchpad.net/~twodopeshaggy/+archive/ubuntu/jarun/ )
- [Void Linux ](https://github.com/voidlinux/void-packages/tree/master/srcpkgs/buku ) (`$ sudo xbps-install -S buku`)
2016-05-23 04:02:46 -05:00
2017-03-29 02:07:43 -05:00
#### Installing from this repository
2016-02-28 08:11:27 -06:00
2017-03-16 22:05:27 -05:00
If you have git installed, clone this repository. Otherwise download the latest [stable release ](https://github.com/jarun/Buku/releases/latest ) or [development version ](https://github.com/jarun/Buku/archive/master.zip ) (*risky*).
2016-02-28 08:11:27 -06:00
2016-05-23 04:02:46 -05:00
Install to default location (`/usr/local`):
2016-02-28 08:11:27 -06:00
2016-04-10 07:41:00 -05:00
$ sudo make install
To remove, run:
2015-11-08 16:04:49 -06:00
2016-02-28 08:11:27 -06:00
$ sudo make uninstall
2016-05-23 04:02:46 -05:00
`PREFIX` is supported. You may need to use `sudo` with `PREFIX` depending on your permissions on destination directory.
2015-12-19 12:15:22 -06:00
2017-03-29 02:07:43 -05:00
##### Running as a standalone utility
2016-05-23 04:02:46 -05:00
2016-02-28 08:11:27 -06:00
`buku` is a standalone utility. From the containing directory, run:
2016-11-06 12:44:44 -06:00
$ chmod +x buku.py
$ ./buku.py
2016-05-23 04:02:46 -05:00
2017-03-29 02:07:43 -05:00
##### Debian package
2016-10-23 10:44:16 -05:00
If you are on a Debian (including Ubuntu) based system visit [the latest stable release ](https://github.com/jarun/Buku/releases/latest ) and download the `.deb` package. To install, run:
$ sudo dpkg -i buku-$version-all.deb
Please substitute `$version` with the appropriate package version.
2017-03-29 02:07:43 -05:00
### Shell completion
2016-09-11 10:24:33 -05:00
Shell completion scripts for Bash, Fish and Zsh can be found in respective subdirectories of [auto-completion/ ](https://github.com/jarun/Buku/blob/master/auto-completion ). Please refer to your shell's manual for installation instructions.
2017-03-29 02:07:43 -05:00
### Usage
2016-05-23 04:02:46 -05:00
2017-03-29 02:07:43 -05:00
#### Cmdline options
2016-05-23 04:02:46 -05:00
2017-01-04 10:17:02 -06:00
```
usage: buku [OPTIONS] [KEYWORD [KEYWORD ...]]
2016-03-20 14:53:57 -05:00
2017-01-04 10:17:02 -06:00
Powerful command-line bookmark manager. Your mini web!
2016-02-28 08:11:27 -06:00
2017-01-29 07:49:47 -06:00
POSITIONAL ARGUMENTS:
KEYWORD search keywords
2017-01-04 10:17:02 -06:00
GENERAL OPTIONS:
2016-11-14 12:37:22 -06:00
-a, --add URL [tag, ...]
2016-05-18 22:24:46 -05:00
bookmark URL with comma-separated tags
2017-02-11 00:03:29 -06:00
-u, --update [...] update fields of an existing bookmark
2016-10-11 02:39:58 -05:00
accepts indices and ranges
2017-02-11 00:03:29 -06:00
refresh the title, if no edit options
if no arguments:
- update results when used with search
- otherwise refresh all titles
-w, --write [editor|index]
open editor to edit a fresh bookmark
to update by index, EDITOR must be set
-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
2016-05-31 00:53:01 -05:00
-h, --help show this information and exit
2017-02-11 00:03:29 -06:00
-v, --version show the program version and exit
2016-05-21 12:29:41 -05:00
2017-01-04 10:17:02 -06:00
EDIT OPTIONS:
2017-02-11 00:03:29 -06:00
--url keyword bookmark link
--tag [+|-] [...] comma-separated tags
clear bookmark tagset, if no arguments
'+' appends to, '-' removes from tagset
2017-03-16 13:15:37 -05:00
--title [...] bookmark title; if no arguments:
2016-05-20 13:26:01 -05:00
-a: do not set title, -u: clear title
2017-03-16 22:05:27 -05:00
-c, --comment [...] notes or description of the bookmark
2017-02-11 00:03:29 -06:00
clears description, if no arguments
2016-11-12 11:06:31 -06:00
--immutable N disable title fetch from web on update
2016-11-05 17:32:03 -05:00
N=0: mutable (default), N=1: immutable
2016-04-29 13:09:39 -05:00
2017-01-04 10:17:02 -06:00
SEARCH OPTIONS:
2017-01-29 07:49:47 -06:00
-s, --sany find records with ANY search keyword
this is the default search option
-S, --sall find records with ALL search keywords
2016-11-06 08:41:45 -06:00
special keywords -
2016-11-12 11:06:31 -06:00
"blank": entries with empty title/tag
"immutable": entries with locked title
2016-11-25 12:10:25 -06:00
--deep match substrings ('pen' matches 'opens')
2017-03-16 13:45:12 -05:00
-r, --sreg run a regex search
-t, --stag search bookmarks by a tag
2017-01-29 07:49:47 -06:00
list all tags, if no search keywords
2016-04-29 13:09:39 -05:00
2017-01-04 10:17:02 -06:00
ENCRYPTION OPTIONS:
2016-04-29 13:09:39 -05:00
-l, --lock [N] encrypt DB file with N (> 0, default 8)
hash iterations to generate key
-k, --unlock [N] decrypt DB file with N (> 0, default 8)
hash iterations to generate key
2017-01-04 10:17:02 -06:00
POWER TOYS:
2017-02-11 00:03:29 -06:00
-e, --export file export bookmarks in Firefox format html
2017-02-10 10:39:02 -06:00
export markdown, if file ends with '.md'
format: [title ](url ), 1 entry per line
2016-09-20 13:02:04 -05:00
use --tag to export only specific tags
2017-02-11 00:03:29 -06:00
-i, --import file import Firefox or Chrome bookmarks html
2017-02-10 10:39:02 -06:00
import markdown, if file ends with '.md'
2016-12-03 11:24:14 -06:00
-m, --merge file add bookmarks from another buku DB file
2017-02-11 00:03:29 -06:00
-p, --print [...] show record details by indices, ranges
print all bookmarks, if no arguments
2017-03-18 14:15:26 -05:00
-n shows the last n results (like tail)
2016-11-25 12:10:25 -06:00
-f, --format N limit fields in -p or Json search output
2017-01-29 07:49:47 -06:00
N=1: URL, N=2: URL and tag, N=3: title
2016-11-07 11:35:02 -06:00
-j, --json Json formatted output for -p and search
2017-02-10 07:55:05 -06:00
--nc disable color output
2017-02-10 07:59:02 -06:00
--np do not show the prompt, run and exit
2017-02-11 00:03:29 -06:00
-o, --open [...] browse bookmarks by indices and ranges
open a random bookmark, if no arguments
--oa browse all search results immediately
2017-03-16 22:05:27 -05:00
--replace old new replace old tag with new tag everywhere
delete old tag, if new tag not specified
2017-02-11 00:03:29 -06:00
--shorten index|URL fetch shortened url from tny.im service
--expand index|URL expand a tny.im shortened url
2016-11-06 09:30:45 -06:00
--tacit reduce verbosity
2016-12-03 07:20:53 -06:00
--threads N max network connections in full refresh
2017-01-29 07:49:47 -06:00
default N=4, min N=1, max N=10
2017-02-10 09:04:24 -06:00
-V check latest upstream version available
2016-11-25 12:10:25 -06:00
-z, --debug show debug information and verbose logs
2016-04-29 13:09:39 -05:00
2017-01-04 10:17:02 -06:00
SYMBOLS:
2016-07-03 05:06:50 -05:00
> title
+ comment
# tags
2017-01-04 10:17:02 -06:00
```
2016-07-03 05:06:50 -05:00
2017-03-29 02:07:43 -05:00
#### Operational notes
2016-05-23 04:02:46 -05:00
2016-11-27 13:25:53 -06:00
- The database file is stored in:
2016-04-24 09:37:51 -05:00
- **$XDG_DATA_HOME/buku/bookmarks.db**, if XDG_DATA_HOME is defined (first preference) or
- **$HOME/.local/share/buku/bookmarks.db**, if HOME is defined (second preference) or
2017-03-12 23:31:35 -05:00
- **$PWD**
2016-06-28 12:51:19 -05:00
- If the URL contains characters like `;` , `&` or brackets they may be interpreted specially by the shell. To avoid it, add the URL within single or double quotes (`'`/`"`).
2016-10-11 02:39:58 -05:00
- URLs are unique in DB. The same URL cannot be added twice.
2016-11-06 11:47:25 -06:00
- Bookmarks with immutable titles are listed with bold `(L)` after the URL.
2016-05-29 09:40:22 -05:00
- **Tags**:
2016-11-20 00:22:28 -06:00
- Comma (`,`) is the tag delimiter in DB. A tag cannot have comma(s) in it. Tags are filtered (for unique tags) and sorted. Tags are stored in lower case and can be replaced, appended or deleted.
2017-01-03 19:19:18 -06:00
- Releases prior to [v2.7 ](https://github.com/jarun/Buku/releases/tag/v2.7 ) support both capital and lower cases in tags. From v2.7 all tags are stored in lowercase. An undocumented option `--fixtags` is introduced to modify the older tags. It also fixes another issue where the same tag appears multiple times in the tagset of a record. Run `buku --fixtags` once.
2016-05-23 04:02:46 -05:00
- **Update** operation:
2016-05-23 01:33:57 -05:00
- If --title, --tag or --comment is passed without argument, clear the corresponding field from DB.
- If --url is passed (and --title is omitted), update the title from web using the URL.
2016-11-05 17:32:03 -05:00
- If indices are passed without any other options (--url, --title, --tag, --comment and --immutable), read the URLs from DB and update titles from web. Bookmarks marked immutable are skipped.
2017-01-08 22:22:22 -06:00
- Can update bookmarks matching a search, when combined with any of the search options and no arguments to update are passed.
2016-06-16 16:08:38 -05:00
- **Delete** operation:
- When a record is deleted, the last record is moved to the index.
2016-06-17 00:24:55 -05:00
- Delete doesn't work with range and indices provided together as arguments. It's an intentional decision to avoid extra sorting, in-range checks and to keep the auto-DB compaction functionality intact. On the same lines, indices are deleted in descending order.
2017-01-08 22:22:22 -06:00
- Can delete bookmarks matching a search, when combined with any of the search options and no arguments to delete are passed.
2016-05-23 04:02:46 -05:00
- **Search** works in mysterious ways:
2016-04-19 14:08:39 -05:00
- Case-insensitive.
2016-12-05 20:00:01 -06:00
- Matches words in URL, title and tags.
2017-01-29 07:49:47 -06:00
- --sany : match any of the keywords in URL, title or tags. Default search option.
2016-10-22 01:42:11 -05:00
- --sall : match all the keywords in URL, title or tags.
2016-09-05 10:09:20 -05:00
- --deep : match **substrings** (`match` matches `rematched` ) in URL, title and tags.
2016-10-21 06:45:10 -05:00
- --sreg : match a regular expression (ignores --deep).
2016-11-25 12:10:25 -06:00
- --stag : search bookmarks by a tag, or list all tags alphabetically with usage count (if no arguments).
2016-06-06 12:26:12 -05:00
- Search results are indexed serially. This index is different from actual database index of a bookmark record which is shown in bold within `[]` after the URL.
2017-01-03 19:19:18 -06:00
- **Encryption** is optional and manual. AES256 algorithm is used. To use encryption, the database file should be unlocked (-k) before using `buku` and locked (-l) afterwards. Between these 2 operations, the database file lies unencrypted on the disk, and NOT in memory. Also, note that the database file is *unencrypted on creation* .
2017-02-04 08:45:33 -06:00
- **Editor** support:
2017-02-07 12:03:51 -06:00
- A single bookmark can be edited before adding. The editor can be set using the environment variable *EDITOR* or by explicitly specifying the editor. The latter takes preference. If -a is used along with -w, the details are populated in the editor template.
- In case of edit and update (a single bookmark), the existing record details are fetched from DB and populated in the editor template. The environment variable EDITOR must be set Note that -u works independently of -w.
- All lines beginning with "#" will be stripped. Then line 1 will be treated as the URL, line 2 will be the title, line 3 will be comma separated tags, and the rest of the lines will be parsed as descriptions.
2016-11-18 10:36:09 -06:00
- **Proxy** support: environment variable *https_proxy* , if defined, is used to tunnel data for both http and https connections. The supported format is:
2017-03-16 22:05:27 -05:00
http[s]://[username:password@]proxyhost:proxyport/
2016-02-28 05:08:04 -06:00
2017-03-29 02:07:43 -05:00
### GUI integration
2016-10-01 11:19:14 -05:00
![buku ](http://i.imgur.com/8Y6PTPw.png )
2016-11-27 13:25:53 -06:00
`buku` can be integrated in a GUI environment with simple tweaks.
2016-10-01 11:19:14 -05:00
2017-03-29 02:07:43 -05:00
#### Add bookmarks from anywhere
2016-10-01 11:19:14 -05:00
2016-10-02 23:50:30 -05:00
With support for piped input, it's possible to add bookmarks to `buku` using keyboard shortcuts on Linux and OS X. CLIPBOARD (plus PRIMARY on Linux) text selections can be added directly this way. The additional utility required is `xsel` (on Linux) or `pbpaste` (on OS X).
2016-10-01 11:19:14 -05:00
2016-10-02 23:50:30 -05:00
The following steps explore the procedure on Linux with Ubuntu as the reference platform.
2016-10-01 11:19:14 -05:00
1. To install `xsel` on Ubuntu, run:
$ sudo apt install xsel
2. Create a new script `bukuadd` with the following content:
#!/bin/bash
xsel | buku -a
2017-03-16 22:05:27 -05:00
`-a` is the option to add a bookmark.
2016-10-01 11:19:14 -05:00
3. Make the script executable:
$ chmod +x bukuadd
4. Copy it somewhere in your `PATH` .
5. Add a new keyboard shortcut to run the script. I use `<Alt-b>` .
2017-03-29 02:07:43 -05:00
##### Test drive
2016-10-01 11:19:14 -05:00
2017-03-16 13:15:37 -05:00
Copy or select a URL with mouse and press the keyboard shortcut to add it to the `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. To avoid title fetch from the web, add the `--title` option to the script.
2016-10-01 11:19:14 -05:00
To verify that the bookmark has indeed been added, run:
$ buku -p | tail -3
and check the entry.
2017-03-29 02:07:43 -05:00
##### Tips
2016-10-01 11:19:14 -05:00
- To 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
- If you want to tag these bookmarks, look them up later using:
$ buku -S blank
2017-03-16 22:05:27 -05:00
Use option `-u` to tag these bookmarks.
2016-10-01 11:19:14 -05:00
2017-03-29 02:07:43 -05:00
#### Import bookmarks to browser
2016-10-01 11:19:14 -05:00
2016-10-02 23:50:30 -05:00
`buku` can export (or import) bookmarks in HTML format recognized by Firefox, Google Chrome and Internet Explorer.
2016-10-01 11:19:14 -05:00
To export all bookmarks, run:
$ buku --export path_to_bookmarks.html
To export specific tags, run:
$ buku --export path_to_bookmarks.html --tag tag 1, tag 2
Once exported, import the html file in your browser.
2017-03-29 02:07:43 -05:00
### Sync database across systems
2016-11-25 10:19:34 -06:00
2016-11-27 09:28:03 -06:00
`buku` has the capability to import records from another `buku` database file. However, users with a cloud service client installed on multiple systems can keep the database synced across these systems automatically. To achieve this store the actual database file in a synced directory and create a symbolic link to it in the location where the database file would exist otherwise. For example, `$HOME/.local/share/buku/bookmarks.db` can be a symbolic link to `~/synced_dir/bookmarks.db` .
2016-11-25 10:19:34 -06:00
2017-03-29 02:07:43 -05:00
### As a library
2016-11-11 20:38:28 -06:00
`buku` can be used as a powerful bookmark management library. All functionality are available through carefully designed APIs. `main()` is a good usage example. It's also possible to use a custom database file in multi-user scenarios. Check out the documentation for the following APIs which accept an optional argument as database file:
BukuDb.initdb(dbfile=None)
BukuCrypt.encrypt_file(iterations, dbfile=None)
BukuCrypt.decrypt_file(iterations, dbfile=None)
NOTE: This flexibility is not exposed in the program.
2017-03-29 02:07:43 -05:00
### Related projects
2016-12-06 09:24:27 -06:00
2017-02-28 08:03:38 -06:00
- [bukubrow ](https://github.com/SamHH/bukubrow ), WebExtension for browser integration
- [oil ](https://github.com/AndreiUlmeyda/oil ), search-as-you-type cli frontend
- [buku_run ](https://github.com/carnager/buku_run ), rofi frontend
2016-12-06 09:24:27 -06:00
2017-03-29 02:07:43 -05:00
### Mentions
2016-12-06 09:24:27 -06:00
- [One Thing Well ](http://onethingwell.org/post/144952807044/buku )
- [It's F.O.S.S. ](https://itsfoss.com/buku-command-line-bookmark-manager-linux/ )
- [Make Tech Easier ](https://www.maketecheasier.com/manage-browser-bookmarks-ubuntu-command-line/ )
2017-01-24 20:53:15 -06:00
- [LinuxUser Magazine 01/2017 Issue ](http://www.linux-community.de/LU/2017/01/Das-Beste-aus-zwei-Welten )
2016-12-06 09:24:27 -06:00
2017-03-29 02:07:43 -05:00
### Examples
2016-05-23 04:02:46 -05:00
2017-02-05 11:05:45 -06:00
1. **Edit and add** a bookmark from editor:
$ buku -w
$ buku -w 'macvim -f' -a https://ddg.gg search engine, privacy
2017-03-16 22:05:27 -05:00
The first command picks editor from the environment variable `EDITOR` . The second command will open macvim with option -f and the URL and tags populated in template.
2017-02-05 11:05:45 -06:00
2. **Add** a bookmark with **tags** `search engine` and `privacy` , **comment** `Search engine with perks` , **fetch page title** from the web:
$ buku -a https://ddg.gg search engine, privacy -c Search engine with perks
2017-01-09 17:22:21 -06:00
336. https://ddg.gg
> DuckDuckGo
+ Alternative search engine with perks
# privacy,search engine
2017-03-16 22:05:27 -05:00
where, >: title, +: comment, #: tags
2017-02-05 11:05:45 -06:00
3. **Add** a bookmark with tags `search engine` & `privacy` and **immutable custom title** `DDG` :
2016-02-28 08:32:10 -06:00
2017-03-16 13:15:37 -05:00
$ buku -a https://ddg.gg search engine, privacy --title 'DDG' --immutable 1
2017-01-09 17:22:21 -06:00
336. https://ddg.gg (L)
> DDG
# privacy,search engine
2017-03-16 22:05:27 -05:00
Note that URL must precede tags.
2017-02-05 11:05:45 -06:00
4. **Add** a bookmark **without a title** (works for update too):
2016-02-28 08:32:10 -06:00
2017-03-16 13:15:37 -05:00
$ buku -a https://ddg.gg search engine, privacy --title
2017-02-07 12:03:51 -06:00
5. **Edit and update** a bookmark from editor:
$ buku -w 15012014
2017-03-16 22:05:27 -05:00
This will open the existing bookmark's details in the editor for modifications. Environment variable `EDITOR` must be set.
2017-02-07 12:03:51 -06:00
6. **Update** existing bookmark at index 15012014 with new URL, tags and comments, fetch title from the web:
2016-05-20 13:26:01 -05:00
2017-02-05 11:05:45 -06:00
$ buku -u 15012014 --url http://ddg.gg/ --tag web search, utilities -c Private search engine
2017-02-07 12:03:51 -06:00
7. **Fetch and update only title** for bookmark at 15012014:
2016-05-20 13:26:01 -05:00
$ buku -u 15012014
2017-02-07 12:03:51 -06:00
8. **Update only comment** for bookmark at 15012014:
2016-05-20 13:26:01 -05:00
$ buku -u 15012014 -c this is a new comment
2017-03-16 22:05:27 -05:00
Applies to --url, --title and --tag too.
2017-02-04 08:45:33 -06:00
9. **Export** bookmarks tagged `tag 1` or `tag 2` to HTML and markdown:
2016-09-20 13:02:04 -05:00
2016-10-22 01:25:41 -05:00
$ buku -e bookmarks.html --tag tag 1, tag 2
2017-02-10 10:39:02 -06:00
$ buku -e bookmarks.md --tag tag 1, tag 2
2017-03-16 22:05:27 -05:00
All bookmarks are exported if --tag is not specified.
2017-02-04 08:45:33 -06:00
10. **Import** bookmarks from HTML and markdown:
2016-05-22 18:36:41 -05:00
$ buku -i bookmarks.html
2017-02-10 10:39:02 -06:00
$ buku -i bookmarks.md
2017-02-04 08:45:33 -06:00
11. **Delete only comment** for bookmark at 15012014:
2016-02-28 08:32:10 -06:00
2016-05-20 13:26:01 -05:00
$ buku -u 15012014 -c
2017-03-16 22:05:27 -05:00
Applies to --title and --tag too. URL cannot be deleted without deleting the bookmark.
2017-02-04 08:45:33 -06:00
12. **Update** or refresh **full DB** with page titles from the web:
2016-02-28 08:32:10 -06:00
2016-04-30 23:33:21 -05:00
$ buku -u
2016-11-08 11:32:45 -06:00
$ buku -u --tacit (show only failures and exceptions)
2017-03-16 22:05:27 -05:00
This operation does not modify the indexes, URLs, tags or comments. Only title is refreshed if fetched title is non-empty.
2017-02-04 08:45:33 -06:00
13. **Delete** bookmark at index 15012014:
2016-02-28 08:32:10 -06:00
$ buku -d 15012014
2016-03-20 00:53:59 -05:00
Index 15012020 moved to 15012014
2017-03-16 22:05:27 -05:00
The last index is moved to the deleted index to keep the DB compact.
2017-02-04 08:45:33 -06:00
14. **Delete all** bookmarks:
2016-02-28 08:32:10 -06:00
2016-04-30 23:33:21 -05:00
$ buku -d
2017-02-04 08:45:33 -06:00
15. **Delete** a **range or list** of bookmarks:
2016-06-16 16:08:38 -05:00
2016-10-22 01:42:11 -05:00
$ buku -d 100-200
$ buku -d 100 15 200
2017-02-04 08:45:33 -06:00
16. **Search** bookmarks for **ANY** of the keywords `kernel` and `debugging` in URL, title or tags:
2016-02-28 08:32:10 -06:00
2017-02-20 08:05:55 -06:00
$ buku kernel debugging
2016-02-28 08:32:10 -06:00
$ buku -s kernel debugging
2017-02-04 08:45:33 -06:00
17. **Search** bookmarks with **ALL** the keywords `kernel` and `debugging` in URL, title or tags:
2016-02-28 08:32:10 -06:00
$ buku -S kernel debugging
2017-02-04 08:45:33 -06:00
18. **Search** bookmarks **tagged** `general kernel concepts` :
2016-04-19 12:30:06 -05:00
2016-11-07 11:35:02 -06:00
$ buku --stag general kernel concepts
2017-02-04 08:45:33 -06:00
19. List **all unique tags** alphabetically:
2016-05-01 03:43:26 -05:00
2016-11-07 11:35:02 -06:00
$ buku --stag
2017-02-04 08:45:33 -06:00
20. Run a **search and update** the results:
2017-01-08 22:22:22 -06:00
2017-03-16 22:05:27 -05:00
$ buku -s kernel debugging -u --tag + linux kernel
2017-02-04 08:45:33 -06:00
21. Run a **search and delete** the results:
2016-11-26 08:28:22 -06:00
$ buku -s kernel debugging -d
2017-02-04 08:45:33 -06:00
22. **Encrypt or decrypt** DB with **custom number of iterations** (15) to generate key:
2016-02-28 08:32:10 -06:00
2016-04-30 23:33:21 -05:00
$ buku -l 15
$ buku -k 15
2017-03-16 22:05:27 -05:00
The same number of iterations must be specified for one lock & unlock instance. Default is 8, if omitted.
2017-02-04 08:45:33 -06:00
23. **Show details** of bookmarks at index 15012014 and ranges 20-30, 40-50:
2016-05-01 03:43:26 -05:00
2016-10-11 11:45:07 -05:00
$ buku -p 20-30 15012014 40-50
2017-03-18 14:15:26 -05:00
24. Show details of the **last 10 bookmarks** :
$ buku -p -10
25. **Show all** bookmarks with real index from database:
2016-05-01 03:43:26 -05:00
$ buku -p
2016-05-03 12:52:36 -05:00
$ buku -p | more
2017-03-18 14:15:26 -05:00
26. **Replace tag** 'old tag' with 'new tag':
2016-05-01 03:43:26 -05:00
2017-03-16 22:05:27 -05:00
$ buku --replace 'old tag' 'new tag'
2017-03-18 14:15:26 -05:00
27. **Delete tag** 'old tag' from DB:
2016-05-01 03:43:26 -05:00
2017-03-16 13:37:51 -05:00
$ buku --replace 'old tag'
2017-03-18 14:15:26 -05:00
28. **Append (or delete) tags** 'tag 1', 'tag 2' to (or from) existing tags of bookmark at index 15012014:
2016-06-12 05:48:10 -05:00
$ buku -u 15012014 --tag + tag 1, tag 2
2016-07-11 12:18:40 -05:00
$ buku -u 15012014 --tag - tag 1, tag 2
2017-03-18 14:15:26 -05:00
29. **Open URL** at index 15012014 in browser:
2016-05-01 03:43:26 -05:00
$ buku -o 15012014
2017-03-18 14:15:26 -05:00
30. List bookmarks with **no title or tags** for bookkeeping:
2016-03-29 07:43:43 -05:00
2016-05-01 08:44:17 -05:00
$ buku -S blank
2017-03-18 14:15:26 -05:00
31. List bookmarks with **immutable title** :
2016-11-06 08:41:45 -06:00
$ buku -S immutable
2017-03-18 14:15:26 -05:00
32. **Shorten URL** www.google.com and the URL at index 20:
2016-11-12 09:47:36 -06:00
$ buku --shorten www.google.com
$ buku --shorten 20
2017-03-18 14:15:26 -05:00
33. More **help** :
2016-02-28 08:32:10 -06:00
2016-11-26 08:28:22 -06:00
$ buku -h
2016-05-23 01:21:29 -05:00
$ man buku
2015-11-08 16:04:49 -06:00
2017-03-29 02:07:43 -05:00
### Collaborators
2016-05-31 11:21:10 -05:00
2017-03-29 02:07:43 -05:00
- [Arun Prakash Jana ](https://github.com/jarun )
- [Rachmadani Haryono ](https://github.com/rachmadaniHaryono )
- [Kishore Narendran ](https://github.com/kishore-narendran )
2016-05-23 04:02:46 -05:00
2017-01-01 08:25:10 -06:00
Copyright © 2015-2017 [Arun Prakash Jana ](mailto:engineerarun@gmail.com )
2017-03-29 02:07:43 -05:00
< br >
< p > < a href = "https://gitter.im/jarun/Buku" > < img src = "https://img.shields.io/gitter/room/jarun/buku.svg?maxAge=2592000" alt = "gitter chat" / > < / a > < / p >