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" >
2016-05-23 22:18:02 -05:00
< a href = "https://github.com/jarun/Buku/releases/latest" > < img src = "https://img.shields.io/github/release/jarun/buku.svg" alt = "Latest release" / > < / a >
2016-04-23 00:46:27 -05:00
< a href = "https://aur.archlinux.org/packages/buku" > < img src = "https://img.shields.io/aur/version/buku.svg" alt = "AUR" / > < / a >
< a href = "http://braumeister.org/formula/buku" > < img src = "https://img.shields.io/homebrew/v/buku.svg" alt = "Homebrew" / > < / 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-04-23 00:46:27 -05:00
< / p >
2016-04-22 16:11:16 -05:00
< p align = "center" >
2016-05-28 12:11:10 -05:00
< a href = "https://asciinema.org/a/b7ymahqwgt92jev32q4cmcm8h" > < img src = "https://asciinema.org/a/b7ymahqwgt92jev32q4cmcm8h.png" alt = "Asciicast" width = "600" / > < / a >
2016-04-22 16:11:16 -05:00
< / p >
2015-11-10 01:15:35 -06:00
2016-04-20 23:59:57 -05:00
`buku` is a powerful cmdline bookmark management utility written in Python3 and SQLite3. When I started writing it, I couldn't find a flexible cmdline solution with a portable database. Hence, `Buku` (after my son's nickname).
2016-02-28 05:08:04 -06:00
2016-05-24 01:21:43 -05:00
`buku` can handle piped input, which lets you combine it with `xsel` (on Linux) and add bookmarks from anywhere without touching the terminal.
2016-05-23 04:02:46 -05:00
2016-03-26 12:21:40 -05:00
Ref: [buku & xsel: add selected or copied URL as bookmark ](http://tuxdiary.com/2016/03/26/buku-xsel/ )
2016-02-28 05:08:04 -06:00
2016-05-27 06:23:38 -05:00
Got some suggestions? [![gitter chat ](https://img.shields.io/gitter/room/jarun/buku.svg?maxAge=2592000 )](https://gitter.im/jarun/Buku) with us.
2016-04-17 05:07:22 -05:00
Find `buku` useful? If you would like to donate, visit the
2016-04-26 03:36:14 -05:00
[![Donate Button ](https://img.shields.io/badge/paypal-donate-orange.svg?maxAge=2592000 )](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick& hosted_button_id=RMLTQ76JSXJ4Q) page.
2016-02-28 05:08:04 -06:00
2016-05-02 12:22:26 -05:00
Copyright (C) 2015-2016 [Arun Prakash Jana ](mailto:engineerarun@gmail.com ).
2016-04-26 03:19:16 -05:00
2015-11-08 16:04:49 -06:00
# Features
2016-05-23 04:02:46 -05:00
2016-05-22 18:36:41 -05:00
- Add, tag, comment on, search, update, remove bookmarks
- Fetch page title from the web (default) or add manually
2016-05-28 08:36:09 -05:00
- Import HTML bookmark exports from Firefox, Google Chrome or IE
2016-05-22 18:36:41 -05:00
- Open search results directly in browser
2016-05-17 03:19:50 -05:00
- Manual password protection using AES256 encryption
- Modify or delete tags, list all unique tags alphabetically
2016-05-22 18:36:41 -05:00
- Refresh all bookmarks online in one shot
2016-05-15 02:34:56 -05:00
- Tab-completion scripts for Bash, Fish and Zsh
2016-05-17 21:48:27 -05:00
- Man page with examples
- Several options for power users (see help or man page)
2016-05-17 03:34:04 -05:00
- Fast and clean interface
2015-11-08 16:04:49 -06:00
- Minimal dependencies
2016-04-19 13:57:58 -05:00
# Table of Contents
2016-05-23 04:02:46 -05:00
2016-04-19 13:57:58 -05:00
- [Installation ](#installation )
- [Dependencies ](#dependencies )
- [Installing from this repository ](#installing-from-this-repository )
- [Running as a standalone utility ](#running-as-a-standalone-utility )
2016-05-15 02:34:56 -05:00
- [Shell completion ](#shell-completion )
2016-04-19 13:57:58 -05:00
- [Installing with a package manager ](#installing-with-a-package-manager )
- [Usage ](#usage )
- [Cmdline options ](#cmdline-options )
- [Operational notes ](#operational-notes )
- [Examples ](#examples )
- [Contributions ](#contributions )
- [Developers ](#developers )
2015-11-08 16:04:49 -06:00
# Installation
2016-05-23 04:02:46 -05:00
2016-02-28 08:11:27 -06:00
## Dependencies
2016-05-23 04:02:46 -05:00
2015-12-19 14:13:46 -06:00
`buku` requires Python 3.x to work.
2015-11-08 16:04:49 -06:00
2016-05-28 08:36:09 -05:00
Optional dependencies:
- Encryption: PyCrypto
- Import bookmarks: Beautiful Soup
2016-02-28 08:11:27 -06:00
2016-05-28 08:36:09 -05:00
Run:
$ sudo pip3 install pycrypto beautifulsoup4
2016-02-28 08:11:27 -06:00
or on Ubuntu:
2016-05-28 08:36:09 -05:00
$ sudo apt-get install python3-crypto python3-bs4
2016-05-23 04:02:46 -05:00
2016-03-24 03:46:07 -05:00
## Installing from this repository
2016-05-23 04:02:46 -05:00
2016-02-28 08:11:27 -06:00
If you have git installed, run:
$ git clone https://github.com/jarun/buku/
or download the latest [stable release ](https://github.com/jarun/Buku/releases/latest ) or [development version ](https://github.com/jarun/buku/archive/master.zip ).
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
2016-02-28 08:11:27 -06: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:
$ ./buku
2016-05-23 04:02:46 -05:00
2016-05-15 02:34:56 -05:00
## Shell completion
2016-05-23 04:02:46 -05:00
2016-05-24 23:25:00 -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.
2016-05-23 04:02:46 -05:00
2016-02-28 08:11:27 -06:00
## Installing with a package manager
2016-05-23 04:02:46 -05:00
2016-02-28 08:11:27 -06:00
`buku` is also available on
2016-04-22 00:17:00 -05:00
- [AUR ](https://aur.archlinux.org/packages/buku/ ) for Arch Linux
- Void Linux repos ( `$ sudo xbps-install -S buku` )
- [Homebrew ](http://braumeister.org/formula/buku ) for OS X, or its Linux fork, [Linuxbrew ](https://github.com/Linuxbrew/linuxbrew/blob/master/Library/Formula/buku.rb )
2016-02-09 00:12:08 -06:00
2015-11-08 16:29:17 -06:00
# Usage
2016-05-23 04:02:46 -05:00
2016-03-25 13:47:51 -05:00
## Cmdline options
2016-05-23 04:02:46 -05:00
2016-05-17 21:48:27 -05:00
**NOTE:** If you are using `buku` v1.9 or below please refer to the installed man page or program help.
2016-04-29 13:09:39 -05:00
2016-05-22 18:36:41 -05:00
usage: buku [-a URL [tags ...]] [-u [N]] [-i path] [-d [N]]
2016-05-20 13:26:01 -05:00
[--url keyword] [--tag [...]] [-t [...]] [-c [...]]
2016-05-18 12:23:08 -05:00
[-s keyword [...]] [-S keyword [...]] [--st [...]]
2016-04-29 13:09:39 -05:00
[-k [N]] [-l [N]] [-p [N]] [-f N]
2016-05-20 13:26:01 -05:00
[-r oldtag [newtag ...]] [-j] [-o N] [-z] [-h]
2016-03-20 14:53:57 -05:00
2016-05-12 04:00:02 -05:00
A private command-line bookmark manager. Your mini web!
2016-02-28 08:11:27 -06:00
2016-04-29 13:09:39 -05:00
general options:
-a, --add URL [tags ...]
2016-05-18 22:24:46 -05:00
bookmark URL with comma-separated tags
2016-05-20 13:26:01 -05:00
-u, --update [N] update fields of bookmark at DB index N
2016-04-29 13:09:39 -05:00
refresh all titles, if no arguments
2016-05-20 13:26:01 -05:00
refresh title of bookmark at N, if only
2016-05-21 12:29:41 -05:00
N is specified without any edit options
2016-05-20 13:26:01 -05:00
-d, --delete [N] delete bookmark at DB index N
delete all bookmarks, if no arguments
2016-05-22 18:36:41 -05:00
-i, --import path import bookmarks from html file; Firefox,
Google Chrome and IE formats supported
2016-05-21 12:29:41 -05:00
-h, --help show this information
edit options:
2016-05-21 08:15:56 -05:00
--url keyword specify url, works with -u only
2016-05-21 02:13:34 -05:00
--tag [...] set comma-separated tags, works with -a, -u
2016-05-23 01:41:42 -05:00
clears tags, if no arguments
2016-04-29 13:09:39 -05:00
-t, --title [...] manually set title, works with -a, -u
2016-05-20 13:26:01 -05:00
if no arguments:
-a: do not set title, -u: clear title
2016-05-17 15:11:31 -05:00
-c, --comment [...] description of the bookmark, works with
-a, -u; clears comment, if no arguments
2016-04-29 13:09:39 -05:00
search options:
-s, --sany keyword [...]
search bookmarks for ANY matching keyword
-S, --sall keyword [...]
search bookmarks with ALL keywords
2016-05-18 12:23:08 -05:00
special keyword -
2016-04-29 13:09:39 -05:00
"blank": list entries with empty title/tag
2016-05-18 12:23:08 -05:00
--st, --stag [...] search bookmarks by tag
list all tags alphabetically, if no arguments
2016-04-29 13:09:39 -05:00
encryption options:
-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
power toys:
-p, --print [N] show details of bookmark at DB index N
show all bookmarks, if no arguments
-f, --format N modify -p output
N=1: show only URL, N=2: show URL and tag
-r, --replace oldtag [newtag ...]
2016-05-23 01:41:42 -05:00
replace oldtag with newtag everywhere
2016-04-29 13:09:39 -05:00
delete oldtag, if no newtag
2016-05-23 01:41:42 -05:00
-j, --json Json formatted output for -p, -s, -S, --st
2016-05-28 08:36:09 -05:00
--noprompt do not show the prompt, run and exit
2016-05-15 01:03:02 -05:00
-o, --open N open bookmark at DB index N in web browser
2016-04-29 13:09:39 -05:00
-z, --debug show debug information and additional logs
prompt keys:
1-N open the Nth search result in web browser
2016-05-24 11:09:59 -05:00
double Enter exit buku
2016-02-28 05:08:04 -06:00
2016-02-28 08:11:27 -06:00
## Operational notes
2016-05-23 04:02:46 -05:00
2016-04-24 09:37:51 -05:00
- The SQLite3 database file is stored in:
- **$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
2016-04-30 23:37:16 -05:00
- the **current directory** .
2016-05-23 04:02:46 -05:00
- Before version 1.9, buku stored its database in $HOME/.cache/buku/bookmarks.db. If the file exists, buku automatically moves it to new location.
- It's advisable to copy URLs directly from the browser address bar, i.e., along with the leading `http://` or `https://` token. buku looks up title data (found within < title ></ title > tags of HTML) from the web ONLY for fully-formed HTTP(S) URLs.
2016-04-27 12:07: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-04-30 23:33:21 -05:00
- URLs are unique in DB. The same URL cannot be added twice. You can update tags and re-fetch title data.
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.
- If index number is passed without any other options (--url, --title, --tag and --comment), read the URL from DB and update title from web.
2016-05-23 04:02:46 -05:00
- **Search** works in mysterious ways:
2016-04-19 14:08:39 -05:00
- Case-insensitive.
2016-04-19 13:32:28 -05:00
- Substrings match (`match` matches `rematched` ) for URL, title and tags.
2016-05-23 01:33:57 -05:00
- -s : match any of the keywords in URL, title or tags.
- -S : match all the keywords in URL, title or tags.
- --st : search bookmarks by tag, or show all tags alphabetically.
2016-05-17 21:48:27 -05:00
- You can search bookmarks by tag (see [examples ](#examples )).
2016-04-30 23:33:21 -05:00
- Search results are indexed serially. This index is different from actual database index of a bookmark record which is shown within `[]` after the URL.
2016-05-17 03:19:50 -05:00
- Auto DB compaction: when a record is deleted, the last record is moved to the index.
2016-05-23 04:02:46 -05:00
- **Encryption** is optional and manual. AES256 algorithm is used. If you choose 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* .
2016-02-28 05:08:04 -06:00
2015-11-08 16:32:12 -06:00
# Examples
2016-05-23 04:02:46 -05:00
2016-05-17 15:11:31 -05:00
1. **Add** a bookmark with **tags** `linux news` and `open source` , **comment** `Informative website on Linux and open source` , **fetch page title** from the web:
2016-04-21 10:29:32 -05:00
2016-05-20 13:26:01 -05:00
$ buku -a https://tuxdiary.com linux news, open source -c Informative website on Linux and open source
Title: [TuxDiary – Linux, open source, command-line, leisure.]
Added at index 336
336. https://tuxdiary.com
> TuxDiary – Linux, open source, command-line, leisure.
+ Informative website on Linux and open source
# linux news,open source
where, >: title, +: comment, #: tags
2016-04-30 23:33:21 -05:00
2. **Add** a bookmark with tags `linux news` and `open source` & **custom title** `Linux magazine` :
2016-02-28 08:32:10 -06:00
2016-04-30 23:33:21 -05:00
$ buku -a http://tuxdiary.com linux news, open source -t 'Linux magazine'
2016-02-28 08:32:10 -06:00
Added at index 15012014
2016-04-30 23:33:21 -05:00
Note that URL must precede tags.
3. **Add** a bookmark **without a title** (works for update too):
2016-02-28 08:32:10 -06:00
2016-04-30 23:33:21 -05:00
$ buku -a http://tuxdiary.com linux news, open source -t
2016-05-20 13:26:01 -05:00
4. **Update** existing bookmark at index 15012014 with new URL, tags and comments, fetch title from the web:
$ buku -u 15012014 --url http://tuxdiary.com/ --tag linux news, open source, magazine -c site for Linux utilities
2016-05-20 13:46:44 -05:00
5. **Fetch and update only title** for bookmark at 15012014:
2016-05-20 13:26:01 -05:00
$ buku -u 15012014
2016-05-20 13:46:44 -05:00
6. **Update only comment** for bookmark at 15012014:
2016-05-20 13:26:01 -05:00
$ buku -u 15012014 -c this is a new comment
Applies to --url, --title and --tag too.
2016-05-22 18:36:41 -05:00
7. Import bookmarks:
$ buku -i bookmarks.html
HTML exports from Firefox, Google Chrome and IE are supported.
8. **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
Applies to --title and --tag too. URL cannot be deleted without deleting the bookmark.
2016-05-22 18:36:41 -05:00
9. **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-05-20 13:26:01 -05:00
This operation does not modify the indexes, URLs, tags or comments. Only title is refreshed if fetched title is non-empty.
2016-05-22 18:36:41 -05:00
10. **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
The last index is moved to the deleted index to keep the DB compact.
2016-05-22 18:36:41 -05:00
11. **Delete all** bookmarks:
2016-02-28 08:32:10 -06:00
2016-04-30 23:33:21 -05:00
$ buku -d
2016-05-22 18:36:41 -05:00
12. **Search** bookmarks for **ANY** of the keywords `kernel` and `debugging` in URL, title or tags:
2016-02-28 08:32:10 -06:00
$ buku -s kernel debugging
2016-05-22 18:36:41 -05:00
13. **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
2016-05-22 18:36:41 -05:00
14. **Search** bookmarks with **tag** `general kernel concepts` :
2016-04-19 12:30:06 -05:00
2016-05-18 11:06:54 -05:00
$ buku --st general kernel concepts
2016-04-30 23:33:21 -05:00
Note the commas (,) before and after the tag. Comma is the tag delimiter in DB.
2016-05-22 18:36:41 -05:00
15. List **all unique tags** alphabetically:
2016-05-01 03:43:26 -05:00
2016-05-18 12:23:08 -05:00
$ buku --st
2016-05-22 18:36:41 -05:00
16. **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
2016-05-01 03:55:32 -05:00
The same number of iterations must be used for one lock & unlock instance. Default is 8.
2016-05-22 18:36:41 -05:00
17. **Show details** of bookmark at index 15012014:
2016-05-01 03:43:26 -05:00
$ buku -p 15012014
2016-05-22 18:36:41 -05:00
18. **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
2016-05-22 18:36:41 -05:00
19. **Replace tag** 'old tag' with 'new tag':
2016-05-01 03:43:26 -05:00
$ buku -r 'old tag' new tag
2016-05-22 18:36:41 -05:00
20. **Delete tag** 'old tag' from DB:
2016-05-01 03:43:26 -05:00
$ buku -r 'old tag'
2016-05-22 18:36:41 -05:00
21. **Open URL** at index 15012014 in browser:
2016-05-01 03:43:26 -05:00
$ buku -o 15012014
2016-05-23 01:21:29 -05:00
22. To 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
2016-05-23 01:21:29 -05:00
23. More **help** :
2016-02-28 08:32:10 -06:00
2016-05-23 01:21:29 -05:00
$ buku
$ man buku
2015-11-08 16:04:49 -06:00
2015-11-10 00:34:37 -06:00
# Contributions
2016-05-23 04:02:46 -05:00
2016-05-02 10:16:33 -05:00
Pull requests are welcome. Please visit [#14 ](https://github.com/jarun/Buku/issues/14 ) for a list of TODOs.
2015-11-10 00:34:37 -06:00
2016-02-28 05:08:04 -06:00
# Developers
2016-05-23 04:02:46 -05:00
2016-02-01 08:46:26 -06:00
[Arun Prakash Jana ](mailto:engineerarun@gmail.com )
2016-02-28 05:08:04 -06:00
Special thanks to the community for valuable suggestions and ideas.