As a person who likes to write it has always been helpful for me to have a dictionary nearby. As a regular command line user to have a dictionary I could access from there was something I really wanted. I hadn’t predicted this would be much of a task, however, I found it an uphill battle.
What I felt a command line dictionary should offer:
1) a basic description that is accurate
2) the capability to be accessed offline
3) a formatting that is easy to read
In my original attempt I didn’t find any. I looked at a number of programs but most were inadequate in one way or another. I was baffled and I almost gave up looking. I did eventually find one but before that the two most promising programs were dictd and sdcv.
Dictd is a protocol/software-framework for a networking dictionary, it contains both a server and a client. The idea is to have a server where numerous clients can connect to it. This would be useful for local network use or for something like an online dictionary group. However, it seems that the development has been quiet, and I had trouble installing several of its dictionaries… I could never get it to work.
The basic setup steps that are required to make it function are:
- install package and a dictionary for it
- start the dictd daemon (requires very little overhead) and check if the dictionaries are available (
- look up a word definition using a particular dictionary (e.g.
dict --database gcide)
I used to use this program (Stardict console version) for years. It provided a basic, easy-to-use, unambiguous, definition. These days, however, the parent program StarDict is no longer in development. Additionaly, there were formatting problems that broke reading flow, and made it difficult to read.
Forest through the trees
I may not always get what I want, at other times, if I’m paying attention, I’ll find what I need. I discovered a program that while not a full-blown dictionary does pretty good. It technically might not even be a dictionary. From the man page:
wn - command line interface to the WordNet lexical database... it outputs synsets and relations to be displayed as formatted text.
In more human-speak: it details relationships between words. Its use as a thesaurus would be of a more direct comparison; however it can work for a dictionary as it does provide definitions and contextual examples. The definitions may be basic, but they are to the point. The only feature it does not provide that I use sometimes is word pronunciations.
wn lexical -over ... The adj lexical has 2 senses (first 1 from tagged texts) ... 1. (2) lexical -- (of or relating to words; "lexical decision task") 2. lexical -- (of or relating to dictionaries)
Creating good enough alone
The output of
wn can be difficult to read: it jumbles a lot of information together, and only roughly organizes it. (FYI, in the above example I’ve filtered out a couple lines.) To help the reading of it in a smooth natural way, I’ve created a couple scripts to format the output. One script is called
dict and the other is called
I’ve put them in a repository for any who are interested.