DuckDuckGo from the Terminal
Bangs and Browsers
The main DuckDuckGo search engine offers a very useful feature called bangs. This allows you to search certain websites without using a search engine at all. This is done using a ! plus DuckDuckGo's particular code for that website. For example, if you wanted to search YouTube for videos of cute, fluffy kittens, you'd enter !yt fluffy kittens into the search bar. Searches are run in exactly the same way on ddgr, with only a backslash added (Figure 6), for example:
ddgr \!yt fluffy kittens
Bangs are available for other mainstream websites, too, such as Wikipedia, Amazon, and even Google itself. If you're not familiar with DuckDuckGo, their blog has a full list of available websites [8].
If you already used a text-based browser, you can pass search results to it from ddgr. This is done using the BROWSER
variable. To do this on a one-time basis, just run your search with your browser name, e.g., BROWSER=lynx ddgr lighthouses
. For this session, any search results you open in ddgr will be displayed in the Lynx browser (Figure 7).
This is where the d
flag can come in handy, because if you want to keep passing ddgr search results to the browser for this session, you can just enter d
with the search term at the omniprompt (e.g., d museums
).
If you want ddgr to always pass results to your text-based browser, you'll need to add this to the .bashsrc
file and specify its name, for example:
echo export BROWSER=lynx >> ~/.bashrc
Currently ddgr supports ELinks, Links, Lynx, w3m, and www-browser out of the box.
A Word on Tor
DuckDuckGo has a good relationship with the Tor Project, given that their search engine is used by the Tor Browser. The Tor Project said they chose DuckDuckGo because the search engine doesn't log or collect your personal information [9]. DuckDuckGo even has its own Tor hidden service (.onion
) address and operates its own Tor exit enclave [10].
In light of this, if you do want to run DuckDuckGo searches over Tor, by far the simplest way is just to download and use the Tor Browser, which also doesn't record any activity and is optimized for your privacy. Still, ddgr does also support searches over Tor, with some extra help. The utility itself can connect to the Internet via an HTTPS proxy. The Tor command-line utility uses a SOCKS5 proxy, so in order to get the two talking, you need to use a non-caching web proxy such as Privoxy.
This isn't too hard to set up. If you're running a Debian-based installation, just open a new terminal instance and enter
sudo apt-get install tor privoxy
Next, configure Privoxy to use Tor by editing /etc/privoxy/config
:
sudo nano /etc/privoxy/config
Scroll to the end and add the text
forward-socks4a / localhost:9050 .
Save and exit. You'll next need to restart both Privoxy and Tor for these changes to take effect:
sudo /etc/init.d/privoxy restart sudo service tor restart
You'll now be the proud owner of a local HTTP proxy using Tor on port 8118. This means you can now use Tor with ddgr with the --proxy
parameter to run searches via the Tor network (Figure 8), such as:
ddgr --proxy localhost:8118 lighthouses
To my disappointment during testing, I wasn't able to use this feature to search within .onion
domains such as the address for the New York Times website using the -w
flag. This would have been a useful feature, but in fairness, the developer doesn't claim that the utility can access Tor hidden services, just that it can run searches using Tor. Naturally if you want this extra level of privacy, be prepared for much longer search times because your data will be routed through various Tor relays.
DuckDuckGo for It
There's a lot to be said for searching the web via your command line: It's clean, it's quick, and with time, very easy to navigate. You can link parameters together to fine-tune your search results, all without handing your personal information over to the gods of Google.
We've also only touched briefly on the multitude of command-line parameters available in ddgr. There are so many, in fact, that the utility does away with the usual config file because everything is right there in the program. Other features include displaying results in different colors, listing searches in reverse order, and even exporting them in JSON format (presumably for research purposes).
Although ddgr and googler have the same creator, the search engines they represent have very different business models. One is committed to harvesting all your data to serve your targeted advertising; the other might show you the occasional ad but isn't collecting any information in doing so.
Ridding yourself of a conventional browser when searching is also a great way to prevent snoopers who want to "fingerprint" your browser through nefarious methods such as playing sounds or drawing complex, invisible images on your web page. Still, at some point you'll need to open your browser to view these results.
If you're happy to use a text-based browser all the time, you'll be shielded from most of the nastier browser fingerprinting and tracking techniques out there. For those who still prefer a GUI, make sure to check your browser settings to ensure Do Not Track is enabled and use a reliable ad blocker to filter out most malicious URLs. Consider also installing an extension to block third-party/cross-site cookies such as Ghostery [11].
Infos
- Android Open Source Project: https://source.android.com/
- "Google Fined $57M by Data Protection Watchdog Over GDPR Violations": https://digitalguardian.com/blog/google-fined-57m-data-protection-watchdog-over-gdpr-violations
- "Why Should I Use DuckDuckGo Instead of Google?": https://spreadprivacy.com/why-use-duckduckgo-instead-of-google/
- "Adding DuckDuckGo to Your Browser": https://help.duckduckgo.com/duckduckgo-help-pages/desktop/adding-duckduckgo-to-your-browser/
- jarun (Arun) on GitHub: https://github.com/jarun
- Ubuntu man page – xsel: https://manpages.ubuntu.com/manpages/xenial/en/man1/xsel.1x.html
- DuckDuckGo parameters: https://help.duckduckgo.com/duckduckgo-help-pages/settings/params/
- "DuckDuckGo Bangs – Search Directly On Your Favorite Websites": https://ostechnix.com/duckduckgo-bangs-search-directly-on-your-favorite-websites/
- Tor Project – Support: https://support.torproject.org/tbb/tbb-41/
- Tor Exit Enclave – DuckDuckGo Help Pages: https://help.duckduckgo.com/privacy/tor-exit-enclave/
- Ghostery free ad blocker extension: https://www.ghostery.com/ghostery-ad-blocker
« Previous 1 2
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Fedora KDE Approved as an Official Spin
If you prefer the Plasma desktop environment and the Fedora distribution, you're in luck because there's now an official spin that is listed on the same level as the Fedora Workstation edition.
-
New Steam Client Ups the Ante for Linux
The latest release from Steam has some pretty cool tricks up its sleeve.
-
Gnome OS Transitioning Toward a General-Purpose Distro
If you're looking for the perfectly vanilla take on the Gnome desktop, Gnome OS might be for you.
-
Fedora 41 Released with New Features
If you're a Fedora fan or just looking for a Linux distribution to help you migrate from Windows, Fedora 41 might be just the ticket.
-
AlmaLinux OS Kitten 10 Gives Power Users a Sneak Preview
If you're looking to kick the tires of AlmaLinux's upstream version, the developers have a purrfect solution.
-
Gnome 47.1 Released with a Few Fixes
The latest release of the Gnome desktop is all about fixing a few nagging issues and not about bringing new features into the mix.
-
System76 Unveils an Ampere-Powered Thelio Desktop
If you're looking for a new desktop system for developing autonomous driving and software-defined vehicle solutions. System76 has you covered.
-
VirtualBox 7.1.4 Includes Initial Support for Linux kernel 6.12
The latest version of VirtualBox has arrived and it not only adds initial support for kernel 6.12 but another feature that will make using the virtual machine tool much easier.
-
New Slimbook EVO with Raw AMD Ryzen Power
If you're looking for serious power in a 14" ultrabook that is powered by Linux, Slimbook has just the thing for you.
-
The Gnome Foundation Struggling to Stay Afloat
The foundation behind the Gnome desktop environment is having to go through some serious belt-tightening due to continued financial problems.