summaryrefslogtreecommitdiffstats
path: root/buku.1
blob: b42bc33287c3899f23f8ca20ae796c6d62989876 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
.TH "BUKU" "1" "31 Jan 2020" "Version 4.3" "User Commands"
.SH NAME
buku \- Bookmark manager like a text-based mini-web
.SH SYNOPSIS
.B buku [OPTIONS] [KEYWORD [KEYWORD ...]]
.SH DESCRIPTION
.B buku
is a command-line utility to store, tag, search and organize bookmarks.
.PP
.B Features
.PP
  * Store bookmarks with auto-fetched title, tags and description
  * Auto-import from Firefox, Google Chrome and Chromium
  * Open bookmarks and search results in browser
  * Shorten, expand URLs, browse cached page from Wayback Machine
  * Text editor integration
  * Lightweight, clean interface, custom colors
  * Powerful search options (regex, substring...)
  * Continuous search with on the fly mode switch
  * Portable, merge-able database to sync between systems
  * Import/export bookmarks from/to HTML, Markdown or Orgfile
  * Smart tag management using redirection (>>, >, <<)
  * Multithreaded full DB refresh, manual encryption support
  * Shell completion scripts, man page with handy examples
.SH OPERATIONAL NOTES
.PP
.IP 1. 4
The database file is stored in:
  - \fI$XDG_DATA_HOME/buku/bookmarks.db\fR, if XDG_DATA_HOME is defined (first preference), or
  - \fI$HOME/.local/share/buku/bookmarks.db\fR, if HOME is defined (second preference), or
  - \fI%APPDATA%\\buku\\bookmarks.db\fR, if you are on Windows, or
  - the current directory.
