Friday, February 12, 2010

Spelling and Dictionary Lookups at Bash Command Line

If you've ever wanted an easy way to look up a word in the dictionary, or spell check a word at the command line (in Linux), I've come up with a simple way to do it.

First, make sure you have aspell and curl installed, then simply paste the following functions into your .bashrc file:

function dictlookup
{
curl dict://dict.org/d:$1
}

function spellcheck
{
echo "$1" | aspell -a -c | grep "&"
}

Now you can do things like this:

> spellcheck antecedant

and:

> dictlookup antecedent

Enjoy!

1 comment:

Thomas said...

Excellent!
as in
"Excellent \Ex"cel*lent\, adv.
Excellently; eminently; exceedingly. [Obs.] "This comes off
well and excellent." --Shak.
[1913 Webster]"

Love it!
Thanks.