Sunday, October 14, 2007

Dictionary Lookup via Command Line

#curl dict://
To help you remember, d: stands for DEFINE.

For example, to look up the word "bash", (all output in this article are greatly abbreviated for clarity)
# curl dict://
151 "Bash" gcide "The Collaborative International Dictionary of English v.0.48"
Bash \Bash\, n.
1. a forceful blow, especially one that does damage to its
2. a elaborate or lively social gathering or party.

The web site supports 77 dictionaries. To list them:
#curl dict://

So, if you want to know the computer meaning of "bash", specify foldoc "The Free On-line Dictionary of Computing" like this:
#curl dict://
151 "bash" foldoc "The Free On-line Dictionary of Computing (27 SEP 03)"
Bourne Again SHell. {GNU}'s {command interpreter} for {Unix}.
Bash is a {Posix}-compatible {shell} with full {Bourne shell}
syntax, and some {C shell} commands built in. The Bourne
Again Shell supports {Emacs}-style command-line editing, job
control, functions, and on-line help. Written by Brian Fox of

To display results from all libraries, do this:
#curl dict://*

Fuzzy matching is also possible. Replace the "d" or Define command with "m" which stands for MATCH.
#curl dict://

With the match command, you can also specify the strategy such as exact, prefix, suffix, or even soundex.

#curl dict://
gcide "Bash"
gcide "Bashed"
gcide "Bashful"
gcide "bashful Billy"

To list all supported strategies:
#curl dict://


Gaurav Khatri said...

Thanks for this.
It was really useful.

Anonymous said...

At least for me, is really slow (3000-9000ms ping time). What about other dictionaries with the dict:// protocol?

Anonymous said...

Found this site:

sreekumar said...

Thank you

Anonymous said...

Very helpful. Now I can do vocab homework without riffling through a real dictionary

Korey said...

Wow, what a helpful post! I write a lot in vim, so having a command line dictionary is extremely nice. Shortly after reading this post I discovered the "dict" program on Ubuntu, which is a command line dict client. This program allows you to type "dict elephant" to define elephant and that saves you a few keystrokes. It has options for specifying host, database, etc.

Raf@!! said...

What a useful post, I have been using Google dictionary from console with some scripts, but google dictionary is died, thanks for the info.

Anonymous said...

This is AWESOME!!! Thanks. Luv it!