.PP
.IP 2. 4
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 ('/").
.PP
.IP 3. 4
URLs are unique in DB. The same URL cannot be added twice.
.PP
.IP 4. 4
Bookmarks with immutable titles are listed with '(L)' after the title.
.PP
.IP 5. 4
\fBTags\fR:
  - 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.
  - Page keywords having a word to comma ratio > 3 are appended to description rather than tags.
  - Parent folder (and subfolder) names are converted to all-lowercase tags during bookmarks HTML import.
  - Releases prior to 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 \fBbuku --fixtags\fR once.
  - Tags can be edited from the prompt very easily using '>>' (append), '>' (overwrite) and '<<' (remove) symbols. The LHS of the operands denotes the indices and ranges of tags to apply (as listed by --tag or key 't' at prompt) and the RHS denotes the actual DB indices and ranges of the bookmarks to apply the change to.
.PP
.IP 6. 4
\fBUpdate\fR operation:
  - 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. Description is updated (if --comment is omitted). Tags remain untouched.
  - If indices are passed without any other options (--url, --title, --tag, --comment and --immutable), read the URLs from DB and update titles, description and append tags from web. Bookmarks marked immutable are skipped.
  - Can update bookmarks matching a search, when combined with any of the search options and no arguments to update are passed.
.PP
.IP 7. 4
\fBDelete\fR operation:
  - When a record is deleted, the last record is moved to the index.
  - 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.
  - Can delete bookmarks matching a search, when combined with any of the search options and no arguments to delete are passed.
.PP
.IP 8. 4
\fBSearch\fR works in mysterious ways:
  - Case-insensitive.
  - Matches words in URL, title and tags.
  - --sany : match any of the keywords in URL, title or tags. Default search option.
  - --sall : match all the keywords in URL, title or tags.
  - --deep : match \fBsubstrings\fR (`match` matches `rematched`) in URL, title and tags.
  - --sreg : match a regular expression (ignores --deep).
  - --stag : search bookmarks by tags, or list all tags alphabetically with usage count (if no arguments). Delimit the list of tags in the query with `,` to search for bookmarks that match ANY of the listed tags. Delimit tags with `+` to search for bookmarks that match ALL of the listed tags. Note that `,` and `+` cannot be used together in the same search. Exclude bookmarks matching certain tags from the results by using ` - ` followed by the tags. Note that the ` - ` operator and the ` + ` delimiter must be space separated: ` - ` instead of `-` and ` + ` instead of `+`. This is to distinguish them from hyphenated tags (e.g., `some-tag-name`) and tags with '+'s (e.g., `some+tag+name`).
  - Search for keywords along with tag filtering is possible. Two searches are issued (one for keywords and another for tags) and the intersection of the 2 sets is returned as the resultset.
  - Search results are indexed incrementally. This index is different from actual database index of a bookmark record which is shown within '[]' after the title.
  - Results for \fIany\fR keyword matches are ordered by the number of keyword matches - results matching more keywords (\fImatch score\fR) will appear earlier in the list. Results having the same number of matches will be ranked by their record DB index. If only one keyword is searched, results will be ordered by DB index, since all matching records will have the same \fImatch score\fR.
.PP
.IP 9. 4
\fBImport\fR:
  - Auto-import looks in the default installation path and default user profile.
  - URLs starting with `place:`, `file://` and `apt:` are ignored during import.
  - Parent folder (and subfolder) names are automatically imported as tags if --tacit is used.
  - Tags are merged even if bookmark URL exists when --tacit is used.
.PP
.IP 10. 4
\fBEncryption\fR is optional and manual. AES256 algorithm is used. To use encryption, the database file should be unlocked (-k) before using \fBbuku\fR 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 \fBunencrypted on creation\fR.
.PP
.IP 11. 4
\fBEditor\fR support:
  - 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 precedence. 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.
.PP
.IP 12. 4
\fBProxy\fR support: please refer to the \fBENVIRONMENT\fR section.
.PP
.IP 13. 4
\fBAlternative DB file\fR:
  - The option --db (to specify an alternative database file location) is app-only. Manual usage is prone to issues arising from human error.
.SH GENERAL OPTIONS
.TP
.BI \-a " " \--add " URL [tag, ...]"
Bookmark
.I URL
along with comma-separated tags. A tag can have multiple words.
.TP
.BI \-u " " \--update " [...]"
Update fields of the bookmarks at specified indices in DB. If no arguments are specified, all titles and descriptions are refreshed from the web. Tags remain untouched. Works with update modifiers for the fields url, title, tag and comment. If only indices are passed without any edit options, titles and descriptions are fetched and updated (if not empty). Accepts hyphenated ranges and space-separated indices. Updates search results when used with search options, if no arguments.
.TP
.BI \-w " " \--write " [editor|index]"
Edit a bookmark in
.I editor
before adding it. To edit and update an existing bookmark, the
.I index
should be passed. However, in this case the environment variable EDITOR must be set. The last record is opened in EDITOR if index=-1.
.TP
.BI \-d " " \--delete " [...]"
Delete bookmarks. Accepts space-separated list of indices (e.g. 5 6 23 4 110 45) or a single hyphenated range (e.g. 100-200). Note that range and list don't work together. Deletes search results when combined with search options, if no arguments.
.TP
.BI \-v " " \--version
Show program version and exit.
.TP
.BI \-h " " \--help
Show program help and exit.
.SH EDIT OPTIONS
.TP
.BI \--url " [...]"
Specify the URL, works with --update only. Fetches and updates title if --title is not used.
.TP
.BI \--tag " [+|-] [...]"
Specify comma separated tags, works with --add, --update. Clears the tags, if no arguments passed. Appends or deletes tags, if list of tags is preceded by '+' or '-' respectively.
.TP
.BI \--title " [...]"
Manually specify the title, works with --add, --update. Omits or clears the title, if no arguments passed.
.TP
.BI \-c " " \--comment " [...]"
Add notes or description of the bookmark, works with --add, --update. Clears the comment, if no arguments passed.
.TP
.BI \--immutable " N"
Set the title, description and tags of a bookmark immutable during autorefresh. Works with --add, --update. N=1 sets the immutable flag, N=0 removes it. If omitted, bookmarks are added with N=0.
.SH SEARCH OPTIONS
.TP
.BI \-s " " \--sany " keyword [...]"
Search bookmarks with ANY of the keyword(s) in URL, title or tags and show the results. Prompts to enter result number to open in browser. Note that the sequential result index is not the DB index. The DB index is shown within '[]' after the title.
.br
This is the default search option for positional arguments if no other search option is specified.
.TP
.BI \-S " " \--sall " keyword [...]"
Search bookmarks with ALL keywords in URL, title or tags and show the results. Behaviour same as --sany.
.br
Special keywords:
.br
"blank": list entries with empty title/tag
.br
"immutable": list entries with locked title
.br
NOTE: To search the keywords, use --sany
.TP
.BI \--deep
Search modifier to match substrings. Works with --sany, --sall.
.TP
.BI \-r " " \--sreg " expression"
Scan for a regular expression match.
.TP
.BI \-t " " \--stag " [tag [,|+] ...] [\- tag, ...]"
Search bookmarks by tags.
.br
Use ',' delimiter to find entries matching ANY of the tags
.br
Use ' + ' delimiter to find entries matching ALL of the tags. (Note that the ' + ' delimiter must be space separated)
.br
NOTE: Cannot combine ',' and '+' in the same search
.br
Use ' - ' to exclude bookmarks that match the tags that follow. (Note that the '-' operator must be space separated).
.br
List all tags alphabetically, if no arguments. The usage count (number of bookmarks having the tag) is shown within first brackets.
.TP
.BI \-x " " \--exclude " keyword [...]"
Exclude bookmarks matching the specified keywords. Works with --sany, --sall, --sreg and --stag.
.SH ENCRYPTION OPTIONS
.TP
.BI \-l " " \--lock " [N]"
Encrypt (lock) the DB file with
.I N
(> 0, default 8) hash passes to generate key.
.TP
.BI \-k " " \--unlock " [N]"
Decrypt (unlock) the DB file with
.I N
(> 0, default 8) hash passes to generate key.
.SH POWER OPTIONS
.TP
.BI \--ai
Auto-import bookmarks from Firefox, Google Chrome and Chromium browsers.
.TP
.BI \-e " " \--export " file"
Export bookmarks to Firefox bookmarks formatted HTML. Works with all search options.
.br
Markdown is used if
.I file
has extension '.md'. Markdown format: [title](url), 1 entry per line.
.br
Orgfile is used if
.I file
has extension '.org' Orgfile format: * [[url][title]], 1 entry per line.
.br
A buku database is generated if
.I file
has extension '.db'.
.TP
.BI \-i " " \--import " file"
Import bookmarks from Firefox bookmarks formatted HTML.
.I file
is considered Firefox-exported JSON if it has '.json' extension, Markdown (compliant with --export format) if it is '.md', Orgfile if the extension is '.org' or another buku database if the extension is '.db'.
.TP
.BI \-p " " \--print " [...]"
Show details (DB index, URL, title, tags and comment) of bookmark record by DB index. If no arguments, all records with actual index from DB are shown. Accepts hyphenated ranges and space-separated indices. A negative value (introduced for convenience) behaves like the tail utility, e.g., -n shows the details of the last n bookmarks.
.TP
.BI \-f " " \--format " N"
Show selective monochrome output with specific fields. Works with --print. Search results honour the option when used along with --json. Useful for creating batch scripts.
.br
.I N
= 1, show only URL.
.br
.I N
= 2, show URL and tags in a single line.
.br
.I N
= 3, show only title.
.br
.I N
= 4, show URL, title and tags in a single line.
.br
.I N
= 5, show title and tags in a single line.
.br
To omit DB index from printed results, use N0, e.g., 10, 20, 30, 40, 50.
.TP
.BI \-j " " \--json
Output data formatted as JSON, works with --print output and search results.
.TP
.BI \--colors " COLORS"
Set output colors. Refer to the \fBCOLORS\fR section below for details.
.TP
.BI \--nc
Disable color output in all messages. Useful on terminals which can't handle ANSI color codes or scripted environments.
.TP
.BI \-n " " \--count " N"
Number of results to show per page (default 10).
.TP
.BI \--np
Do not show the prompt, run and exit.
.TP
.BI \-o " " \--open " [...]"
Open bookmarks by DB indices or ranges in browser. Open a random index if argument is omitted.
.TP
.BI \--oa
Open all search results immediately in the browser. Works best with --np. When used along with --update or --delete, URLs are opened in the browser first and then modified or deleted.
.TP
.BI \--replace " old new"
Replace
.I old
tag with
.I new
tag if both are passed; delete
.I old
tag if
.I new
tag is not specified.
.TP
.BI \--shorten " index|URL"
Shorten the URL at DB
.I index
or an independent
.I URL
using the tny.im URL shortener service.
.TP
.BI \--expand " index|URL"
Expand the URL at DB
.I index
or an independent
.I URL
shortened using tny.im.
.TP
.BI \--cached " index|URL"
Browse the latest cached version of the URL at DB
.I index
or an independent
.I URL
using the Wayback Machine. Useful for viewing the content of bookmarks which are not live any more.
.TP
.BI \--suggest
Show a list of similar tags to choose from when adding a new bookmark.
.TP
.BI \--tacit
Show lesser output. Reduces the verbosity of certain operations like add, update etc.
.TP
.BI \--threads
Maximum number of parallel network connection threads to use during full DB refresh. By default 4 connections are spawned.
.I N
can range from 1 to 10.
.TP
.BI \-V
Check the latest upstream version available. This is FYI. It is possible the latest upstream released version is still not available in your package manager as the process takes a while.
.TP
.BI \-z " " \--debug
Show debug information and additional logs.
.SH PROMPT KEYS
.TP
.BI "1-N"
Browse search results by indices and ranges.
.TP
.BI "O" " [id|range [...]]"
Try to open search results or indices (when not in a search context) in a GUI browser. Toggle try to open urls in a GUI based browser (even if BROWSER is set) if no arguments. Toggling is useful when trying to open bookmarks by DB index.
.TP
.BI "a"
Open all search results in browser.
.TP
.BI "s" " keyword [...]"
Search for records with ANY keyword.
.TP
.BI "S" " keyword [...]"
Search for records with ALL keywords.
.TP
.BI "d"
Toggle deep search to match substrings ('pen' matches 'opened').
.TP
.BI "r" " expression"
Run a regular expression search.
.TP
.BI "t" " [...]"
Search bookmarks by a tag. List all tags alphabetically, if no arguments.
.TP
.BI "g" " taglist id|range [...] [>>|>|<<] [record id|range ...]"
Append, set, remove specific or all tags by indices and/or ranges to bookmark indices and/or ranges (see \fBEXAMPLES\fR section below). Search by space-separated taglist id(s) an