How to Search DuckDuckGo from the Linux Terminal

Like Googler (Google Site Search from the command-line), ddgr is a command line utility that can be used to search for key terms words via DuckDuckGo search engine and a command line browser on your terminal prompt.

Before installing ddgr command line search engine in Linux, first assure that the Python 3.4 and Python requests library needed to handle HTTPS requests are installed on your system, by issuing the following commands.

------------------ On CentOS, RHEL & Fedora ------------------ 
# yum install epel-release
# yum install python34 python34-requests

------------------ On Debian & Ubuntu ------------------
# apt install python3 python3-requests

In order to open ddgr searches you need to install a command line browser, such as elinks, links, lynx, w3m or www-browser, in your system.

Read Also: 8 Command Line Tools for Browsing Websites

In this guide we’ll configure ddgr search engine to open links via lynx text based browser.

# yum insall lynx         [On CentOS, RHEL & Fedora]
# apt-get install lynx    [On Debian & Ubuntu]

Next, set the BROWSER environment variable system-wide to point to lynx browser, by issuing the following commands with root privileges.

# export BROWSER=lynx
# echo “export BROWSER=lynx” >> /etc/profile

In order to install DuckDuckGo search engine command line utility via official ddgr github binary package releases, issue the following commands specific to your own Linux distribution.

------------------ On CentOS, RHEL & Fedora ------------------
# yum install 

------------------ On Ubuntu 16.04 ------------------
# wget
# dpkg -i ddgr_1.1-1_ubuntu16.04.amd64.deb

------------------ On Ubuntu 17.10 ------------------
# wget 
# dpkg -i ddgr_1.1-1_ubuntu17.10.amd64.deb

------------------ On Debian 9 ------------------
# wget 
# dpkg -i ddgr_1.1-1_debian9.amd64.deb

You can also install ddgr on Ubuntu using a PPA repository, which is maintained by the developer of ddgr project.

$ sudo add-apt-repository ppa:twodopeshaggy/jarun
$ sudo apt-get update
$ sudo apt-get install ddgr

How to Search DuckDuckGo from Terminal Using ddgr

Finally, in order to search a specific keyword in ddgr serach engine, issue the command as shown in the below example.

# ddgr tecmint
Search DuckDuckGo from Commandline
Search DuckDuckGo from Commandline

To automatically open a specific displayed search result in lynx text-based browser, hit the corresponding number key and wait for the webpage to load. Sometimes you need to type “a” in lynx browser in order to always accept website cookies and load the website.

That’s all! For other information regarding DuckDuckGo command line search engine utility, visit ddgr official github page.

Hey TecMint readers,

Exciting news! Every month, our top blog commenters will have the chance to win fantastic rewards, like free Linux eBooks such as RHCE, RHCSA, LFCS, Learn Linux, and Awk, each worth $20!

Learn more about the contest and stand a chance to win by sharing your thoughts below!

Matei Cezar
I'am a computer addicted guy, a fan of open source and linux based system software, have about 4 years experience with Linux distributions desktop, servers and bash scripting.

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.


Leave a Reply
  1. Why complicate one’s life needlessly?! With the GUI DDG search working beautifully in any browser, why flagellate oneself with installing and using esoteric CLI tools?

    I suppose using the command line makes some people feel superior. So does riding a horse rather than a car.

  2. I would expect to be able to use wget/curl like tools and have the results in HTML form, instead of that they complicated stuff for nothing, and it’s not even real command line since you need some lynx or whatever….anyway I like Duckduckgo in Firefox or Chrome but when it comes to terminal search, it sucks! Thanks for the article anyway.


Got Something to Say? Join the Discussion...

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.