ddgr – 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 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 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.
What is DuckDuckGo
DDG stands for DuckDuckGo. DuckDuckGo (DDG) is an search engine that really protecting users search and privacy.They don’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.
- 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
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.
Fedora, use DNF Command to install ddgr.
# dnf install ddgr
Alternatively we can use SNAP Command to install ddgr.
# snap install ddgr
$ sudo add-apt-repository ppa:twodopeshaggy/jarun $ sudo apt-get update $ sudo apt-get install ddgr
$ yaourt -S ddgr or $ packer -S ddgr
Debian, use DPKG Command 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
CentOS 7, use YUM Command to install ddgr.
# yum install https://github.com/jarun/ddgr/releases/download/v1.2/ddgr-1.2-1.el7.3.centos.x86_64.rpm
opensuse, use zypper Command 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
ddgr command without any option on terminal to bring DuckDuckGo search. You will get the same output similar to below.
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
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
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“.
ddgr (? for help) d magesh maruthmuthu
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
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
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"