mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-29 21:41:00 +08:00
232 lines
8.5 KiB
Markdown
232 lines
8.5 KiB
Markdown
|
ddgr – A Command Line Tool To Search DuckDuckGo From The Terminal
|
|||
|
======
|
|||
|
Bash tricks are really awesome in Linux that makes everything is possible in Linux.
|
|||
|
|
|||
|
It really works well for developers or system admins because they are spending most of the time with terminal. Did you know why they are preferring this tricks?
|
|||
|
|
|||
|
These trick will improve their productivity and also make them to work fast.
|
|||
|
|
|||
|
### What Is ddgr
|
|||
|
|
|||
|
[ddgr][1] is a command-line utility to search DuckDuckGo from the terminal. ddgr works out of the box with several text-based browsers if the BROWSER environment variable is set.
|
|||
|
|
|||
|
Make sure your system should have installed any text-based browsers. You may know about [googler][2] that allow users to perform Google searches from the Linux command line.
|
|||
|
|
|||
|
It’s highly popular among cmdline users and they are expect the similar utility for privacy-aware DuckDuckGo, that’s why ddgr came to picture.
|
|||
|
|
|||
|
Unlike the web interface, you can specify the number of search results you would like to see per page.
|
|||
|
|
|||
|
**Suggested Read :**
|
|||
|
**(#)** [Googler – Google Search From The Linux Command Line][2]
|
|||
|
**(#)** [Buku – A Powerful Command-line Bookmark Manager for Linux][3]
|
|||
|
**(#)** [SoCLI – Easy Way To Search And Browse Stack Overflow From The Terminal][4]
|
|||
|
**(#)** [RTV (Reddit Terminal Viewer) – A Simple Terminal Viewer For Reddit][5]
|
|||
|
|
|||
|
### What Is DuckDuckGo
|
|||
|
|
|||
|
DDG stands for DuckDuckGo. DuckDuckGo (DDG) is an Internet search engine that really protecting users search and privacy.
|
|||
|
|
|||
|
They didn’t filter users personalized search results and It’s showing the same search results to all users for a given search term.
|
|||
|
|
|||
|
Most of the users prefer google search engine, if you really worrying about privacy then you can blindly go with DuckDuckGo.
|
|||
|
|
|||
|
### ddgr Features
|
|||
|
|
|||
|
* Fast and clean (no ads, stray URLs or clutter), custom color
|
|||
|
* Designed to deliver maximum readability at minimum space
|
|||
|
* Specify the number of search results to show per page
|
|||
|
* Navigate result pages from omniprompt, open URLs in browser
|
|||
|
* Search and option completion scripts for Bash, Zsh and Fish
|
|||
|
* DuckDuckGo Bang support (along with completion)
|
|||
|
* Open the first result directly in browser (as in I’m Feeling Ducky)
|
|||
|
* Non-stop searches: fire new searches at omniprompt without exiting
|
|||
|
* Keywords (e.g. filetype:mime, site:somesite.com) support
|
|||
|
* Limit search by time, specify region, disable safe search
|
|||
|
* HTTPS proxy support, Do Not Track set, optionally disable User Agent
|
|||
|
* Support custom url handler script or cmdline utility
|
|||
|
* Comprehensive documentation, man page with handy usage examples
|
|||
|
* Minimal dependencies
|
|||
|
|
|||
|
|
|||
|
|
|||
|
### Prerequisites
|
|||
|
|
|||
|
ddgr requires Python 3.4 or later. So, make sure you system should have Python 3.4 or later version.
|
|||
|
```
|
|||
|
$ python3 --version
|
|||
|
Python 3.6.3
|
|||
|
|
|||
|
```
|
|||
|
|
|||
|
### How To Install ddgr In Linux
|
|||
|
|
|||
|
We can easily install ddgr using the following command based on the distributions.
|
|||
|
|
|||
|
For **`Fedora`** , use [DNF Command][6] to install ddgr.
|
|||
|
```
|
|||
|
# dnf install ddgr
|
|||
|
|
|||
|
```
|
|||
|
|
|||
|
Alternatively we can use [SNAP Command][7] to install ddgr.
|
|||
|
```
|
|||
|
# snap install ddgr
|
|||
|
|
|||
|
```
|
|||
|
|
|||
|
For **`LinuxMint/Ubuntu`** , use [APT-GET Command][8] or [APT Command][9] to install ddgr.
|
|||
|
```
|
|||
|
$ sudo add-apt-repository ppa:twodopeshaggy/jarun
|
|||
|
$ sudo apt-get update
|
|||
|
$ sudo apt-get install ddgr
|
|||
|
|
|||
|
```
|
|||
|
|
|||
|
For **`Arch Linux`** based systems, use [Yaourt Command][10] or [Packer Command][11] to install ddgr from AUR repository.
|
|||
|
```
|
|||
|
$ yaourt -S ddgr
|
|||
|
or
|
|||
|
$ packer -S ddgr
|
|||
|
|
|||
|
```
|
|||
|
|
|||
|
For **`Debian`** , use [DPKG Command][12] to install ddgr.
|
|||
|
```
|
|||
|
# wget https://github.com/jarun/ddgr/releases/download/v1.2/ddgr_1.2-1_debian9.amd64.deb
|
|||
|
# dpkg -i ddgr_1.2-1_debian9.amd64.deb
|
|||
|
|
|||
|
```
|
|||
|
|
|||
|
For **`CentOS 7`** , use [YUM Command][13] to install ddgr.
|
|||
|
```
|
|||
|
# yum install https://github.com/jarun/ddgr/releases/download/v1.2/ddgr-1.2-1.el7.3.centos.x86_64.rpm
|
|||
|
|
|||
|
```
|
|||
|
|
|||
|
For **`opensuse`** , use [zypper Command][14] to install ddgr.
|
|||
|
```
|
|||
|
# zypper install https://github.com/jarun/ddgr/releases/download/v1.2/ddgr-1.2-1.opensuse42.3.x86_64.rpm
|
|||
|
|
|||
|
```
|
|||
|
|
|||
|
### How To Launch ddgr
|
|||
|
|
|||
|
Enter the `ddgr` command without any option on terminal to bring DuckDuckGo search. You will get the same output similar to below.
|
|||
|
```
|
|||
|
$ ddgr
|
|||
|
|
|||
|
```
|
|||
|
|
|||
|
![][16]
|
|||
|
|
|||
|
### How To Search Using ddgr
|
|||
|
|
|||
|
We can initiate the search through two ways. Either from omniprompt or directly from terminal. You can search any phrases which you want.
|
|||
|
|
|||
|
Directly from terminal.
|
|||
|
```
|
|||
|
$ ddgr 2daygeek
|
|||
|
|
|||
|
```
|
|||
|
|
|||
|
![][17]
|
|||
|
|
|||
|
From `omniprompt`.
|
|||
|
![][18]
|
|||
|
|
|||
|
### Omniprompt Shortcut
|
|||
|
|
|||
|
Enter `?` to obtain the `omniprompt`, which will show you list of keywords and shortcut to work further with ddgr.
|
|||
|
![][19]
|
|||
|
|
|||
|
### How To Move Next,Previous, and Fist Page
|
|||
|
|
|||
|
It allows user to move next page or previous page or first page.
|
|||
|
|
|||
|
* `n:` Move to next set of search results
|
|||
|
* `p:` Move to previous set of search results
|
|||
|
* `f:` Jump to the first page
|
|||
|
|
|||
|
|
|||
|
|
|||
|
![][20]
|
|||
|
|
|||
|
### How To Initiate A New Search
|
|||
|
|
|||
|
“ **d** ” option allow users to initiate a new search from omniprompt. For example, i searched about `2daygeek website` and now i’m going to initiate a new search with phrase “ **Magesh Maruthamuthu** “.
|
|||
|
|
|||
|
From `omniprompt`.
|
|||
|
```
|
|||
|
ddgr (? for help) d magesh maruthmuthu
|
|||
|
|
|||
|
```
|
|||
|
|
|||
|
![][21]
|
|||
|
|
|||
|
### Show Complete URLs In Search Result
|
|||
|
|
|||
|
By default it shows only an article heading, add the “ **x** ” option in search to show complete article urls in search result.
|
|||
|
```
|
|||
|
$ ddgr -n 5 -x 2daygeek
|
|||
|
|
|||
|
```
|
|||
|
|
|||
|
![][22]
|
|||
|
|
|||
|
### Limit Search Results
|
|||
|
|
|||
|
By default search results shows 10 results per page. If you want to limit the page results for your convenience, you can do by passing `--num or -n` argument with ddgr.
|
|||
|
```
|
|||
|
$ ddgr -n 5 2daygeek
|
|||
|
|
|||
|
```
|
|||
|
|
|||
|
![][23]
|
|||
|
|
|||
|
### Website Specific Search
|
|||
|
|
|||
|
To search specific pages from the particular website, use the below format. This will fetch the results for given keywords from the website. For example, We are going search about “ **Package Manager** ” from 2daygeek website. See the results.
|
|||
|
```
|
|||
|
$ ddgr -n 5 --site 2daygeek "package manager"
|
|||
|
|
|||
|
```
|
|||
|
|
|||
|
![][24]
|
|||
|
|
|||
|
--------------------------------------------------------------------------------
|
|||
|
|
|||
|
via: https://www.2daygeek.com/ddgr-duckduckgo-search-from-the-command-line-in-linux/
|
|||
|
|
|||
|
作者:[Magesh Maruthamuthu][a]
|
|||
|
译者:[译者ID](https://github.com/译者ID)
|
|||
|
校对:[校对者ID](https://github.com/校对者ID)
|
|||
|
选题:[lujun9972](https://github.com/lujun9972)
|
|||
|
|
|||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
|||
|
|
|||
|
[a]:https://www.2daygeek.com/author/magesh/
|
|||
|
[1]:https://github.com/jarun/ddgr
|
|||
|
[2]:https://www.2daygeek.com/googler-google-search-from-the-command-line-on-linux/
|
|||
|
[3]:https://www.2daygeek.com/buku-command-line-bookmark-manager-linux/
|
|||
|
[4]:https://www.2daygeek.com/socli-search-and-browse-stack-overflow-from-linux-terminal/
|
|||
|
[5]:https://www.2daygeek.com/rtv-reddit-terminal-viewer-a-simple-terminal-viewer-for-reddit/
|
|||
|
[6]:https://www.2daygeek.com/dnf-command-examples-manage-packages-fedora-system/
|
|||
|
[7]:https://www.2daygeek.com/snap-command-examples/
|
|||
|
[8]:https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/
|
|||
|
[9]:https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/
|
|||
|
[10]:https://www.2daygeek.com/install-yaourt-aur-helper-on-arch-linux/
|
|||
|
[11]:https://www.2daygeek.com/install-packer-aur-helper-on-arch-linux/
|
|||
|
[12]:https://www.2daygeek.com/dpkg-command-to-manage-packages-on-debian-ubuntu-linux-mint-systems/
|
|||
|
[13]:https://www.2daygeek.com/yum-command-examples-manage-packages-rhel-centos-systems/
|
|||
|
[14]:https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/
|
|||
|
[15]:data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
|
|||
|
[16]:https://www.2daygeek.com/wp-content/uploads/2018/03/ddgr-duckduckgo-command-line-search-for-linux1.png
|
|||
|
[17]:https://www.2daygeek.com/wp-content/uploads/2018/03/ddgr-duckduckgo-command-line-search-for-linux-3.png
|
|||
|
[18]:https://www.2daygeek.com/wp-content/uploads/2018/03/ddgr-duckduckgo-command-line-search-for-linux-2.png
|
|||
|
[19]:https://www.2daygeek.com/wp-content/uploads/2018/03/ddgr-duckduckgo-command-line-search-for-linux-4.png
|
|||
|
[20]:https://www.2daygeek.com/wp-content/uploads/2018/03/ddgr-duckduckgo-command-line-search-for-linux-5a.png
|
|||
|
[21]:https://www.2daygeek.com/wp-content/uploads/2018/03/ddgr-duckduckgo-command-line-search-for-linux-6a.png
|
|||
|
[22]:https://www.2daygeek.com/wp-content/uploads/2018/03/ddgr-duckduckgo-command-line-search-for-linux-7a.png
|
|||
|
[23]:https://www.2daygeek.com/wp-content/uploads/2018/03/ddgr-duckduckgo-command-line-search-for-linux-8.png
|
|||
|
[24]:https://www.2daygeek.com/wp-content/uploads/2018/03/ddgr-duckduckgo-command-line-search-for-linux-9a.png
|