8.5 KiB
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 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.
Suggested Read : (#) Googler – Google Search From The Linux Command Line (#) Buku – A Powerful Command-line Bookmark Manager for Linux (#) SoCLI – Easy Way To Search And Browse Stack Overflow From The Terminal (#) RTV (Reddit Terminal Viewer) – A Simple Terminal Viewer For Reddit
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 to install ddgr.
# dnf install ddgr
Alternatively we can use SNAP Command to install ddgr.
# snap install ddgr
For LinuxMint/Ubuntu
, use APT-GET Command or APT Command 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 or Packer Command to install ddgr from AUR repository.
$ yaourt -S ddgr
or
$ packer -S ddgr
For 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
For 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
For 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
Enter the ddgr
command without any option on terminal to bring DuckDuckGo search. You will get the same output similar to below.
$ ddgr
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
Omniprompt Shortcut
Enter ?
to obtain the omniprompt
, which will show you list of keywords and shortcut to work further with ddgr.
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 resultsp:
Move to previous set of search resultsf:
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 “.
From omniprompt
.
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"
via: https://www.2daygeek.com/ddgr-duckduckgo-search-from-the-command-line-in-linux/
作者:Magesh Maruthamuthu 译者:译者ID 校对:校对者ID 选题:lujun9972