Search DuckDuckGo from Terminal in Ubuntu Linux via ddgr Command

For command line users want to search on DuckDuckGo, ddgr is the free open-source tool to search from Linux terminal.

It’s a tiny tool written mostly in Python3. And it’s quite easy to use. For instance, run the command below will search ‘Windows 11’ and output 10 results per page.

ddgr Windows 11

You can then type n / p / f and hit Enter to go next page, previous page, or to the first page.

By typing o 1 will open the first result, and c 1 will copy the first URL into clipboard. And you can type ? to get more actions in the search output.

Result number per page can be set via --num. And you can specified website to search via --site flag.

Advertisements

For example, search Ubuntu 21.10 on Ubuntu.com with 3 results per page, run:

ddgr --num 3 --site ubuntu.com ubuntu 21.10

To automatic open the first result in web browser, use -j or --ducky flag. For example:

ddgr --ducky Windows 11

For Ubuntu Server without desktop UI, you can firstly specify text-based web browser, w3m in the case, easily via:

export BROWSER=w3m

Other features include:

  • DuckDuckGo Bangs
  • Search and option completion scripts (Bash, Fish, Zsh)
  • Search file type: filetype:mime
  • HTTPS proxy support
  • Do Not Track set by default

How to Install ddgr in Ubuntu:

The nifty tool is available in Ubuntu repositories. You can install it simply by running command in terminal:

sudo apt install ddgr

As Ubuntu does not provide the software updates, you can always get the latest .deb package from the link below:

ddgr Github releases