Putorius
Basic Commands

Dictd - Using a Linux Command Line Dictionary

Close up of text on a page

With the proliferation of the internet, finding a definition of a word has become trivial. I still find it interesting (even exciting) that a command line dictionary still exists. Not only does one still exist, as I did research for this article I found a lot more options than I expected.

You're probably asking yourself "What practical use could there be for a command line dictionary in 2019?". Well, none that I can think of. But, just because I cannot think of one, that doesn't mean one doesn't exist.

Researching this topic made me think back to a simpler time before the internet. A time when everything was just text on the screen (ASCII Art!). The nostalgia of this article gives me a warm fuzzy feeling. It momentarily transported me to a time of Bulletin Board Systems (BBS), BASIC programming and handshake noises from a 1200 baud modem. A time before Linux even existed.

Join me on a nostalgic tour through the dictd command line dictionary.

Installing dictd and Databases

DICT stands for Dictionary Network Protocol and it is available on just about any Linux and UNIX system. In this how-to we will discuss installation and basic usage of the command line dictionary.

Installation on Red Hat Based Systems

The package that gives the dict command is called dictd.

You can install dictd on Red Hat, CentOS, Fedora, or any rpm based distros using yum or dnf:

$ sudo dnf install dictd -y

or

$ sudo yum install dictd -y

You can also install the local dictionary databases for offline use:

$ sudo dnf install gnome-dictionary -y

or

$ sudo yum install gnome-dictionary -y

Installation on Debian/Ubuntu Based Systems

In apt based systems, it is very similar.

$ sudo apt-get install dictd -y

Install local dictionary database:

$ sudo apt-get install dict-gcide

Basic Usage

If you use the dict command without any options, it will use the internet to find definitions and thesaurus entries.

$ dict modem

Example output:

[savona@putor ~]$ dict modem
5 definitions found
From The Collaborative International Dictionary of English v.0.48 [gcide]:
modulator-demodulator \mod"ulator-demod"ula`tor\, n.
An electronic device that converts electronic signals into
sound waves, and sound waves into electronic signals, used to
transmit information between computers by the use of ordinary
telephone lines; usually called a {modem}.
[PJC]
...OUTPUT TRUNCATED...

If you want to use your local dictionary database, you can use -d to specify which.

dict -d gcide basic

Example output:

[savona@putor ~]$ dict -d gcide basic
3 definitions found
...
From The Collaborative International Dictionary of English v.0.48 [gcide]:
higher programming language \higher programming language\ n.
(Computers)
A computer programming language with an instruction set
allowing one instruction to code for several assembly
language instructions.
Note: The aggregation of several assembly-language instructions
into one instruction allows much greater efficiency in writing
computer programs. Most programs are now written in some higher
programming language, such as {BASIC}, {FORTRAN}, {COBOL}, {C},
{C++},{PROLOG}, or {JAVA}.
[PJC]
...OUTPUT TRUNCATED...

List Available Databases

You can list all the available local dictionaries using the -D switch:

$ dict -D

Example output:

[savona@putor ~]$ dict -D
dictd 1.12.1/rf on Linux 4.4.0-1-amd64
On pan.alephnull.com: up 450+02:40:24, 59400974 forks (5498.7/hour)
Database Headwords Index Data Uncompressed
gcide 203645 3859 kB 12 MB 38 MB
wn 147311 3002 kB 9247 kB 29 MB
moby-thesaurus 30263 528 kB 10 MB 28 MB
elements 142 2 kB 17 kB 53 kB
vera 12016 136 kB 213 kB 709 kB
jargon 2314 40 kB 565 kB 1346 kB
foldoc 15126 300 kB 2210 kB 5411 kB
easton 3968 64 kB 1077 kB 2648 kB
hitchcock 2619 34 kB 33 kB 85 kB
bouvier 6797 128 kB 2338 kB 6185 kB
...OUTPUT TRUNCATED...

Get Information about a Database

You can get information like maintainer, edition, publisher, etc. about any database using the -i option followed by the name of the database.

$ dict -i fd-eng-ita

Example output:

[savona@putor ~]$ dict -i fd-eng-ita
============ fd-eng-ita ============
English-Italian FreeDict Dictionary
Maintainer: [up for grabs]
Edition: 0.1.1
Size: about 4500 headwords
Publisher: FreeDict.
...OUTPUT TRUNCATED...

Language Translation

A neat little feature that I noticed is that is has the ability to translate words. For example, let's say you wanted to translate something from English to Italian. All you have to do is specify the English-Italian FreeDict Dictionary like so:

$ dict -d fd-eng-ita love

Example output:

[savona@putor ~]$ dict -d fd-eng-ita love
1 definition found
From English-Italian FreeDict Dictionary ver. 0.1.1 [fd-eng-ita]:
love
amare; volere bene
amore

You can use all of the translation dictionaries at one time to translate a word into many different languages.

[savona@putor ~]$ dict -d trans love
29 definitions found
From Danish-English FreeDict Dictionary ver. 0.2.1 [fd-dan-eng]:
love
promise
From English-Arabic FreeDict Dictionary ver. 0.6.2 [fd-eng-ara]:
Love
الحبّ
From English-Croatian Freedict Dictionary [fd-eng-cro]:
love
ljubav, ljubavi, ljubavna, ljubavni, ljubiti, vole, voljeti
From English-Czech fdicts/FreeDict Dictionary [fd-eng-cze]:
love
milá
...OUTPUT TRUNCATED...

Moby Thesaurus

When writing a thesaurus comes in handy. How handy this one is, I can't say. But it's there and you can query it like so:

$ dict -d moby-thesaurus sleep
1 definition found
From Moby Thesaurus II by Grady Ward, 1.0 [moby-thesaurus]:
178 Moby Thesaurus words for "sleep":
KO, annihilation, ataraxia, ataraxy, bane, be caught napping,
be neglectful, be negligent, beauty sleep, beddy-bye, bedtime,
biological death, blackout, blanket drill, bye-bye, calmness,
catalepsy, catatonia, catatony, catnap, cessation of life,
clinical death, coma, comfort, composure, contemplation

For more information see Moby Thesaurus.

Conclusion

The command line dictionary is alive and well. You should now be able to install and use the basic function of the dict command. Like I said in the intro, I can't image what use case a command line dictionary could have in this day and age. But if you can think of one I would love to hear your story.

I really enjoyed writing this article. Even though it is not an article on the Commodore 64, or the Amiga, it still brought me back to a very special time in my life. I am planning on doing more similar to this.

As always, feel free to speak your mind in the comments.

Exit mobile version