如何在 Ubuntu 命令行下管理浏览器书签
命令行 书签
![](/data/attachment/album/201611/02/094421s6deeg2r9rdzog9r.jpg)


浏览器书签虽然不常被提及，但是作为互联网浏览的一部分。没有好的书签功能，网站链接可能会丢失，下次再不能访问。这就是为什么一个好的书签管理器很重要。


所有的现代浏览器都提供了一些形式的管理工具，虽然它们严格上来讲功能较少。如果你已经厌倦了这些内置在浏览器中的主流工具，你或许想要寻找一个替代品。这里介绍 **Buku**：一个命令行下的书签管理器。它不仅可以管理你的书签，还可以给它们加密，将它们保存在一个数据库中等等。下面是如何安装它。


### 安装


![](/data/attachment/album/201611/02/094438tpm80mq0w7sebaep.jpg)


Buku 不是非常流行。因此，用户需要自己编译它。然而，在 Ubuntu 上安装实际上很简单。打开终端并且使用 apt 安装`git` 和 `python3`，这两个工具在构建中很关键。



```
sudo apt python3-cryptography python3-bs4

```

装完所需的工具后，就可以拉取源码了。



```
git clone https://github.com/jarun/Buku/.
cd Buku

```

最后要安装它，只需要运行 `make` 命令。在这之后就可以在终端中输入 `buku`来运行 Buku 了。



```
sudo make install

```

**注意**：虽然这份指导针对的是 Ubuntu，但是 Buku 可以在任何 Linux 发行版中用相似的方法安装。


### 导入书签


![](/data/attachment/album/201611/02/094458nkwe67555255bxg4.jpg)


要将书签直接导入 Buku 中，首先从浏览器中将书签导出成一个 html 文件。接着，输入下面的命令：



```
buku -i bookmarks.html

```

最后，导入的书签会添加到 Buku 的数据库中。


### 导出书签


![](/data/attachment/album/201611/02/094517jo5u0o850ju585ob.jpg)


导出书签和导入一样简单。要导出所有的书签，使用下面的命令：



```
buku -e bookmarks.html

```

它会和其他书签管理器一样，将数据库中所有的书签导出成一个 html 文件。之后就可以用它做你任何要做的事情了！


### 打开书签


![](/data/attachment/album/201611/02/094544kart6a43ap0qapta.jpg)


要打开一个书签，首先要搜索。这需要用 `-s` 选项。运行下面的命令来搜索：



```
buku -s searchterm

```

接着一旦找到匹配的结果，输入旁边的数字，书签将会在默认的浏览器中打开了。


### 加密


不像其他的书签管理器，Buku 可以加密你的数据。这对拥有“敏感”书签的用户而言很有用的功能。要加密数据库，使用 `-l` 标志来创建一个密码。



```
buku -l

```

![](/data/attachment/album/201611/02/094609kn68aftb68yqwbby.jpg)


数据库加锁后，没有输入密码将不能打开书签。要解密它，使用 `-k` 选项。



```
buku -k

```

![](/data/attachment/album/201611/02/094631r4cqs3f7s755i3sz.jpg)


### 其他功能


这个书签管理器有许多不同的功能。要了解其他的功能，使用 `--help` 选项。当使用这个选项后，所有的选项以及每个功能详细内容都会列出来。这个非常有用，由于用户经常忘记东西，并且有时可以打开一个备忘单也不错。



```
buku --help

```

![](/data/attachment/album/201611/02/094657swxw5l5uw345zjwa.jpg)


### 总结


即使这个工具不是浏览器的一部分，它的功能比任何现在管理器提供的功能多。尽管事实是它在命令行中运行，但是也有很好的竞争力。书签对大部分人来言并不重要，但是哪些不喜欢现有选择以及喜欢 Linux 命令行的应该看一下 Buku。




---


via: <https://www.maketecheasier.com/manage-browser-bookmarks-ubuntu-command-line/>


作者：[Derrik Diener](https://www.maketecheasier.com/author/derrikdiener/) 译者：[geekpi](https://github.com/geekpi) 校对：[wxy](https://github.com/wxy)


本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译，[Linux中国](https://linux.cn/) 荣誉推出


OK
![](https://www.maketecheasier.com/assets/uploads/2016/10/buku-feature-image.jpg)

Browser bookmarks, though not discussed as often as they should be, are an integral part of browsing the Internet. Without good bookmark functionality, a website might be lost in time, and the ability to revisit it gone. That’s why it’s really important to have a good bookmark manager.

All modern web browsers offer up some form of management tool, though they seriously lack in features. If you’ve grown tired of these mainstream tools that have been packed into your browser, you might want to seek out an alternative. Introducing **Buku**: the command line-based bookmark manager. It has the ability to not only manage your bookmarks, but it can encrypt them, hold them in a database, and more. Here’s how to get going with it!

## Installation

Buku isn’t very popular. As a result, users will need to build it to use it. Still, installing it and getting it going on Ubuntu is a lot easier than it looks. Start by opening the terminal and using apt to install `git`

and `python3`

, as they are vital in building the software.

sudo apt python3-cryptography python3-bs4

After the needed tools are installed, the source code can be pulled down.

git clone https://github.com/jarun/Buku/. cd Buku

Finally, to install it, just run the make command. From here it is possible to launch Buku with buku in any terminal window

sudo make install

**Note**: though this guide focuses on Ubuntu, Buku can be built with similar directions on any Linux distribution.

## Importing Bookmarks

To import bookmarks directly into the manager, first export all bookmarks from your web browser to an html file. Then, enter the following command:

`buku -i bookmarks.html`

As a result, imported bookmarks will be added to the Buku bookmark database.

## Exporting Bookmarks

Exporting bookmarks is as simple as importing them into the database. To export all bookmarks, use this command:

`buku -e bookmarks.html`

The bookmark manager, like all others, will export all bookmarks loaded into the database to an HTML file on the system. After that, take your bookmarks and do with them what you will!

## Opening Bookmarks

To open a bookmark, first the user must search for it. This is done with the `-s`

flag. Run this to search:

`buku -s searchterm`

Then, once a bookmark matching the search has been found, enter the number next to it, and the bookmark will open in the default web browser.

## Encryption

Unlike other bookmark managers, Buku can actually encrypt your data. This is especially handy for users who have “sensitive” bookmarks. To encrypt the database, use the `-l`

flag to create a password.

`buku -l`

With the database locked, it will not be possible to access bookmarks without entering the password to decrypt it. To decrypt, use the -k flag.

`buku -k`

## Other features

This bookmark manger is stuffed with many different features. To read about how to use any of the other features, use the `--help`

switch. When this switch is used, every command switch and flag will be listed, and each feature outlined in detail. This comes in handy, as often users forget things, and it’s nice to be able to pull out a cheat-sheet sometimes.

`buku --help`

## Conclusion

Even though this tool isn’t part of any browser, its features are far above any of the current manager offerings out there. Despite the fact that it runs in the command line, it offers up some serious competition. Bookmarks might not be that important to most people, but those who dislike the current choices and love the Linux command line should give Buku a serious shot.

Our latest tutorials delivered straight to your inbox