LinuxCommandLibrary

ddgr

Search DuckDuckGo from the command line

TLDR

Start in interactive mode

$ ddgr
copy

Search DuckDuckGo for a keyword
$ ddgr [keyword]
copy

Limit the number of search results to n
$ ddgr [[-n|--num]] [n] [keyword]
copy

Display the complete URL in search results
$ ddgr [[-x|--expand]] [keyword]
copy

Search DuckDuckGo for a keyword and open the first result in the browser
$ ddgr !w [keyword]
copy

Perform a website-specific search
$ ddgr [[-w|--site]] [site] [keyword]
copy

Search for a specific file type
$ ddgr [keyword] filetype:[filetype]
copy

Display help in interactive mode
$ <?>
copy

SYNOPSIS

ddgr [options...] [query]

PARAMETERS

-h, --help
    Display help and exit

-V, --version
    Show version and exit

-n N, --num N
    Results per page (default: 10, max: 20)

-N
    First page only; no next-page prompt

-p P, --npages P
    Pages to fetch (default: 1)

-t
    First result tab only (no !bangs)

-x
    First result link only

-b
    Always open browser for result links

-l
    Browser links only (no title/desc)

-r
    Disable browser entirely

-O
    Open selected result page in browser

-B
    Open selected result link in browser

-g
    Use google.com instead

-s
    Use startpage.com

-S
    Use searx instance

-j, --json
    JSON output for scripting

-v, --verbose
    Toggle verbose output

-C, --nocolor
    Disable colors

-d, --debug
    Debug mode

-D
    Debug JSON

-e
    Edit result JSON

DESCRIPTION

ddgr is a fast, feature-rich command-line tool for searching via DuckDuckGo, prioritizing user privacy with no tracking. It displays clean, formatted results in your terminal pager (like less), supporting navigation across pages, result tabs (e.g., articles, images), and direct browser opening.

Key strengths include customizable result counts (up to 20 per page), JSON output for scripting, debug modes, and engine variants like Startpage or Searx. Select results with numbers or vi/emacs keys, then open links, tabs, or full pages in your default browser. It's lightweight, vim-like interface optional, and respects !bangs for site-specific searches. Ideal for CLI enthusiasts avoiding browser overhead, with colors, verbose logging, and config for personalization. No dependencies beyond Python and a browser; install via pip, distro packages, or GitHub.

CAVEATS

Requires internet; graphical browser for -b, -O (falls back to text browser in TTY). Vim/emacs bindings need readline. Rate-limited by DuckDuckGo.

CONFIGURATION

Edit ~/.config/ddgr/ddgr.conf for browser (browse=firefox), colors, lines (lines=20), json (json_output_file). Supports ~/.config/ddgr/config.

KEY BINDINGS

Arrow keys or j/k (vim), number+Enter selects; q quits; / searches within results; h help.

INSTALLATION

pip install ddgr; or git clone https://github.com/jarun/ddgr; distro: apt install ddgr (Debian), pacman -S ddgr (Arch).

HISTORY

Created by jarun in 2017 as open-source (GPL-3.0) on GitHub. Actively maintained with Python 3 rewrite in v2 (2021); over 10k stars, used in distros like Arch, Fedora.

SEE ALSO

googler(1), lynx(1), w3m(1), curl(1)

Copied to clipboard