DDGR(1)

๐Ÿ“ฆ
version 2.2 ยท 3 versions
, in arch rolling, debian trixie, epel 10, epel 9, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu resolute, ubuntu stonking

ddgr ๐Ÿ’– the DuckDuckGo-in-your-terminal bestie

okay so first things first, bestie: this whole page is the manual for ddgr, and it lives in the User Commands section of your man pages, and it's ddgr(1). yes it's a man page. yes it's about to be cute. let's GO ๐Ÿฆ‹


โœจ NAME โœจ

ddgr โ€” DuckDuckGo from the terminal ๐Ÿฆ†๐Ÿ’ป


โœจ SYNOPSIS โœจ

ddgr [OPTIONS] [KEYWORD [KEYWORD ...]]

โœจ DESCRIPTION โœจ

okay so ddgr is a command-line tool that lets you search DuckDuckGo (the html version, specifically) straight from your terminal, no browser tab chaos required ๐Ÿ’… For every result it shows you the title, the URL and the text context. Results come in pages, and there are keyboard shortcuts for flipping between those pages. Every result gets an index number, and you can pop a result URL open in a browser just by using that index. There's no configuration file, because aliases do the exact same job for this utility. And it supports sequential searches in a single instance, which is lowkey the best part. โœจ

๐ŸŒธ Features ๐ŸŒธ

  • Fast and clean; custom color ๐ŸŽจ
  • Designed for maximum readability at minimum space ๐Ÿ‘‘
  • Instant answers (supported by DDG html version) โšก
  • Custom number of results per page
  • Navigation, browser integration ๐ŸŒ
  • Search and option completion scripts (Bash, Fish, Zsh) ๐ŸŸ
  • DuckDuckGo Bangs (along with completion) โ—
  • Open the first result in browser (I'm Feeling Ducky) ๐Ÿฆ†
  • REPL for continuous searches ๐Ÿ”
  • Keywords (e.g. filetype:mime, site:somesite.com)
  • Limit search by time, specify region, disable safe search
  • HTTPS proxy support, optionally disable User Agent
  • Do Not Track set by default ๐Ÿ™…
  • Supports custom url handler script or cmdline utility
  • Thoroughly documented, man page with examples ๐Ÿ“š
  • Minimal dependencies ๐Ÿƒ

โœจ OPTIONS โœจ

  • -h, --help โ€” shows the help text and dips. ๐Ÿ‘‹
  • -n, --num=N โ€” show N results per page (default 10). N has to be between 0 and 25. and listen, N=0 is a whole vibe: it disables fixed paging and just shows the actual number of results fetched per page. ๐Ÿ“
  • -r, --reg=REG โ€” region-specific search, like 'us-en' for US (that's the default btw); go visit https://duckduckgo.com/params to find yours. ๐ŸŒ
  • -C, --nocolor โ€” disables color output. (sad but valid, sometimes you just want plain ๐Ÿฅฒ)
  • --colors=COLORS โ€” set your output colors. details live in the COLORS section below, keep scrolling bestie ๐Ÿ‘‡
  • -j, --ducky โ€” opens the first result in a web browser; it implies --noprompt. Feeling Ducky? ๐Ÿฆ†โœจ
  • -t, --time=SPAN โ€” time-limit your search [d=past day, w=past week, m=past month, y=past year] (default=any time). โณ
  • -w, --site=SITE โ€” search a site using DuckDuckGo. ๐Ÿ”
  • -x, --expand โ€” expand URLs instead of showing only the domain name (this is the default, iconic behaviour). ๐Ÿ’…
  • -p, --proxy=URI โ€” tunnel traffic through an HTTP proxy. URI looks like [http[s]://][user:pwd@]host[:port]. The proxy server must support HTTP CONNECT tunneling and must not block port 443 for the relevant DuckDuckGo hosts. If you don't explicitly hand over a proxy, the https_proxy or HTTPS_PROXY environment variable (if it's available) gets used instead. ๐Ÿš‡
  • --unsafe โ€” disable safe search. (living dangerously, no cap ๐Ÿซฃ)
  • --noua โ€” disable user agent. Results are fetched faster. ๐Ÿƒโ™€๏ธ
  • --json โ€” output in JSON format; implies --noprompt. ๐Ÿค–
  • --gb, --gui-browser โ€” open a bang directly in a GUI browser. ๐Ÿ–ฅ๏ธ
  • --np, --noprompt โ€” perform the search and exit; don't prompt for any further interactions. ๐Ÿšช
  • --rev, --reverse โ€” list the entries in reversed order. ๐Ÿ”„
  • --url-handler=UTIL โ€” custom script or command-line utility to open urls with. ๐Ÿ› ๏ธ
  • --show-browser-logs โ€” do not suppress browser output when opening a result in a browser; that is, connect stdout and stderr of the browser to ddgr's stdout and stderr instead of /dev/null. By default, browser output is suppressed (because certain graphical browsers just be spewing messages to console) โ€” unless the BROWSER environment variable is a known text-based browser: elinks, links, lynx, w3m or www-browser. ๐Ÿ—ฃ๏ธ
  • -v, --version โ€” show the version number and exit. ๐Ÿ”ข
  • -d, --debug โ€” enable debugging. ๐Ÿ›

โœจ OMNIPROMPT KEYS โœจ

  • n, p, f โ€” fetch the next, previous or first set of search results. โฎ๏ธโญ๏ธ
  • index โ€” open the result corresponding to index in the browser. ๐ŸŒ
  • o [index|range|a ...] โ€” open space-separated result indices, numeric ranges, or all indices (if 'a' is specified) in the browser. ๐Ÿซถ
  • O [index|range|a ...] โ€” works similar to key 'o', but it tries to ignore text-based browsers (even if BROWSER is set) and open links in a GUI browser instead. ๐Ÿ–ฅ๏ธ
  • d keywords โ€” initiate a new DuckDuckGo search for keywords with the original options. You use this key to search omniprompt keys (including itself!) and indices. iykyk ๐Ÿ‘€
  • x โ€” toggle url expansion. ๐Ÿ”€
  • c index โ€” copy url to clipboard. ๐Ÿ“‹
  • q, ^D, double Enter โ€” exit ddgr. bye bestie ๐Ÿ’œ
  • ? โ€” show omniprompt help. โ“
  • * โ€” any other string initiates a new search with the original options. ๐ŸŒŸ

โœจ COLORS โœจ

ddgr lets you customize the color scheme via a six-letter string, which is giving major BSD LSCOLORS energy. Those six letters represent the colors of:

  • indices
  • titles
  • URLs
  • metadata/publishing info
  • abstracts
  • prompts

respectively. (in that exact order, don't mix them up ๐ŸŽ€)

You pass that six-letter string in either as the argument to the --colors option, or as the value of the environment variable DDGR_COLORS. โœจ

Here's the menu of colors/styles, no tables needed, we're doing bullets because we're cute like that:

  • a โ€” black
  • b โ€” red
  • c โ€” green
  • d โ€” yellow
  • e โ€” blue
  • f โ€” magenta
  • g โ€” cyan
  • h โ€” white
  • i โ€” bright black
  • j โ€” bright red
  • k โ€” bright green
  • l โ€” bright yellow
  • m โ€” bright blue
  • n โ€” bright magenta
  • o โ€” bright cyan
  • p โ€” bright white
  • A-H โ€” bold version of the lowercase-letter color
  • I-P โ€” bold version of the lowercase-letter bright color
  • x โ€” normal
  • X โ€” bold
  • y โ€” reverse video
  • Y โ€” bold reverse video

The default colors string is oCdgxy, which stands for:

  • bright cyan indices
  • bold green titles
  • yellow URLs
  • cyan metadata/publishing info
  • normal abstracts
  • reverse video prompts

Now, some tea you need to know โ˜•:

  • Bright colors (implemented as \x1b[90m - \x1b[97m) may not be available in all color-capable terminal emulators;
  • Some terminal emulators draw bold text in bright colors instead;
  • Some terminal emulators only distinguish between bold and bright colors via a default-off switch.

Please consult the manual of your terminal emulator as well as https://en.wikipedia.org/wiki/ANSI_escape_code for details. ๐Ÿงš


โœจ ENVIRONMENT โœจ

  • BROWSER โ€” overrides the default browser. Ref: http://docs.python.org/library/webbrowser.html
  • DDGR_COLORS โ€” refer to the COLORS section. ๐ŸŽจ
  • DISABLE_PROMPT_COLOR โ€” force a plain omniprompt if you're facing issues with colors at the prompt. ๐Ÿ™ˆ
  • HTTPS_PROXY, https_proxy โ€” refer to the --proxy option. ๐Ÿš‡

โœจ EXAMPLES โœจ

  1. DuckDuckGo hello world:
ddgr hello world
  1. I'm Feeling Ducky search:
ddgr -j lucky ducks
  1. DuckDuckGo Bang search 'hello world' in Wikipedia:
ddgr !w hello world
ddgr \!w hello world // bash-specific, need to escape ! on bash

Bangs work at the omniprompt too. To look up bangs, visit https://duckduckgo.com/bang?#bangs-list. โ—

  1. Bang alias to fire from the cmdline, open results in a GUI browser and exit:
alias bang='ddgr --gb --np'

bang !w hello world
bang \!w hello world // bash-specific, need to escape ! on bash
  1. Website specific search:
ddgr -w amazon.com digital camera

Site specific search continues at omniprompt. ๐Ÿ›๏ธ

  1. Search for a specific file type:
ddgr instrumental filetype:mp3
  1. Fetch results on IPL cricket from India in English:
ddgr -r in-en IPL cricket

To find your region parameter token visit https://duckduckgo.com/params. ๐Ÿ

  1. Search quoted text:
ddgr it\'s a \"beautiful world\" in spring
  1. Show complete urls in search results (instead of only domain name):
ddgr -x ddgr
  1. Use a custom color scheme, e.g., one warm color scheme designed for Solarized Dark:
ddgr --colors bjdxxy hello world

DDGR_COLORS=bjdxxy ddgr hello world
  1. Tunnel traffic through an HTTPS proxy, e.g., a local Privoxy instance listening on port 8118:
ddgr --proxy localhost:8118 hello world

By default the environment variable https_proxy (or HTTPS_PROXY) is used, if defined. ๐Ÿš‡

  1. Look up n, p, o, O, q, d keywords or a result index at the omniprompt: as the omniprompt recognizes these keys or index strings as commands, you need to prefix them with d, e.g.,
d n
d d keywords
d 1

โœจ AUTHOR โœจ

Arun Prakash Jana <engineerarun@gmail.com> ๐Ÿ‘‘


โœจ HOME โœจ

https://github.com/jarun/ddgr ๐Ÿ 


โœจ REPORTING BUGS โœจ

https://github.com/jarun/ddgr/issues ๐Ÿ› (be nice, they're doing great)


โœจ LICENSE โœจ

Copyright ยฉ 2016-2024 Arun Prakash Jana <engineerarun@gmail.com>

License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

fr fr, that's a real "no warranty" โ€” like, to the extent permitted by law, none. bestie said it, not me. ๐Ÿ’€

and that's the whole page, bestie ๐ŸŽ€ this manual is Version 2.2, dated 29 Dec 2023, and it goes out to you from the User Commands section of the man pages as ddgr(1). now go search something, you're gonna slay ๐Ÿฆ†๐Ÿ’…โœจ