How to add the power of DuckDuckGo to your Linux terminal

woman working on computer

Getty Images/pixdeluxe

Even though I know I can do everything I need to with a GUI in Linux, I still opt to take advantage of the power, flexibility, and efficiency of the terminal window. Because of that, I like to add a little tool called ddgr into the mix.

Ddgr makes it possible to run a DuckDuckGo search from the Linux terminal window. Because DuckDuckGo is more privacy-focused than Google, I prefer to use this tool (over Googler) for terminal-based searches. When you run a search through ddgr, it will present links you can select that will open in your default browser. 

Also: Best secure browsers for privacy

I know, I know…you’re thinking, “Why not just run the search through your browser?” To be honest, other than it being kind of cool and fun, it could have bash script and application implications. But mostly, it’s just a quick and fun way to run searches from the command line and then open the results in your browser. 

Let me first show you how to install ddgr and then I’ll demonstrate a few sample searches.

How to install ddgr

What you’ll need: To install ddgr, you’ll only need a running instance of Linux (it doesn’t matter what distribution) and a user with sudo privileges — that’s it. Let’s install.

The first thing to do is log in to your desktop and open a terminal window. 

No matter what Linux distribution you’re using, you should be able to install ddgr, but first you must install the make tool with one of the following commands:

  • On a Fedora-based distribution: sudo dnf install make unzip -y
  • On a Ubuntu-based distribution: sudo apt-get install build-essential unzip -y

Download the ddgr source with the following command:

wget https://github.com/jarun/ddgr/archive/refs/tags/v2.1.zip

Make sure to visit the official ddgr release page to make sure you’re downloading the latest version.

Unpack the compressed file with the command:

unzip v2.1.zip

Make sure you replace 2.1 with the version you downloaded.

Change into the newly created directory with cd ddgr-2.1 (make sure to replace 2.1 with the version you downloaded) and then install ddgr with:

sudo make install

How to use ddgr

Now that ddgr is installed, it’s ready to be used. Here’s a few examples of what you can do. One thing to keep in mind is that, when you run the ddgr command, you don’t get your prompt returned. 

Also: How to install Ubuntu Linux (It’s easy!)

Because of that approach, you can issue another search without having to type ddgr first. To exit the ddgr console, type q and hit Enter on your keyboard.

1. A basic search

You can issue a very basic search with ddgr. For example, to search for Linux on DuckDuckGo, issue the command:

ddgr Linux

The output will list the top 10 results. If you see a link you want to visit, click on it, and the link will open in your browser.

2. Search a site

Let’s say you want to search ZDNET for Linux content. For that, you could issue the command:

ddgr -w zdnet.com Linux

The output will be Linux-related articles from ZDNET.

3. Bangs 

I’m not talking about your hair. Ddgr also supports bangs. Bangs are shortcuts for supporting sites. For example, the !ubuntuf bang is for the Ubuntu Forums. !zdnet is for ZDNET. So you could search my name on ZDNET with the bang:

ddgr \!zdnet jack wallen

It’s important to note that you do have to place the backslash before the ! (bang), otherwise the command will not work.

You can find different ways to use ddgr on the official site.

Also: How to get started with Git on Linux

And that’s all there is to adding a powerful DuckDuckGo-based search command to the Linux terminal. When you consistently have a terminal window open, this is a great way to search.

Source Link

LEAVE A REPLY

Please enter your comment!
Please enter your name here