Guide · Open source
How to use howdoi: instant coding answers in the terminal
Updated · written with AI from the project's own documentation and checked against our catalogue data
howdoi is a free, open-source Python command-line tool that answers plain-language programming questions, such as how to format a date in bash, without opening a browser. This guide shows you how to install it, run queries, use the most useful options and decide whether it fits your workflow. By the end you will be able to get code answers from your terminal and adjust how many results you see.
Quick start
- 1Check Python and pip. Confirm you have Python 3.7 or newer and pip installed. Python 2.7 is not supported.
- 2Install howdoi. Run pip install howdoi, or brew install howdoi if you use Homebrew.
- 3Ask a question. Type howdoi followed by a plain-language question, for example howdoi format date bash.
- 4Add display options. Use -n to get more answers, -c for colored output, or -a for the full answer text.
- 5Adjust the source. Use -e to pick google, bing or duckduckgo, or set HOWDOI_URL to query another StackExchange site.
- 6Use JSON for scripts. Add -j to get raw JSON output you can parse in a script.
What howdoi does and who it is for
howdoi takes a question written in ordinary words and returns a code answer. The README's example is asking how to format a date in bash, which returns a single shell line. By default it draws answers from Stack Overflow-style sites, and it can search other StackExchange sites or use Google, Bing or DuckDuckGo.
- Developers who often search for small syntax questions
- Students who want common shell or language snippets from the terminal
- People who prefer staying in the terminal over switching to a browser
- Users who want answers piped into scripts through JSON output
Install howdoi with pip or Homebrew
You need Python 3.7 or newer and pip. Python 2.7 is not supported. The README lists two install routes: pip, or Homebrew if you use it.
pip install howdoi
brew install howdoiRun your first query
Type howdoi followed by your question in plain words. You do not need quotation marks for most queries. The tool prints one answer, which is the first result by default.
$ howdoi format date bash
> DATE=`date +%Y-%m-%d`Control how many answers you see
Several flags change what is printed. -n sets how many answers to return, -p picks which answer position to show, -a shows the full answer text, and -l shows only the link. -c turns on colored output, which the README suggests in an alias with five results.
- -p POS or --pos POS: select the answer in a given position (default 1)
- -n NUM or --num NUM: number of answers to return (default 1)
- -a or --all: display the full text of the answer
- -l or --link: display only the answer link
- -c or --color: enable colorized output
howdoi format date bash -c -n 5Use howdoi in scripts and other tools
The -j or --json flag returns answers in raw JSON, which suits scripts. The -x flag explains how the answer was chosen. Search engine choice is set with -e, which accepts google, bing or duckduckgo, or with the HOWDOI_SEARCH_ENGINE environment variable.
To search a different StackExchange site, set HOWDOI_URL. The README's example asks a cooking question against the cooking site.
- -j or --json: raw JSON output
- -x or --explain: explain how the answer was chosen
- -e or --engine: google, bing or duckduckgo
- HOWDOI_URL=serverfault.com: point queries at another site
HOWDOI_URL=cooking.stackexchange.com howdoi make pestoSave answers and clear the cache
howdoi can stash answers you want to keep. Saving, viewing, removing and emptying the stash are separate flags. For more advanced stash features the README points to the keep project. Use -C to clear the cache if results look stale. The README also lists HOWDOI_DISABLE_CACHE, which turns caching off.
howdoi --save QUERY
howdoi --view
howdoi --remove
howdoi --empty
howdoi -CKnow the limits before relying on it
howdoi returns short snippets from existing answers. It does not reason about your code, so complex architecture or debugging questions are a poor fit. It queries online sites, so it is not for offline use. For those cases, compare it with cheat.sh, tldr or navi, which the source lists as comparable projects.
What people use it for
- Looking up a shell command, such as creating a tar archive, without leaving the terminal
- Finding a short snippet for a language task like printing a stack trace in Python
- Querying a non-programming StackExchange site, such as cooking, with HOWDOI_URL
- Feeding answers into a script through the JSON output option
- Saving useful answers to a stash for later reference
Frequently asked questions
How do I install howdoi?
Install it with pip using pip install howdoi, or with Homebrew using brew install howdoi. You need Python 3.7 or newer and pip.
Is howdoi free and open source?
Yes. The project is released under the MIT licence and its source is on GitHub under gleitz/howdoi.
Does howdoi work offline?
No. The README describes howdoi as querying online sites, so you need an internet connection to get answers.
Which Python versions does howdoi support?
It works with Python 3.7 and newer. The README says Python 2.7 support has been discontinued.
Can howdoi use Google instead of Stack Overflow?
Yes. The -e flag accepts google, bing or duckduckgo as search engines, and HOWDOI_SEARCH_ENGINE can set a default.
What are good alternatives to howdoi?
The source lists cheat.sh, tldr and navi as comparable projects. Those may suit you better for quick command references or offline-style lookups.
New agent skills, repos and AI tools — every week
The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.
Our verdict
howdoi suits developers, students and terminal users who regularly need short syntax answers and want to avoid a browser. It is a poor choice for complex debugging, architecture questions or offline work, and people on Python 2.7 will need to upgrade first.
Install options & downloads