skip to navigation
skip to content

howdou 2.0.1

Instant coding answers via the command line

Latest Version: 2.0.5

This is a fork of Benjamin Gleitzman’s excellent Howdoi tool.

It’s been extended to support a local indexed cache of answers using Elasticsearch as the backend search server. This allows faster searches and the ability to add custom answer annotations and documentation via a local YAML file.

I made this modification when I realized that howdoi is ideal for finding common one-liners when what I really needed was help finding less common guides and solutions for subtle, but more complex problems. In these cases, I found that the solutions provided by howdoi still required I do more research and write notes, notes that I needed to store somewhere for later reference.

My solution was to organized my notes in a YAML file, index this file with Elasticsearch, and modify howdoi to refer to my Elasticsearch index first.

Instant coding answers via the command line

Are you a hack programmer? Do you find yourself constantly Googling for how to do basic programing tasks?

Suppose you want to know how to format a date in bash. Why open your browser and read through blogs (risking major distraction) when you can simply stay in the console and ask howdou:

$ howdou format date bash
> DATE=`date +%Y-%m-%d`

howdou will answer all sorts of queries:

$ howdou print stack trace python
> import traceback
> try:
>     1/0
> except:
>     print '>>> traceback <<<'
>     traceback.print_exc()
>     print '>>> end of traceback <<<'
> traceback.print_exc()

$ howdou convert mp4 to animated gif
> video=/path/to/video.avi
> outdir=/path/to/output.gif
> mplayer "$video" \
>         -ao null \
>         -ss "00:01:00" \  # starting point
>         -endpos 10 \ # duration in second
>         -vo gif89a:fps=13:output=$outdir \
>         -vf scale=240:180

$ howdou create tar archive
> tar -cf backup.tar --exclude "www/subf3" www


First, install Elasticsearch. On Ubuntu, this is simply:

sudo apt-get install elasticsearch

Then install howdou via pip with:

pip install howdou


pip install git+


python install


The command line is pretty straight-forward:

usage: [-h] [-p POS] [-a] [-l] [-c] [-n NUM_ANSWERS] QUERY [QUERY ...]

instant coding answers via the command line

positional arguments:
  QUERY                 the question to answer

optional arguments:
  -h, --help            show this help message and exit
  -p POS, --pos POS     select answer in specified position (default: 1)
  -a, --all             display the full text of the answer
  -l, --link            display only the answer link
  -c, --color           enable colorized output
  -n NUM_ANSWERS, --num-answers NUM_ANSWERS
                        number of answers to return
  -C, --clear-cache     clear the cache

To take full advantage of howdou, you’ll need to maintain a local howdou.yml file, which is a simple serialized list of QA-sets that look like:

Note each item is an association of many-questions to many-answers. This is because there are many ways to ask the same thing, and we want the index to be as likely as possible to correctly match your question to an answer.

There’s also an explicit weight value, which will be incorporated into Elasticsearch’s own search weight to control the order that results are shown.


You can run unittests by downloading and extracting the source tarball and running:

python test
File Type Py Version Uploaded on Size
howdou-2.0.1.tar.gz (md5) Source 2014-07-07 8KB
  • Downloads (All Versions):
  • 13 downloads in the last day
  • 88 downloads in the last week
  • 456 downloads in the last month