-
-
Notifications
You must be signed in to change notification settings - Fork 294
/
buku.1
987 lines (984 loc) · 31.4 KB
/
buku.1
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
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
.TH "BUKU" "1" "07 Apr 2024" "Version 4.9" "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, Chromium, Vivaldi, and MS Edge
* Open bookmarks and search results in browser
* Shorten, expand URLs
* Browse cached page from the 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, XBEL, Markdown, RSS 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.
- Additionally, --swap allows to modify records order (standalone operation).
.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, description or tags. Default search option.
- --sall : match all the keywords in URL, title, description or tags.
- --deep : match \fBsubstrings\fR (`match` matches `rematched`) in URL, title, description and tags.
- --markers : match each keyword to a \fBspecific\fR field, depending on its prefix.
- --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.
- Sorting order can be specified (for matches with same amount of matched keywords, if relevant). This option also works with regular printing/export.
.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.
- JSON files exported from browser can be imported. Export to JSON is not supported.
.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.
- Note that this option is useful if you want to store the db file in cloud synced location. Another mechanism could be to have the db file synced and create a symlink to it at the default location.
.SH GENERAL OPTIONS
.TP
.BI \-a " " \--add " URL [+|-] [tag, ...]"
Bookmark
.I URL
along with comma-separated tags. A tag can have multiple words. (These tags \fBoverride\fR fetched tags, unless preceded with '+' or '-'.)
.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. 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.
.TP
.BI \--swap " N M"
Swap two records at specified indices. This is a standalone operation (cannot be invoked along with any other).
.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 \--markers
Search modifier to match specific fields based on (optional) prefix markers (i.e. beginning of the keyword):
- '.' : search in title
- '>' : search in description
- ':' : search in URL
- '#' : search in tags (comma-separated, \fBpartial\fR matches; not affected by --deep)
- '#,' : search in tags (comma-separated, \fBexact\fR matches; not affected by --deep)
- '*' : search in all fields (same as no prefix)
.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.
.TP
.BI \--random " [N]"
Output random bookmarks out of the selection (1 unless amount is specified).
.TP
.BI \--order " fields [...]"
Order printed/exported records by the given fields (from DB or JSON) and/or netloc. You can specify sort direction for each by prepending '+'/'-' (default is '+').
.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, Chromium, Vivaldi, and Edge browsers. (Firefox profile can be specified using environment variable FIREFOX_PROFILE.)
.TP
.BI \-e " " \--export " file"
Export bookmarks to Firefox bookmarks formatted HTML. Works with all search options.
.br
XBEL is used if
.I file
has extension '.xbel'.
.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
RSS is used if
.I file
has extension '.rss' RSS format: <entry> per bookmark with <title>, <link>, <category>, <content> elements
.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, XBEL if it is '.xbel', Markdown (compliant with --export format) if it is '.md', Orgfile if the extension is '.org', RSS if the extension is '.rss' 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 \--url-redirect
when fetching an URL, use the resulting URL from following \fBpermanent\fR redirects (when combined with --export, the old URL is included as additional metadata).
.TP
.BI \--tag-redirect " [tag]"
when fetching an URL that causes permanent redirect, add a
.I tag
in specified pattern (using 'http:{}' if not specified).
.TP
.BI \--tag-error " [tag]"
when fetching an URL that causes an HTTP error, add a
.I tag
in specified pattern (using 'http:{}' if not specified).
.TP
.BI \--del-error " [...]"
when fetching an URL causes any (given) HTTP error, delete/do not add it. (Use a parameter like '404' or '400-404,500')
.TP
.BI \--export-on " [...]"
export records affected by the above options, including removed info (requires --update and --export; specific HTTP response filter can be provided).
.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 \--offline
Add a bookmark without connecting to the web.
.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 \--nostdin
Do not attempt to read data from standard input e.g. when the program is not executed from a tty.
.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 \-g " " \--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) and/or range if records are omitted.
.TP
.BI "o" " id|range [...]"
Browse bookmarks by indices and/or ranges.
.TP
.BI "p" " id|range [...]"
Print bookmarks by indices and/or ranges.
.TP
.BI "w" " [editor|id]"
Edit and add or update a bookmark.
.TP
.BI "c id"
Copy url at search result index to clipboard.
.TP
.BI "?"
Show help on prompt keys.
.TP
.BI "q, ^D, double Enter"
Exit buku.
.SH ENVIRONMENT
.TP
.BI "Completion scripts"
Shell completion scripts for Bash, Fish and Zsh can be found in:
.br
.I https://github.com/jarun/buku/blob/master/auto-completion
.TP
.BI BROWSER
Overrides the default browser. Refer to:
.br
.I http://docs.python.org/library/webbrowser.html
.TP
.BI EDITOR
If defined, will be used as the editor to edit bookmarks with option --write.
.TP
.BI https_proxy
If defined, will be used to access http and https resources through the configured proxy. Supported format:
.br
http[s]://[username:password@]proxyhost:proxyport/
.TP
.BI "GUI integration"
.B buku
can be integrated in a GUI environment with simple tweaks. Please refer to:
.br
.I https://github.com/jarun/buku/wiki/System-integration
.SH COLORS
\fBbuku\fR allows you to customize the color scheme via a five-letter string, reminiscent of BSD \fBLSCOLORS\fR. The five letters represent the colors of
.IP - 2
index
.PD 0 \" Change paragraph spacing to 0 in the list
.IP - 2
title
.IP - 2
URL
.IP - 2
description/comment/note
.IP - 2
tag
.PD 1 \" Restore paragraph spacing
.TP
respectively. The five-letter string is passed is as the argument to the \fB--colors\fR option, or as the value of the environment variable \fBBUKU_COLORS\fR.
.TP
We offer the following colors/styles:
.TS
tab(;) box;
l|l
-|-
l|l.
Letter;Color/Style
a;black
b;red
c;green
d;yellow
e;blue
f;magenta
g;cyan
h;white
i;bright black
j;bright red
k;bright green
l;bright yellow
m;bright blue
n;bright magenta
o;bright cyan
p;bright white
A-H;bold version of the lowercase-letter color
I-P;bold version of the lowercase-letter bright color
x;normal
X;bold
y;reverse video
Y;bold reverse video
.TE
.TP
.TP
The default colors string is \fIoKlxm\fR, which stands for
.IP - 2
bright cyan index
.PD 0 \" Change paragraph spacing to 0 in the list
.IP - 2
bold bright green title
.IP - 2
bright yellow URL
.IP - 2
normal description
.IP - 2
bright blue tag
.PD 1 \" Restore paragraph spacing
.TP
Note that
.IP - 2
Bright colors (implemented as \\x1b[90m - \\x1b[97m) may not be available in all color-capable terminal emulators;
.IP - 2
Some terminal emulators draw bold text in bright colors instead;
.IP - 2
Some terminal emulators only distinguish between bold and bright colors via a default-off switch.
.TP
Please consult the manual of your terminal emulator as well as \fIhttps://en.wikipedia.org/wiki/ANSI_escape_code\fR for details.
.SH EXAMPLES
.PP
.IP 1. 4
\fBEdit and add\fR a bookmark from editor:
.PP
.EX
.IP
.B buku -w
.br
.B buku -w 'gedit -w'
.br
.B buku -w 'macvim -f' -a https://ddg.gg search engine, privacy
.EE
.PP
.IP "" 4
The first command picks editor from the environment variable \fIEDITOR\fR. The second command opens gedit in blocking mode. The third command opens macvim with option -f and the URL and tags populated in template.
.PP
.IP 2. 4
\fBAdd\fR a simple bookmark:
.PP
.EX
.IP
.B buku --no-stdin -a https://github.com/
.EE
.PP
.IP "" 4
In the output, >: url, +: comment, #: tags.
.PP
.IP 3. 4
\fBAdd\fR a bookmark with \fBtags\fR 'search engine' and 'privacy', \fBcomment\fR 'Search engine with perks', \fBfetch page title\fR from the web:
.PP
.EX
.IP
.B buku -a https://ddg.gg search engine, privacy -c Search engine with perks
.EE
.PP
.IP "" 4
In the output, >: url, +: comment, #: tags.
.PP
.IP 4. 4
\fBAdd\fR a bookmark with tags 'search engine' & 'privacy' and \fBimmutable custom title\fR 'DDG':
.PP
.EX
.IP
.B buku -a https://ddg.gg search engine, privacy --title 'DDG' --immutable 1
.EE
.PP
.IP "" 4
Note that URL must precede tags.
.PP
.IP 5. 4
\fBAdd\fR a bookmark \fBwithout a title\fR (works for update too):
.PP
.EX
.IP
.B buku -a https://ddg.gg search engine, privacy --title
.EE
.PP
.IP 6. 4
\fBEdit and update\fR a bookmark from editor:
.PP
.EX
.IP
.B buku -w 15012014
.EE
.PP
.IP "" 4
This will open the existing bookmark's details in the editor for modifications. Environment variable \fIEDITOR\fR must be set.
.PP
.IP 7. 4
\fBUpdate\fR existing bookmark at index 15012014 with new URL, tags and comments, fetch title from the web:
.PP
.EX
.IP
.B buku -u 15012014 --url http://ddg.gg/ --tag web search, utilities -c Private search engine
.EE
.PP
.IP 8. 4
\fBFetch and update only title\fR for bookmark at 15012014:
.PP
.EX
.IP
.B buku -u 15012014
.EE
.PP
.IP 9. 4
\fBUpdate only comment\fR for bookmark at 15012014:
.PP
.EX
.IP
.B buku -u 15012014 -c this is a new comment
.EE
.PP
.IP "" 4
Applies to --url, --title and --tag too.
.PP
.IP 10. 4
\fBExport\fR bookmarks tagged 'tag 1' or 'tag 2' to HTML, XBEL, Markdown, Orgfile or a new database:
.PP
.EX
.IP
.B buku -e bookmarks.html --stag tag 1, tag 2
.br
.B buku -e bookmarks.xbel --stag tag 1, tag 2
.br
.B buku -e bookmarks.md --stag tag 1, tag 2
.br
.B buku -e bookmarks.org --stag tag 1, tag 2
.br
.B buku -e bookmarks.db --stag tag 1, tag 2
.EE
.PP
.IP "" 4
All bookmarks are exported if search is not opted.
.PP
.IP 11. 4
\fBImport\fR bookmarks from HTML, XBEL, Markdown or Orgfile:
.PP
.EX
.IP
.B buku -i bookmarks.html
.br
.B buku -i bookmarks.xbel
.br
.B buku -i bookmarks.md
.br
.B buku -i bookmarks.db
.EE
.PP
.IP 12. 4
\fBDelete only comment\fR for bookmark at 15012014:
.PP
.EX
.IP
.B buku -u 15012014 -c
.EE
.PP
.IP "" 4
Applies to --title and --tag too. URL cannot be deleted without deleting the bookmark.
.PP
.IP 13. 4
\fBUpdate\fR or refresh \fBfull DB\fR with page titles from the web:
.PP
.EX
.IP
.B buku -u
.br
.B buku -u --tacit (show only failures and exceptions)
.EE
.PP
.IP "" 4
This operation can update the title or description fields of non-immutable bookmarks by parsing the fetched page. Fields are updated only if the fetched fields are non-empty. Tags remain untouched.
.PP
.IP 14. 4
\fBDelete\fR bookmark at index 15012014:
.PP
.EX
.IP
.B buku -d 15012014
.EE
.PP
.IP "" 4
The last index is moved to the deleted index to keep the DB compact. Add --tacit to delete without confirmation.
.PP
.IP 15. 4
\fBDelete all\fR bookmarks:
.PP
.EX
.IP
.B buku -d
.EE
.PP
.IP 16. 4
\fBDelete\fR a \fBrange or list\fR of bookmarks:
.PP
.EX
.IP
.B buku -d 100-200
.br
.B buku -d 100 15 200
.EE
.PP
.IP 17. 4
\fBSearch\fR bookmarks for \fBANY\fR of the keywords 'kernel' and 'debugging' in URL, title or tags:
.PP
.EX
.IP
.B buku kernel debugging
.br
.B buku -s kernel debugging
.EE
.PP
.IP 18. 4
\fBSearch\fR bookmarks with \fBALL\fR the keywords 'kernel' and 'debugging' in URL, title or tags:
.PP
.EX
.IP
.B buku -S kernel debugging
.EE
.PP
.IP 19. 4
\fBSearch\fR bookmarks \fBtagged\fR 'general kernel concepts':
.PP
.EX
.IP
.B buku --stag general kernel concepts
.EE
.PP
.IP 20. 4
\fBSearch\fR for bookmarks matching \fBANY\fR of the tags 'kernel', 'debugging', 'general kernel concepts':
.PP
.EX
.IP
.B buku --stag kernel, debugging, general kernel concepts
.EE
.PP
.IP 21. 4
\fBSearch\fR for bookmarks matching \fBALL\fR of the tags 'kernel', 'debugging', 'general kernel concepts':
.PP
.EX
.IP
.B buku --stag kernel + debugging + general kernel concepts
.EE
.PP
.IP 22. 4
\fBSearch\fR for bookmarks matching any of the keywords 'hello' or 'world', excluding the keywords 'real' and 'life', matching both the tags 'kernel' and 'debugging', but \fBexcluding\fR the tags 'general kernel concepts' and 'books':
.PP
.EX
.IP
.B buku hello world --exclude real life --stag 'kernel + debugging - general kernel concepts, books'
.EE
.PP
.IP 23. 4
\fBSearch\fR for bookmarks with different tokens for each field, and print them out sorted by the tags (ascending) and URL (descending)
.PP
.EX
.IP
.B buku --order +tags,-url --markers --sall 'global substring' '.title substring' ':url substring' :https '> description substring' '#partial,tags:' '#,exact,tags' '*another global substring'
.EE
.PP
.IP 24. 4
List \fBall unique tags\fR alphabetically:
.PP
.EX
.IP
.B buku --stag
.EE
.PP
.IP 25. 4
Run a \fBsearch and update\fR the results:
.PP
.EX
.IP
.B buku -s kernel debugging -u --tag + linux kernel
.EE
.PP
.IP 26. 4
Run a \fBsearch and delete\fR the results:
.PP
.EX
.IP
.B buku -s kernel debugging -d
.EE
.PP
.IP 27. 4
\fBEncrypt or decrypt\fR DB with \fBcustom number of iterations\fR (15) to generate key:
.PP
.EX
.IP
.B buku -l 15
.br
.B buku -k 15
.EE
.PP
.IP "" 4
The same number of iterations must be specified for one lock & unlock instance. Default is 8, if omitted.
.PP
.IP 28. 4
\fBShow details\fR of bookmarks at index 15012014 and ranges 20-30, 40-50:
.PP
.EX
.IP
.B buku -p 20-30 15012014 40-50
.EE
.PP
.IP 29. 4
Show details of the \fBlast 10 bookmarks\fR:
.PP
.EX
.IP
.B buku -p -10
.EE
.PP
.IP 30. 4
\fBShow all\fR bookmarks with real index from database:
.PP
.EX
.IP
.B buku -p
.br
.B buku -p | more
.EE
.PP
.IP 31. 4
\fBReplace tag\fR 'old tag' with 'new tag':
.PP
.EX
.IP
.B buku --replace 'old tag' 'new tag'
.EE
.PP
.IP 32. 4
\fBDelete tag\fR 'old tag' from DB:
.PP
.EX
.IP
.B buku --replace 'old tag'
.EE
.PP
.IP 33. 4
\fBAppend (or delete) tags\fR 'tag 1', 'tag 2' to (or from) existing tags of bookmark at index 15012014:
.PP
.EX
.IP
.B buku -u 15012014 --tag + tag 1, tag 2
.br
.B buku -u 15012014 --tag - tag 1, tag 2
.EE
.PP
.IP 34. 4
\fBOpen URL\fR at index 15012014 in browser:
.PP
.EX
.IP
.B buku -o 15012014
.EE
.PP
.IP 35. 4
List bookmarks with \fBno title or tags\fR for bookkeeping:
.PP
.EX
.IP
.B buku -S blank
.EE
.PP
.IP 36. 4
List bookmarks with \fBimmutable title\fR:
.PP
.EX
.IP
.B buku -S immutable
.EE
.PP
.IP 37. 4
\fBShorten\fR the URL www.google.com and the URL at index 20:
.PP
.EX
.IP
.B buku --shorten www.google.com
.br
.B buku --shorten 20
.EE
.PP
.IP 38. 4
\fBAppend, remove tags at prompt\fR (taglist index to the left, bookmark index to the right):
.PP
.EX
.IP
// append tags at taglist indices 4 and 6-9 to existing tags in bookmarks at indices 5 and 2-3
.br
.B buku (? for help) g 4 9-6 >> 5 3-2
.br
// set tags at taglist indices 4 and 6-9 as tags in bookmarks at indices 5 and 2-3
.br
.B buku (? for help) g 4 9-6 > 5 3-2
.br
// remove all tags from bookmarks at indices 5 and 2-3
.br
.B buku (? for help) g > 5 3-2
.br
// remove tags at taglist indices 4 and 6-9 from tags in bookmarks at indices 5 and 2-3
.br
.B buku (? for help) g 4 9-6 << 5 3-2
.EE
.PP
.IP 39. 4
List bookmarks with \fBcolored output\fR:
.PP
.EX
.IP
.B $ buku --colors oKlxm -p
.EE
.PP
.IP 40. 4
Add a bookmark after following all permanent redirects, but only if the server doesn't respond with an error (and there's no network failure)
.PP
.EX
.IP
.B buku --add http://wikipedia.net --url-redirect --del-error
.br
2. Wikipedia
.br
> https://www.wikipedia.org/
.br
+ Wikipedia is a free online encyclopedia, created and edited by volunteers around the world and hosted by the Wikimedia Foundation.
.EE
.PP
.IP 41. 4
Add a bookmark with tag 'http redirect' if the server responds with a permanent redirect, or tag shaped like 'http 404' on an error response:
.PP
.EX
.IP
.B buku --add http://wikipedia.net/notfound --tag-redirect 'http redirect' --tag-error 'http {}'
.br
[ERROR] [404] Not Found
.br
3. Not Found
.br
> http://wikipedia.net/notfound
.br
# http 404,http redirect
.EE
.PP
.IP 42. 4
Update all bookmarks matching the search by updating the URL if the server responds with a permanent redirect, deleting the bookmark if the server responds with HTTP error 400, 401, 402, 403, 404 or 500, or adding a tag shaped like 'http:{}' in case of any other HTTP error; then export those affected by such changes into an HTML file, marking deleted records as well as old URLs for those replaced by redirect.
.PP
.EX
.IP
.B buku -S ://wikipedia.net -u --url-redirect --tag-error --del-error 400-404,500 --export-on --export backup.html
.EE
.PP
.IP 43. 4
Print out a single \fBrandom\fR bookmark:
.PP
.EX
.IP
.B buku --random
.EE
.PP
.IP 44. 4
Print out 3 \fBrandom\fR bookmarks \fBordered\fR by netloc (reversed), title and url:
.PP
.EX
.IP
.B buku --random 3 --order ,-netloc,title,+url
.EE
.PP
.IP 45. 4
Print out a single \fBrandom\fR bookmark matching \fBsearch\fR criteria, and \fBexport\fR into a Markdown file (in DB order):
.PP
.EX
.IP
.B buku --random -S kernel debugging --export random.md
.EE
.PP
.IP 46. 4
Swap positions of records #4 and #5:
.PP
.EX
.IP
.B buku --swap 4 5
.EE
.PP
.SH AUTHOR
Arun Prakash Jana <[email protected]>
.SH HOME
.I https://github.com/jarun/buku
.SH WIKI
.I https://github.com/jarun/buku/wiki
.SH REPORTING BUGS
.I https://github.com/jarun/buku/issues
.SH LICENSE
Copyright \(co 2015-2024 Arun Prakash Jana <[email protected]>.
.PP
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
.br
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.