Browser-based search engines are what most people think about when searching the web. If you’re a developer, you may find searching the internet through command line prompts quicker and easier. 

Using DuckDuckGo in conjunction with a Linux terminal is a convenient way to search online without switching over to a web browser. You can have a lot of control over the results when you know the right search queries, and we’ve pulled some of the most useful options together for you. 

Also Read: Tips to enhance Linux Security

Why should I use DuckDuckGo for search?

DuckDuckGo is a search engine that’s dedicated to privacy. It’s committed to not tracking your searches, unlike Google, which logs what you search for and uses that data to target ads at you. 

Since it’s not as well known as Google or Bing, most people’s first thought will be “is DuckDuckGo safe?” While every search engine has its vulnerabilities, it’s generally safe to use – although it doesn’t encrypt your browsing, so it’s a good idea to still use a VPN.

Along with increased security, some of the other benefits of using the command line function of DuckDuckGo include:

  • You get fast results;
  • The results you get are easy to navigate with your keyboard;
  • The results still integrate with your browser;
  • There are a few dependencies to be aware of.

Plus, there are lots of ways to filter your results with different prompts, which is what we’re looking at next. 

How to use DuckDuckGo on a Linux terminal

The first step to being able to use DuckDuckGo to search from your Linux terminal is to download the right tool for the distro you’re using. 

With multiple versions of Linux available, the best thing to do is search for the version you use and how to install ddgr on it. Once it’s installed, you’ll be able to search using the ddgr function; here is our list of the different ways you can take advantage of ddgr on your Linux terminal. 

Complete a simple search

Starting with the basics, you need to know how to search using DuckDuckGo in your Linux terminal. It’s pretty simple – you simply need to open your terminal in the command line, type

# ddgr  your search query

For example, this could be 

# ddgr waterfalls

Your results will return in HTML format in the same window. The next couple of options are going to show you how you can navigate and view the results, too. 

To control the number of results

You can easily control the number of results you get back – the default will be the top-ten results. You might want just the top three or a list of the top 20 returns for your query – either way, you just need to type in:

# ddgr -n X your search query

In this function, replace X with the number of results you want to be shown. 

To open a specific result

Now you have the search query in front of you, how do you go about accessing the information you want? 

Each result will be numbered, so in the omniprompt – which you will see after you’ve made the ddgr query in the terminal – you can type in the number of the return you want to view and hit enter.

Define the browser you want to view the results in

Sometimes, you’ll want to control which browser you use to view the results. You may want a text-based browser to get some specific information, for example. 

To make this happen with ddgr, you’ll type into the command line:

# BROWSER=broswername ddgr your search query

I’m feeling Ducky

You know how Google has the “I’m Feeling Lucky” option when you search? The button that takes you to the site of the first result without showing you the list of options? Well, DuckDuckGo has this option, called “I’m feeling Ducky”, and it translates into a ddgr query as well. 

To use this feature, type in: 

# ddgr -j lucky your search query

Using !bangs

An interesting feature of DuckDuckGo is !bangs. Whether using ddgr or the normal browser engine, you can use a bang to search specifically within another site, such as Wikipedia, iMDb, Amazon, etc. 

There are over 1,000 bangs you can use, which are listed here, and here’s what to type to use them with ddgr:

# ddgr !bang your search query

Say you wanted to see what was being said on Twitter about the NFL, you’d type:

# ddgr !tw nfl

Site-specific searches

Sometimes you want to search one specific site for some information. You can do this with ddgr by typing in, for example: 

# ddgr -w powerbank

Specific file types

To search for a certain file type, like an image or a PDF, you can specify with a ddgr search what file type you want to return. Here’s an example of how that you would type that in:

# ddgr kittens filetype:jpg

Using DuckDuckGo on your Linux terminal

It can be super helpful to search through your Linux terminal rather than having to click over to a browser. Using the ddgr search function can speed up your work and give you more control over the results that you see. 

We are giving you exclusive deals to try Linux Servers for free with 100$ credit, check these links to claim your 100$,

DigitalOcean - 100$ free credit & Linode - 100$ free credit

Check some Exclusive Deals, HERE.

Also, check out DevOps Book You should read section.