DuckDuckGo from terminal


Here is the end result how you can open the Duckduckgo search in your favorite browser, straight from the terminal:

? What does number 42 mean

I'm using macOS in this post.

Requirement brew install jq

In your bash config, e.g .zshrc add the following

  local args="$@"
  jq -nr --arg v "$args" '$v|@uri';

  open "$(urlencode "$@")"

alias '?'='duckduckgo'

Open in specific browser

If you want to open the result in spesific browser instead of your system default, you can e.g make a small change to open it in Firefox like this:

open -a firefox  "$(urlencode "$@")"

Open the Duckduckgo in terminal

If you are hardcore user of the terminal you can instead use the following (this is the original way that was used by the Heiker)

lynx "$(urlencode "$@")"


Idea is based on the Heiker's bash alias on comments

  • duckduckgo
  • terminal