How to Search DuckDuckGo from the Linux Terminal?


Linux is an open-source operating system that has been gaining popularity over the years. Known for its flexibility, stability, and security, Linux is widely used by developers, sysadmins, and tech enthusiasts. In this tutorial, we will be exploring how to search DuckDuckGo from the Linux terminal.

First, let's talk about what DuckDuckGo is. DuckDuckGo is a search engine that prioritizes user privacy by not tracking its users or collecting personal information. It's becoming increasingly popular as people become more concerned about their online privacy. Now, for searching Duck Duck go from the Linux terminal, we’re going to use a command line tool. This means you don't have to open a web browser and navigate to the DuckDuckGo website every time you want to search for something. Let’s move to the next section of this article to understand how can we achieve the same.

How to Search DuckDuckGo from the Linux Terminal?

To search DuckDuckGo from the Linux terminal, we'll be utilizing a command-line tool called DDGR.

DDGR is a command-line tool that allows you to search the DuckDuckGo search engine from the Linux terminal. It stands for "DuckDuckGo from the terminal using Python." Using ddgr, you can perform searches on DuckDuckGo without opening a web browser, and since DuckDuckGo prioritizes user privacy, your searches are not tracked.

First, let’s install ddgr on our Linux terminal 

The installation process of ddgr is straightforward and hassle-free. Most Linux distributions come with Python pre-installed, so there's no need to install it separately. To install ddgr, simply open your terminal and enter the following command 

sudo pip3 install ddgr

This command will install ddgr using the pip package manager. If you don't have pip installed, you can install it by running the following command 

sudo apt-get install python3-pip

Once you have pip installed, you can run the above command to install ddgr.

If you're using a different Linux distribution that doesn't use apt-get, you can use your package manager to install pip and then use pip to install ddgr.

For example, on Fedora, you can install pip using the following command −

sudo dnf install python3-pip

And then use pip to install ddgr −

sudo pip3 install ddgr

For Arch-based Linux distributions, you can use the following commands instead 

sudo pacman -S python-pip
sudo pip install ddgr

Once ddgr is installed, you're ready to start searching DuckDuckGo from the terminal. In the next section of the article, we're going to show you how to use ddgr to search DuckDuckGo.

USING DDGR

With DDGR, we can search DuckDuckGo using the following command −

ddgr [options] query

Here, the "options" are optional arguments that can modify the behavior of ddgr, and "query" is the search term you want to search on DuckDuckGo.

For example, if we want to search for "linux tutorial" on DuckDuckGo using ddgr, we can simply enter the following command in the terminal 

Example

ddgr linux tutorial

When you run the command "ddgr linux tutorial" in the terminal, ddgr will fetch and display the search results related to "linux tutorial" on DuckDuckGo, directly in the terminal window. The output will be in the form of a list, with each item representing a search result. The output will include the title of the result, the URL, and a brief description of the result. You can use the arrow keys to scroll through the list of search results.

Output

$ ddgr linux tutorial
1. Linux Tutorial - A Beginner's Guide to Get Started - Guru99
https://www.guru99.com/linux-tutorial.html
In this Linux tutorial, we will learn: The basic concepts of Linux. Introduction to the Linux operating system.

2. Learn Linux - Free Interactive Online Tutorial
https://www.learnshell.org/
Learn Linux commands interactively through the web browser. A list of the most commonly used Linux commands.

3. How to Install Linux (with Pictures) - wikiHow
https://www.wikihow.com/Install-Linux
How to Install Linux. Linux is an open-source operating system that has been around for many years and is widely used for servers and supercomputers. It is also ...

4. Learn Linux in a Month of Lunches - Manning Publications
https://www.manning.com/books/learn-linux-in-a-month-of-lunches
Learn Linux in a Month of Lunches is a tutorial designed to take you from novice to Linux command line guru in just 22 lessons, each taking less than an hour.

5. The Complete Beginner's Guide to Linux - Linux.com
https://www.linux.com/training-tutorials/complete-beginners-guide-linux/
If you're looking to learn how to use Linux, and want to start with Ubuntu - one of the most popular Linux distributions available - this guide is for you. We'll take ...

6. How To Learn Linux? - devconnected
https://devconnected.com/how-to-learn-linux/
This tutorial will explain how you can learn Linux, whether you're completely new to the Linux operating system or you're a seasoned professional.

...

This is an example output of the search results for "linux tutorial" on DuckDuckGo using ddgr. Each item in the list represents a search result and includes the title, URL, and description of the result. You can scroll through the list using the arrow keys.

DDGR Options

1. Image Search

Now, let's try some advanced searches. For example, if we want to search for images related to "linux," we can use the "-i" option, like this:

ddgr -i linux

The above command searches for results related to "linux" on DuckDuckGo and displays the results interactively. The interactive mode allows you to browse through the results more easily and select the one you want to visit. Once you run the command, you will be presented with a list of search results. You can use the arrow keys to navigate through the list, and press Enter to select the result you want to visit.

2. News Search Results and Wikipedia Results

We can also use the "-n" option to display news search results, and the "-w" option to display Wikipedia search results.

ddgr -n linux

The above command searches for news results specifically related to "linux" on DuckDuckGo, and displays the results in a numbered list.

Similarly, we can search on Wikipedia using the `-w` option −

ddgr -w linux

By executing this command, you can carry out a targeted search on Wikipedia and conveniently obtain a numbered list as the output, providing you with quick and organized results within your terminal.

3. DuckDuckGo's "Safe Search"

By default, ddgr uses DuckDuckGo's "Safe Search" feature to filter out explicit content. However, if you want to turn this feature off, you can use the "--unsafe" option.

ddgr --unsafe linux

Using the "--unsafe" option may result in potentially offensive or explicit content being displayed in the search results, so use it with caution.

Conclusion

This article outlines the process of searching for content on DuckDuckGo through the Linux terminal using the DDGR tool. By utilizing DDGR, users can perform searches on DuckDuckGo without the need for a web browser. Additionally, DuckDuckGo's commitment to user privacy ensures that your searches are not tracked. The article also covers the installation process and various options for the ddgr command.

Updated on: 27-Jul-2023

140 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements