DuckDuckGo is a popular web search engine known for its strict privacy policies and features. Lately, it has gained a lot of popularity among privacy enthusiasts who have been advocating its privacy-friendly search experience to others.

If you, too, use DuckDuckGo for all your web searches and prefer to use the command line for most of the operations on your computer, ddgr is a useful utility that lets you use the terminal to perform DuckDuckGo queries.

Below is a guide explaining ddgr and the steps to search DuckDuckGo from the Linux command line.

What Is ddgr?

ddgr is a command-line tool that lets you search DuckDuckGo from the terminal. It returns results in the HTML format, and you can navigate through them using your keyboard.

While the default ddgr interface uses minimal space without sacrificing readability, it does give you the option to customize some of its aspects like the string text, number of results displayed per page, etc. to your preference.

Some of ddgr's notable features include:

  • Fast and instantaneous result processing
  • Easy navigation
  • Support for DuckDuckGo !Bang
  • Search result filtering by time, region, etc.
  • Browser integration
  • HTTPS proxy support
  • Do Not Track
  • Minimal dependencies
  • REPL support for continuous searches

Related:Does HTTPS Protect Data in Transit?

How to Install ddgr on Linux

It's quite easy to get ddgr up and running on your Linux machine. And much like installing other programs on Linux, you can also install ddgr in a few different ways.

So depending on which distro you're using, follow the instructions in the sections below to install ddgr.

Installing ddgr on Debian/Ubuntu

Installing ddgr on Debian and its derivates is simple, thanks to the APT package manager. To do this, open the terminal and run the following command:

        sudo apt-get install ddgr
    

When prompted, press y and hit Enter to continue the installation.

Another way to install ddgr on Debian-based Linux distros, besides the APT package manager, is using a DEB package file. For this, start by downloading the ddgr DEB package on your computer from the link below.

Download: ddgr (DEB package)

Once done, open the terminal and use the cd command to change the directory to Downloads (or the directory where you just downloaded the package).

Next, run the following command to install the package:

        sudo dpkg -i ddgr_x.x.x-x_ubuntuXX.XX.amd64.deb
    

Related:How Do You Install a DEB File in Ubuntu?

Installing ddgr Using Snap

Snap offers one of the simplest ways to install a package on Linux. If you're using some Linux distro—other than Debian or its derivates—that doesn't have a package for ddgr in its repositories, you can install ddgr on your system using Snap.

For this, make sure you have Snap installed on your computer first.

        snap --version
    

If this returns a version number, Snap is present on your machine and you can proceed to the next step. If it doesn't, you'll have to install Snap first.

Considering you've managed to get Snap on your device, you can install ddgr by running:

        sudo snap install ddgr
    

How to Use ddgr to Search DuckDuckGo

Searching DuckDuckGo using ddgr is as simple as performing a couple of simple steps. First, open the terminal since that's where ddgr works. Next, enter your search query in the syntax below to look it up on DuckDuckGo:

        ddgr your_search_query
    

For example:

        ddgr makeuseof
    

Here's what the output looks like:

ddgr output

Configuring the Number of Returned Results

Once you make a query, the output will display a list of search results related to your search query.

By default, ddgr lists only 10 results at a time. However, you can choose to view more/fewer results at a time by explicitly mentioning the number of results you want to see in the following manner:

        ddgr -n x your_search_query
    

...where x is the number of results you want to view.

Each ddgr result on the list is numbered. This number is called the index of a result, and you can use it to open the corresponding link.

For instance, if you want to open link number 5 from the results in a browser, simply enter 5 in the omniprompt—the prompt you see in the terminal after you make a query in ddgr—and hit Enter.

Integrate ddgr With Text-Based Browsers

By default, ddgr opens links in the default web browser on your Linux machine. However, it also supports a bunch of text-based browsers, such as w3m, lynx, elinks, and www-browser, which you can use to open the search results.

To set a browser as default, all you need to do is set the environment variable for it. For this, run the following command in a terminal window:

        export BROWSER=w3m
    

Alternatively, if you'd like to use a browser for just a particular query, you can do so using:

        BROWSER=w3m ddgr your_search_query
    
ddgr in text-based browser

Just like Google's "I'm Feeling Lucky" search, DuckDuckGo also has its own version of the same, called "I'm Feeling Ducky." In case you're unaware, this option bypasses all the results on the SERP and directly opens the first link in the list.

With ddgr, you can perform an "I'm Feeling Ducky" search using the following syntax:

        ddgr -j lucky your_search_query
    

As mentioned earlier in the guide, ddgr also supports DuckDuckGo !Bang, which are shortcuts (or short commands) that let you look up your query directly on a website without having to visit it.

Say you want to learn more about DuckDuckGo on Wikipedia, you can do this easily by running the following command:

        ddgr !w duckduckgo
    

If you're on Bash shell, you'll need to escape the ! character. If you do this, your command would look like this:

        ddgr \!w duckduckgo
    

Similar to using DuckDuckGo !Bangs in ddgr, you can also carry out a website-specific search using the -w tag. For instance, if you want to look up mechanical keyboards on Amazon, you can do it more efficiently using the command below:

        ddgr -w amazon.com mechanical keyboard
    

Search for a Specific File Type

At times, you may just want to find a certain kind of file on the internet. In such instances, ddgr can help you filter out your results by adding the file type in your search query.

For example, let's say you want to look up image files (PNG) on the DuckDuckGo search engine. With ddgr, you can do this as shown in the command below:

        ddgr duckduckgo filetype:png
    

Get Help With ddgr

At any time, if you're unsure about how to use a ddgr command or would like to learn more, you can get command-line help using:

        ddgr --help
    
ddgr help

Carry Out Searches on DuckDuckGo More Efficiently

With ddgr installed and running on your Linux machine, you can now carry out searches on DuckDuckGo more efficiently without ever having to open DuckDuckGo in a browser.

ddgr supports a bunch of other operations and customization options than what we've covered in this guide. To check them out, head over to ddgr's GitHub.

Besides, if you'd like to get more out of your browsing experience, DuckDuckGo's !Bang feature can come in handy.