Translated:How to access popular search engines from the command line on Linux

This commit is contained in:
GOLinux 2014-07-01 10:54:26 +08:00
parent eabba48ad3
commit d525b680c3
2 changed files with 100 additions and 105 deletions

View File

@ -1,105 +0,0 @@
Translating by GOLinux
How to access popular search engines from the command line on Linux
================================================================================
Why would anyone want to search things on the Internet via a terminal? I don't know. There are probably a lot of reasons. But since an answer that no one asked for is always less frustrating than a question that no one can answer, here is a list of popular search engines with the command-line tools that allow you to access them from a Linux terminal.
### 1. Google ###
Let's start right with a giant: Bing! No just kidding, Google. To be frank, you don't really need a utility to search on Google from the command line. A simple:
$ xdg-open https://www.google.com/search?q="[query]"
would open your web browser on the appropriate search page. However, if what you want is to see the results of that search from a terminal window, without opening any kind of web browser, I would recommend using [cli-google][1]. It is super old (last updated in 2009) but I like it. It is a simple and straightforward application which does exactly what it's supposed to do.
Once you install cli-google, you can do searches with a colored output. You can also adjust the amount of results and the language that you want. Just type:
$ google
in your terminal to see all the options.
![](https://farm6.staticflickr.com/5491/14330385480_91b0e138ee_z.jpg)
### 2. YouTube ###
There is going to be a lot of Google in this list. I will try to keep it as minimal as possible, but there is no escape. YouTube is for a lot of people the go to when it comes to finding a video of something quickly. To do such things from a terminal, my go to is [mps-youtube][2]. This software lets you search, make playlists, download videos, and read the comments from the terminal. Once you install mps-youtube, launch it with:
$ mpsyt
Then type h to see the options. For quick usage, you can just do:
/[query]
to search for something, then type the number ID of the video to listen to its sound, or type:
i [video-number]
to see its information, and type:
d [video-number]
to download it. If just listening is not enough for you, here is the trick:
set player mplayer
set show_video True
Now the video will show up in another window on mplayer.
![](https://farm3.staticflickr.com/2925/14517040865_1d54ccce3b_z.jpg)
### 3. Wikipedia ###
Same as for Google, for Wikipedia I like an old script that works just fine: [cliWiki][3]. Once you install it, just run:
$ cliwiki
And then type in your search. If there is a direct match, the page will be displayed in the terminal. The output can be quite long so I advise you to channel it with the less command. It is certainly not the most efficient way to do it, but if your goal is to get a block of text concerning a keyword, this is exactly what you need.
![](https://farm3.staticflickr.com/2903/14330600657_065d26cdf2_z.jpg)
### 4. The Pirate Bay ###
Now let's talk dirty. There are surprisingly (or not) a lot of utilities to find torrents on The Pirate Bay from the command line. However my preference goes to [pirate-get][4]. It comes with a ton of options that you can discover with:
$ pirate-get -h
But to keep it simple:
$ pirate-get --color -c [category] [query]
will return the result from a certain category of the search corresponding to a query, and with a colored output! From there, the application will prompt you to enter the number of the result that you want, and will then download the torrent from a magnet link. Simple and easy. Use only on non-copyrighted material!
![](https://farm4.staticflickr.com/3923/14330448479_ae503561e6_z.jpg)
### 5. Twitter ###
Twitter is a good search engine for trends. We already covered [how to access Twitter from the command line][5] using t, but I personally prefer [TTYtter][6] to it. This utility is extermely powerful, could deserve its own post, and cannot be resumed to simply searching. But I am just going to use it as a search engine here. Once installed and configured, you can log in and search using the command:
/search [query]
The interface is a bit rough on the eye, but you will get accustomed quickly. Notice that this will work with plain words but also hash-tags.
![](https://farm6.staticflickr.com/5077/14537153013_cc32a98b08_z.jpg)
To conclude, these are in my opinion the big five search engines that people tend to use the most and which are accessible via the command line. The absents are probably Google Images and Google Maps, but those are kind of hard to adapt to the console I guess. I also wanted to look for a music search engine, but did not find any "worthy" of this list. As you have probably noticed, the tools on this list are uneven in term of features and options: some are simplistic while others go deep into functionality. But in the end they all do the job.
Which search engines are missing from this list? Do you know some utilities that were not mentioned? Let us know in the comments.
----------
#### Adrien Brochard ####
I am a Linux aficionado from France. After trying multiple distributions, I finally settled for Archlinux. But I am always trying to improve my system by stacking up tips and tricks.
--------------------------------------------------------------------------------
via: http://xmodulo.com/2014/06/access-popular-search-engines-command-line-linux.html
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[1]:https://github.com/henux/cli-google
[2]:https://github.com/np1/mps-youtube
[3]:https://github.com/AnirudhBhat/cliWiki.py
[4]:https://github.com/vikstrous/pirate-get
[5]:http://xmodulo.com/2013/12/access-twitter-command-line-linux.html
[6]:http://www.floodgap.com/software/ttytter/

View File

@ -0,0 +1,100 @@
主流搜索引擎闯入Linux命令行世界
================================================================================
为什么会有人要从终端搜索互联网上的东西我不清楚这里头可能有许多的原因。但是因为没人要求答案总比没人知道答案少令人失望一点。这里列出了一些流行的搜索引擎的命令行工具可以让你们通过Linux终端来访问它们。
### 1. Google ###
让我们从一个巨头开始吧Bing好吧只是开个玩笑事实上应该是Google。坦白讲你根本不需要使用命令行工具来进行Google搜索。只需要简简单单的一个命令
$ xdg-open https://www.google.com/search?q="[query]"
它会打开网页浏览器,并转到合适的搜索页面。然而,如果你想要的是从终端窗口查看搜索结果,而不是打开什么网页浏览器,那么我推荐你使用[cli-google][1]。它是一个超级老古董了最后一次更新是在2009年但我喜欢它。这是一个简单而直接的应用它会忠实地干好它应该干的事。
安装完cli-google后你就可以开始用它来搜索了它的输出是那样的五彩斑斓。你也可以调整搜索结果的数量和你想要的语言你只需要在终端中敲入
$ google
就可以看到所有的选项了。
![](https://farm6.staticflickr.com/5491/14330385480_91b0e138ee_z.jpg)
### 2. YouTube ###
关于Google有太多的东西要放进列表来。我会尽量简明扼要但绝不会放过该有的。对于许多人而言YouTube是他们快速查找相关内容视频的首选。要在终端中完成此事我则钟情于[mps-youtube][2]。这个软件可以让你在终端中搜索、下载视频创建播放列表以及查看关于视频的评论。安装完mps-youtube后你可以使用下面的命令来启动
$ mpsyt
然后,输入 h 来查看选项。要查看简明用法,你可以像下面这样:
/[query]
来搜索你想知道的一切,然后输入视频的编号来听听它的声音,或者输入:
i [video-number]
来看看相关信息,也可以输入:
d [video-number]
来下载它。如果你觉得光听还不过瘾,这里还有更好玩的:
set player mplayer
set show_video True
现在你可以在另外一个窗口里头用mplayer来播放视频了。
![](https://farm3.staticflickr.com/2925/14517040865_1d54ccce3b_z.jpg)
### 3. 维基百科 ###
与Google一样对于维基百科我也喜欢一个古老的脚本它干的不赖[cliWiki][3]。安装完后,赶紧运行一下看看:
$ cliwiki
然后你就可以输入你想要搜索的内容了。如果有直接匹配的条目终端中就会显示相关页面了。哈输出内容可真够长的建议你还是用less命令来看吧。当然这不是最高效的方法但你的母的只是想要查看与关键词相关的文本那这就是你想要的。
![](https://farm3.staticflickr.com/2903/14330600657_065d26cdf2_z.jpg)
### 4. 海盗湾 ###
现在,让我们聊聊龌龊的东西。网上有很多意想不到的(也许你不觉得)工具,可以帮助你在命令行下查找海盗湾上的种子。而在这其中,[pirate-get][4]是我的最爱。它里面蕴藏了大量的选项,你可以通过下面的命令来发现它们:
$ pirate-get -h
但是还是简单一些吧:
$ pirate-get --color -c [category] [query]
以上命令会返回与查询内容相关的特定搜索类目中的结果,输出结果也是彩色的!那里头,程序会提示你输入你想要的结果的编号,输入后就可以从磁链上下载种子了。简单又容易,仅限于没有版权的资料哦!
![](https://farm4.staticflickr.com/3923/14330448479_ae503561e6_z.jpg)
### 5. Twitter ###
Twitter是迎合潮流的一个很好的搜索引擎。我们已经在[如何在命令行中访问Twitter][5]一文中介绍了它的用法,但是我个人更喜欢[TTYtter][6]。该工具及其强大,它应该有它自身的一席之地,而不再仅仅用于简单搜索了。但在这里,我只想把它当作搜索引擎使用。安装并配置完后,你就可以登陆进去,并使用下面的命令来搜索了:
/search [query]
界面在视觉上有点粗糙,但是你很快会习惯的。注意,这里头只能用普通的文字,也可以用哈希标记。
![](https://farm6.staticflickr.com/5077/14537153013_cc32a98b08_z.jpg)
最后来小结一下吧这里列出了我认为人们使用最多5大搜索引擎这些搜索引擎都可以通过命令行来访问。这里Google图像和Google地图可能缺席了但我想这些可能不能很好适应控制台环境吧。我也想要寻找一个音乐搜索引擎但是没有找到对于本列表“有价值的”。就像你可能已经注意到的那样列表中的工具在功能和选项上是良莠不齐的其中一些很简单而另外一些则功能很复杂。但不管怎么说最后它们都还是完成了它们的任务。
列表中错失了哪些搜索引擎?你还知道哪些没有提到过的工具呢?请在文章评论中告诉我们吧。
----------
#### Adrien Brochard ####
我是一位来自法国的Linux爱好者。在尝试了多个发行版后我最后认可了Archlinux。然而我一直在试着通过积累一些知识和技巧来改善我的系统。
--------------------------------------------------------------------------------
via: http://xmodulo.com/2014/06/access-popular-search-engines-command-line-linux.html
译者:[GOLinux](https://github.com/GOLinux) 校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[1]:https://github.com/henux/cli-google
[2]:https://github.com/np1/mps-youtube
[3]:https://github.com/AnirudhBhat/cliWiki.py
[4]:https://github.com/vikstrous/pirate-get
[5]:http://xmodulo.com/2013/12/access-twitter-command-line-linux.html
[6]:http://www.floodgap.com/software/ttytter/