Googler：现在可以 Linux 终端下进行 Google 搜索了！
Googler 搜索 终端
![](/data/attachment/album/201609/20/134318mxwqxhofx8yj8jcc.jpg)


一个小问题：你每天做什么事？当然了，好多事情，但是我可以指出一件事，你几乎每天（如果不是每天）都会用 Google 搜索，我说的对吗？（LCTT 译注：Google 是啥？/cry ）


现在，如果你是一位 Linux 用户（我猜你也是），这里有另外一个问题：如果你甚至不用离开终端就可以进行 Google 搜索那岂不是相当棒？甚至不用打开一个浏览器窗口？


如果你是一位类 [\*nix](https://en.wikipedia.org/wiki/Unix-like) 系统的狂热者而且也是喜欢终端界面的人，我知道你的答案是肯定的，而且我认为，接下来你也将喜欢上我今天将要介绍的这个漂亮的小工具。它被称做 Googler。


### Googler：在你 linux 终端下的 google


Googler 是一个简单的命令行工具，它用于直接在命令行窗口中进行 google 搜索，Googler 主要支持三种类型的 Google 搜索：


* Google 搜索：简单的 Google 搜索，和在 Google 主页搜索是等效的。
* Google 新闻搜索：Google 新闻搜索，和在 Google News 中的搜索一样。
* Google 站点搜索：Google 从一个特定的网站搜索结果。


Googler 用标题、链接和网页摘要来显示搜索结果。搜索出来的结果可以仅通过两个按键就可以在浏览器里面直接打开。


![](/data/attachment/album/201609/20/134338rz5ei8is5x5a5lme.png)


### 在 Ubuntu 下安装 Googler


先让我们进行软件的安装。


首先确保你的 python 版本大于等于 3.3，可以用以下命令查看。



```
python3 --version

```

如果不是的话，就更新一下。Googler 要求 python 版本 3.3 及以上运行。


虽然 Googler 现在还不能在 Ununtu 的软件库中找到，我们可以很容易地从 GitHub 仓库中安装它。我们需要做的就是运行以下命令：



```
cd /tmp
git clone https://github.com/jarun/googler.git
cd googler
sudo make install
cd auto-completion/bash/
sudo cp googler-completion.bash /etc/bash_completion.d/

```

这样 Googler 就带着命令自动完成特性安装完毕了。


### 特点 & 基本用法


如果我们快速浏览它所有的特点，我们会发现 Googler 实际上是一个十分强大的工具，它的一些主要特点就是：


#### 交互界面


在终端下运行以下命令：



```
googler

```

交互界面就会被打开，Googler 的开发者 [Arun Prakash Jana](https://github.com/jarun) 称之为<ruby> 全向提示符 <rp>  （ </rp> <rt>  omniprompt </rt> <rp>  ） </rp></ruby>，你可以输入 `?` 去寻找可用的命令参数：


![](/data/attachment/album/201609/20/134349pqc54iiij7zg0i9s.png)


在提示符处，输入任何搜索词汇关键字去开始搜索，然后你可以输入`n`或者`p`导航到搜索结果的后一页和前一页。


要在浏览器窗口中打开搜索结果，直接输入搜索结果的编号，或者你可以输入 `o` 命令来打开这个搜索网页。


#### 新闻搜索


如果你想去搜索新闻，直接以`N`参数启动 Googler：



```
googler -N

```

随后的搜索将会从 Google News 抓取结果。


#### 站点搜索


如果你想从某个特定的站点进行搜索，以`w 域名`参数启动 Googler：



```
googler -w itsfoss.com

```

随后的搜索会只从这个博客中抓取结果！


#### 手册页


运行以下命令去查看 Googler 的带着各种用例的手册页：



```
man googler

```

#### 指定国家/地区的 Google 搜索引擎



```
googler -c in "hello world"

```

上面的示例命令将会开始从 Google 的印度域名搜索结果（in 代表印度）


还支持：


* 通过时间和语言偏好来过滤搜索结果
* 支持 Google 查询关键字，例如：`site:example.com` 或者 `filetype:pdf` 等等
* 支持 HTTPS 代理
* Shell 命令自动补全
* 禁用自动拼写纠正


这里还有更多特性。你可以用 Googler 去满足你的需要。


Googler 也可以和一些基于文本的浏览器整合在一起（例如：[elinks](http://elinks.or.cz/)、[links](http://links.twibright.com/)、[lynx](http://lynx.browser.org/)、w3m 等），所以你甚至都不用离开终端去浏览网页。在 [Googler 的 GitHub 项目页](https://github.com/jarun/googler#faq)可以找到指导。


如果你想看一下 Googler 不同的特性的视频演示，方便的话你可以查看 GitHub 项目页附带的终端记录演示页： [jarun/googler v2.7 quick demo](https://asciinema.org/a/85019)。


### 对于 Googler 的看法？


尽管 googler 可能并不是对每个人都是必要和渴望的，对于一些不想打开浏览器进行 google 搜索或者就是想泡在终端窗口里面的人来说，这是一个很棒的工具。你认为呢？




---


via: <https://itsfoss.com/review-googler-linux/>


作者：[Munif Tanjim](https://itsfoss.com/author/munif/) 译者：[LinuxBars](https://github.com/LinuxBars) 校对：[wxy](https://github.com/wxy)


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


OK
A quick question: What do you do every day? Of course, a lot of things. But I can tell one thing, you search on Google almost every day (if not every day). Am I right?

Now, if you are a [Linux](https://itsfoss.com/tag/linux/) user (which I’m guessing you are) here’s another question: wouldn’t it be nice if you can Google without even leaving the terminal? Without even firing up a Browser window?

If you are a [*nix](https://en.wikipedia.org/wiki/Unix-like) enthusiast and also one of those people who just love the view of the terminal, I know your answer is – Yes. And I think, the rest of you will also like the nifty little tool I’m going to introduce today. It’s called **Googler**!

## Googler: Google in your Linux terminal

Googler is a straightforward command-line utility for Google-ing right from your terminal window. Googler mainly supports three types of Google Searches:

**Google Search**: Simple Google searching, equivalent to searching on[Google homepage](https://www.google.com).**Google News Search**: Google searching for News, equivalent to searching on[Google News](https://news.google.com/).**Google Site Search**: Google searching for results from a specific site.

Googler shows the search results with the title, URL and page excerpt. The search results can be opened directly in the browser with only a couple of keystrokes.

## Installation on Ubuntu

Let’s go through the installation process first.

At first make sure you have *python* version 3.3 or later using this command:

`python3 --version`


If not, upgrade it. Googler requires python 3.3+ for running.

Though Googler is yet not available through package repository on Ubuntu, we can easily install it from the GitHub repository. All we have to do is run the following commands:

```
cd /tmp
git clone https://github.com/jarun/googler.git
cd googler
sudo make install
cd auto-completion/bash/
sudo cp googler-completion.bash /etc/bash_completion.d/
```


And that’s it. Googler is installed along with command autocompletion feature.

## Features & Basic Usage

If we go through all its features, Googler is actually quite powerful a tool. Some of the main features are:

**Interactive Interface**: Run the following command in terminal:`googler`

The interactive interface will be opened. The developer of Googler,

[Arun Prakash Jana](https://github.com/jarun)calls it the**omniprompt**. You can enter`?`

for available commands on omniprompt.Googler OmniPrompt Help From the omniprompt, enter any search phrases to initiate the search. You can then enter

`n`

or`p`

to navigate next or previous page of search results.To open any search result in a browser window, just enter the index number of that result. Or you can open the search page itself by entering

`o`

.**News Search**: If you want to search News, start googler with the`N`

optional argument:`googler -N`

The subsequent omniprompt will fetch results from Google News.

**Site Search**: If you want to search pages from a specific site, run googler with`w {domain}`

argument:`googler -w itsfoss.com`

The subsequent omniprompt with fetch results only from It’s FOSS blog!

**Manual Page**: Run the following command for Googler manual page equipped with various examples:`man googler`

- Google country/domain specific search:
`googler -c in "hello world"`

The above example command will open search results from

[Google’s Indian domain](https://www.google.co.in)(in for India). - Filter search results by duration and language preference.
- Google search keywords support, such as:
*site:example.com*or*filetype:pdf*etc. - HTTPS proxy support.
- Shell commands autocomplete.
- Disable automatic spelling correction.

There are much more. You can twist Googler to suit your needs.

Googler can also be integrated with a text-based browser ( like – [elinks](http://elinks.or.cz/), [links](http://links.twibright.com/), [lynx](http://lynx.browser.org/), w3m etc.), so that you wouldn’t even need to leave the terminal for browsing web pages. The instructions can be found on the [GitHub project page of Googler](https://github.com/jarun/googler#faq).

If you want a graphical demonstration of Googler’s various features, feel free to check the terminal recording attached to the GitHub project page : [jarun/googler v2.7 quick demo](https://asciinema.org/a/85019).

## Thoughts on Googler?

Though Googler might not feel necessary or desired to everybody, for someone who doesn’t want to open the browser just for searching on google or simply want to spend as much as time possible on the terminal window, it is a great tool indeed. What do you think?