ddgr
Search DuckDuckGo from the command line
TLDR
Start in interactive mode
Search DuckDuckGo for a keyword
Limit the number of search results to n
Display the complete URL in search results
Search DuckDuckGo for a keyword and open the first result in the browser
Perform a website-specific search
Search for a specific file type
Display help in interactive mode
SYNOPSIS
ddgr [OPTIONS] [KEYWORDS...]
PARAMETERS
-n, --num <num>
Specify the number of results to display per page.
-r, --region <region>
Set the search region (e.g., 'us-en', 'uk-en').
-l, --lang <lang>
Set the search language (e.g., 'en', 'fr').
-x, --no-url-preview
Do not show full URL previews for search results.
--unsafe
Disable Safe Search filters, potentially showing explicit content.
--proxy <url>
Specify an HTTP/SOCKS proxy (e.g., 'socks5://localhost:9050').
--pager <pager_cmd>
Use a custom pager command instead of the default (e.g., 'more').
--colors <scheme>
Apply a custom color scheme for result presentation.
--json
Output results in JSON format.
--url-only
Show only the URLs of the search results.
-h, --help
Display a help message and exit.
-v, --version
Show program's version number and exit.
DESCRIPTION
ddgr is a powerful command-line utility that allows users to search DuckDuckGo directly from their terminal.
It is designed for privacy-conscious users and those who prefer a keyboard-driven workflow. Similar to googler, ddgr fetches search results and presents them in a clean, text-based format, often using a pager like less for easy navigation. Users can then select a result to open it in their default web browser.
Key features include support for custom color schemes, regional and language-specific searches, disabling safe search, proxy support, and integration with terminal features like tab completion. It's an excellent tool for quick lookups, scripting, or when working in a server environment without a graphical interface, providing a fast and privacy-friendly way to access web information.
CAVEATS
ddgr requires Python to run. While robust, its functionality relies on the scraping capabilities of DuckDuckGo's search interface, which could theoretically change and break compatibility. For fully interactive browsing of selected links within the terminal, a text-based browser like w3m or lynx may be required, depending on configuration.
CONFIGURATION FILE
ddgr can be configured globally or per-user via a configuration file, typically located at ~/.config/ddgr/config. This file allows persistent settings for options like the default number of results, preferred region, language, and color schemes, eliminating the need to specify them with command-line flags for every search.
INTERACTIVE SEARCH MODE
When ddgr is invoked without any search keywords (i.e., just ddgr), it enters an interactive search mode. In this mode, users are prompted to enter search queries one by one, allowing for continuous searching without re-typing the command. This is particularly useful for multiple consecutive searches.
BROWSER INTEGRATION
By default, ddgr opens selected search results in your system's default web browser. This behavior is managed by the BROWSER environment variable or system-wide browser configurations, ensuring a seamless transition from the terminal to a full web browsing experience for specific links.
HISTORY
ddgr was created by Arun Prakash Jana, drawing inspiration from his prior work on googler, a similar command-line interface for Google Search. It emerged from the need for a privacy-focused command-line search tool that leverages DuckDuckGo's emphasis on user privacy and minimal tracking. Its development focused on providing a lightweight, fast, and feature-rich terminal experience for web searching, quickly gaining popularity among Linux users and developers seeking efficient command-line workflows.