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 Asahi 40 Remix Available for Macs with Apple Silicon
If you've been anticipating KDE's Plasma 6 for your Apple Silicon-powered Mac, then you're in luck.
-
Red Hat Adds New Deployment Option for Enterprise Linux Platforms
Red Hat has re-imagined enterprise Linux for an AI future with Image Mode.
-
OSJH and LPI Release 2024 Open Source Pros Job Survey Results
See what open source professionals look for in a new role.
-
Proton 9.0-1 Released to Improve Gaming with Steam
The latest release of Proton 9 adds several improvements and fixes an issue that has been problematic for Linux users.
-
So Long Neofetch and Thanks for the Info
Today is a day that every Linux user who enjoys bragging about their system(s) will mourn, as Neofetch has come to an end.
-
Ubuntu 24.04 Comes with a “Flaw"
If you're thinking you might want to upgrade from your current Ubuntu release to the latest, there's something you might want to consider before doing so.
-
Canonical Releases Ubuntu 24.04
After a brief pause because of the XZ vulnerability, Ubuntu 24.04 is now available for install.
-
Linux Servers Targeted by Akira Ransomware
A group of bad actors who have already extorted $42 million have their sights set on the Linux platform.
-
TUXEDO Computers Unveils Linux Laptop Featuring AMD Ryzen CPU
This latest release is the first laptop to include the new CPU from Ryzen and Linux preinstalled.
-
XZ Gets the All-Clear
The back door xz vulnerability has been officially reverted for Fedora 40 and versions 38 and 39 were never affected.