Is there an offline command-line dictionary?

sdcv is the console version of Stardict.

1. Install the dictionary

Run the following command in the terminal:

sudo apt-get install sdcv

2. Download dictionary files

Download the dictionary files according to your requirements from the following sources.

  • List of dictd-www.dict.org Dictionaries (archived):
    • The Collaborative International Dictionary of English (GPL, 35MB, 174222 words) (download tarball from archive.org)
  • https://web.archive.org/web/20140428004049/http://abloz.com/huzheng/stardict-dic/misc/
  • Free On-Line Dictionary of Computing
  • Jargon File - A comprehensive compendium of hacker slang illuminating many aspects of hackish tradition, folklore, and humor
  • GNU Linux English-English Dictionary

3. Install downloaded dictionaries

Make the directory where sdcv looks for the dictionary:

sudo mkdir -p /usr/share/stardict/dic/

The next command depends on whether the downloaded file is a .gz file or a .bz2 file.

If it is a .bz2 file:

sudo tar -xvjf downloaded.tar.bz2 -C /usr/share/stardict/dic

If it is a .gz file:

sudo tar -xvzf downlaoded.tar.gz -C /usr/share/stardict/dic

4. Done!

To search for a word use:

sdcv word

enter image description here


Easy offline dictd installation

Rationale

The dict command can easily be used with offline dictionaries. It suffices to install the dictd daemon with its dependencies alongside a local, offline dictionary. This turns out to be a much easier procedure than installing sdcv as suggested elsewhere on this page.

Installation

Below is shown how to install dictd along with the dict-gcide comprehensive English dictionary. There are many more dictionairies available from the standard repositories.

$ sudo apt-get install dict dictd dict-gcide

Usage

$ dict word

 3 definitions found

    From The Collaborative International Dictionary of English v.0.48 [gcide]:

      Word \Word\, n. [AS. word; akin to OFries. & OS. word, D. woord,
         G. wort, Icel. or[eth], Sw. & Dan. ord, Goth. wa['u]rd,
         OPruss. wirds, Lith. vardas a name, L. verbum a word; or
         perhaps to Gr. "rh`twr an orator. Cf. {Verb}.]
         [1913 Webster]
         1. The spoken sign of a conception or an idea; an articulate
            or vocal sound, or a combination of articulate and vocal
            sounds, uttered by the human voice, and by custom
            expressing an idea or ideas; a single component part of
            human speech or language; a constituent part of a
            sentence; a term; a vocable. "A glutton of words." --Piers
            Plowman.
            [1913 Webster]

                  You cram these words into mine ears, against
                  The stomach of my sense.              --Shak.
            [1913 Webster]

                  Amongst men who confound their ideas with words,
                  there must be endless disputes.       --Locke.
            [1913 Webster]

         2. Hence, the written or printed character, or combination of
            characters, expressing such a term; as, the words on a
            page.
            [1913 Webster]

         3. pl. Talk; discourse; speech; language.
            [1913 Webster]

You probably also have aspell installed, which has the advantage of giving suggestions for misspelled words. You can call aspell directly on your text file with:

aspell check text.txt

or use it on a single word:

echo wrd | aspell -a