Americas

  • United States
sandra_henrystocker
Unix Dweeb

Looking up words and terms with the Linux dict command

How-To
Mar 02, 20236 mins
Linux

The dict command on Linux can provide you with access to a large collection of dictionaries, many with a special focus.

If you’re sitting at your Linux computer and feeling curious about some word or term, you don’t have to jump up and grab a dictionary. Instead, you can install the dict command and you’ll probably be amazed by the wealth of information that will be available to you on the command line.

You will be able to find multiple definitions for nearly any term you ask about, often with considerable depth. Just looking up the word “seven”, I was provided with four definitions. They included references to the Pleiades (a star cluster that is also known as the “Seven Sisters”), a mention of the seven wonders of the world, scriptural references to the number seven, a note about how many days are in a week, and an explanation that seven is one greater than six.

The dict command is one of the most widely used command-line dictionaries available on Linux and one of the most far reaching; it reaches out to get information from dictionaries that are scattered around the globe.

How to use dict to find definititions

To install dict, use a command like one of the following depending on your Linux distribution:

$ sudo dnf install dictd
$ sudo apt-get install dictd

After installing dict myself, I used the command below to count the number of dictionaries available to me:

$ dict -D | wc -l
167

The output does includes a heading, but that’s still a lot of resources. The dict -D command will provide the list of dictionaries available to you. Here’s the top of the list presented when I asked:

$ dict -D | head -11
Databases available:
 gcide          The Collaborative International Dictionary of English v.0.48
 wn             WordNet (r) 3.0 (2006)
 moby-thesaurus Moby Thesaurus II by Grady Ward, 1.0
 elements       The Elements (07Nov00)
 vera           V.E.R.A. -- Virtual Entity of Relevant Acronyms (February 2016)
 jargon         The Jargon File (version 4.4.7, 29 Dec 2003)
 foldoc         The Free On-line Dictionary of Computing (30 December 2018)
 easton         Easton's 1897 Bible Dictionary
 hitchcock      Hitchcock's Bible Names Dictionary (late 1800's)
 bouvier        Bouvier's Law Dictionary, Revised 6th Ed (1856)

One of the first things I asked about was Linux itself. Notice that the definitions include pronunciations along with the definitions. NOTE: The output below is truncated in several places.

$ dict Linux
3 definitions found
From WordNet (r) 3.0 (2006) [wn]:

  Linux
      n 1: an open-source version of the UNIX operating system

From The Jargon File (version 4.4.7, 29 Dec 2003) [jargon]:

  Linux
   /lee'nuhks/, /li?nuks/, not, /li:?nuhks/, n.

      The free Unix workalike created by Linus Torvalds and friends starting
      about 1991. The pronunciation /li'nuhks/ is preferred because the name
      ?Linus? has an /ee/ sound in Swedish (Linus's family is part of Finland's
      6% ethnic-Swedish minority) and Linus considers English short /i/ to be
      closer to /ee/ than English long /i:/. This may be the most remarkable
      hacker project in history ? an entire clone of Unix for 386, 486 and
      Pentium micros, distributed for free with sources over the net (ports to
      Alpha and Sparc and many other machines are also in use).
…


From The Free On-line Dictionary of Computing (30 December 2018) [foldoc]:

  Linux

      ("Linus Unix") /li'nuks/ (but see below)
     An implementation of the {Unix} {kernel} originally written
     from scratch with no proprietary code.

     The kernel runs on {Intel} and {Alpha} hardware in the general
     release, with {SPARC}, {PowerPC}, {MIPS}, {ARM}, {Amiga},
     {Atari}, and {SGI} in active development.  The SPARC, PowerPC,
     ARM, {PowerMAC} - {OSF}, and 68k ports all support {shells},
     {X} and {networking}.  The Intel and SPARC versions have
     reliable {symmetric multiprocessing}.

     Work on the kernel is coordinated by Linus Torvalds, who holds
     the copyright on a large part of it.  The rest of the
     copyright is held by a large number of other contributors (or
     their employers).  Regardless of the copyright ownerships, the
     kernel as a whole is available under the {GNU} {General Public
     License}.  The GNU project supports Linux as its kernel until
     the research {Hurd} kernel is completed.

…
     {More on pronunciation (/pub/misc/linux-pronunciation)}.

     {LinuxHQ (http://linuxhq.com/)}.  {slashdot
     (http://slashdot.org/)}.  {freshmeat (http://freshmeat.net/)}.
     {Woven Goods (http://fokus.gmd.de/linux/)}.  {Linux
     Gazette (http://ssc.com/lg)}.

     {funet Linux Archive (ftp://ftp.funet.fi/pub/Linux)}, {US
     mirror (ftp://sunsite.unc.edu/pub/Linux/)}, {UK Mirror
     (ftp://sunsite.doc.ic.ac.uk/packages/Linux/)}.

     (2000-06-09)

You can also access the many definitions available by going through a browser to dict.org/bin/Dict.

Translating words with the dict command

In addition to looking up words or terms, you use the dict command to translate some words and phrases into some other languages. Here’s an example that translates from English to French:

$ dict -d fd-eng-fra "thank you"
1 definition found

From English-French FreeDict Dictionary ver. 0.1.6 [fd-eng-fra]:

  thank you /θæŋkjau/	

Note that the English pronunciation is provided using the phonetic alphabet. You can find a reference for English phonemes at phonetic chart.

This next example translates “thank you” into German:

$ dict -d fd-eng-deu "thank you"
1 definition found

From English-German FreeDict Dictionary ver. 0.3.7 [fd-eng-deu]:

  thank you /θæŋkjau/
  Danke, danke gleichfalls

The response will depend on whether the sources contain translations for the particular word or phrase you are asking about. Most phrases will likely not be available.

$ dict -d fd-eng-fra "Why not?"
No definitions found for "Why not?"

To list the languages, you can use for translations from English, use this command:

$ dict -D | grep fd-eng-

To view all of the available translation sources, use this command:

$ dict -D | grep fd-

The “fd” appears to stand for “FreeDict”, the source of the translations.

To use a specific server, use -h or –host

$ dict -h dict.org happy
5 definitions found

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

  Happy Hap"py (h[a^]p"p[y^]), a. [Compar. {Happier}
     (-p[i^]*[~e]r); superl. {Happiest}.] [From {Hap} chance.]
     1. Favored by hap, luck, or fortune; lucky; fortunate;
        successful; prosperous; satisfying desire; as, a happy
        expedient; a happy effort; a happy venture; a happy omen.
        [1913 Webster]
…

To use a specific database, use -d or –database.

$ dict -d elements helium
1 definition found

From The Elements (07Nov00) [elements]:

  helium
  Symbol: He
  Atomic number: 2
  Atomic weight: 4.0026
  Colourless, odourless gaseous nonmetallic element. Belongs to group 18
  of
  the periodic table. Lowest boiling point of all elements and can only be
  solidified under pressure. Chemically inert, no known compounds.
  Discovered in the solar spectrum in 1868 by Lockyer.

Wrap-Up

The Linux dict command can provide a lot of information. Don’t forget to take a look at the man page to explore the many other options that the command provides.

sandra_henrystocker
Unix Dweeb

Sandra Henry-Stocker has been administering Unix systems for more than 30 years. She describes herself as "USL" (Unix as a second language) but remembers enough English to write books and buy groceries. She lives in the mountains in Virginia where, when not working with or writing about Unix, she's chasing the bears away from her bird feeders.

The opinions expressed in this blog are those of Sandra Henry-Stocker and do not necessarily represent those of IDG Communications, Inc., its parent, subsidiary or affiliated companies.

More from this author