One Thing Well

A weblog about simple, useful software.

You can follow along on Twitter or via the feed. Don't hesitate to get in touch. Sponsor the site.

Wikipedia CLI

You can query Wikipedia from the command line using dig.

For example,

dig +short txt monkey.wp.dg.cx

will return

“A monkey is a nonhuman primate mammal with the exception usually of the lemurs and tarsiers. More specifically, the term monkey refers to a subset of monkeys: any of the smaller longer-tailed catarrhine or platyrrhine primates as contrasted with the apes.” ” http://en.wikipedia.org/wiki/Monkey

The command is a little fiddly to remember, so you could wrap it up in a shell function, like so

    wiki() {
        dig +short txt $1.wp.dg.cx
    }

then type

wiki monkey

to view a quick definition and the URL to the Wikipedia article in question.

Via commandline-fu