Set up an offline command line dictionary in Fedora

You don’t need an internet connection to have an easily searchable and extendable dictionary on your Fedora computer. You can use sdcv (StarDict under Console Version) and the public Stardict files on the default repositories to keep a local record for offline use. This article shows you how.

What is sdcv?

sdcv is a command line variant of Stardict. Stardict is a part of a long legacy of GUI offline dictionaries. The “dic” files it uses are formatted as a colon delimited file, with the word in first column and the definition in the second column. You can have multiple lines with the same word and different definitions. sdcv will provide you with a search function and formatted display of your results.

Installing sdcv

You can get started quickly with sdcv and the English dictionary by installing them from the default repos:

sudo dnf install sdcv stardict-dic-en

sdcv will be ready for use right away. If you want to see what other languages are available, use this command:

dnf search stardict

How to use sdcv

sdcv has an interactive and non-interactive mode. You can perform a quick search on a word or term using this command:

sdcv word

For example, you could search sdcv linux. Alternately, you can run sdcv by itself to activate interactive mode.

Customizing sdcv

sdcv has a –color option that adds coloring to the words and source of the definition. You can also use an alias to enable –color by default. Simply edit your shell resource file (default on Fedora is ~/.bashrc) to add this command:

alias sdcv="sdcv --color"

You can also use a more friendly name like this: 

alias describe="sdcv --color"

sdcv references /usr/share/stardic/dic by default, or it uses the path located in the shell variable STARDICT_DATA_DIR. You can also set up a personal dictionary in the file $HOME/.stardict/dic.

Fun facts

Believe it or not, the dict network protocol is still alive to this day. You can use it with the curl command by using a command like this to search for a word:

curl dict://dict.org/d:<word>

This pull definitions straight from the internet via your command line. Enjoy using sdcv!


Photo by Pisit Heng on Unsplash.

FAQs and Guides Using Software

5 Comments

  1. Guilherme

    Nice!

    Found 2 items, similar to linux.
    –>WordNet
    –>Linux

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

    –>StarDict dictionary
    –>Linux

    g:linux_logo.jpg

    The best OS!

  2. Yazan Al Monshed

    nice tool
    my result is about google :

    0)WordNet–>goggle
    1)WordNet–>goggles
    2)WordNet–>googly
    3)WordNet–>booklet
    4)WordNet–>Boole
    5)WordNet–>bootleg
    6)WordNet–>bootless
    7)WordNet–>coggle
    8)WordNet–>dongle
    9)WordNet–>doodle

  3. twohot

    Whatever happened to dictd?

  4. Abstrys

    Not so sure about the info here regarding ‘dic’ files. On my system (Fedora 31),

    /usr/share/stardict/dic

    is a directory with contents:

    /usr/share/stardict/dic/
    ├── stardict-dict
    │   ├── res
    │   │   ├── huzheng.png
    │   │   ├── huzheng_redhat.png
    │   │   ├── linux_logo.jpg
    │   │   ├── redhat_linux_logo.gif
    │   │   ├── redhat_logo.jpg
    │   │   ├── splash.png
    │   │   ├── wenjing2.jpg
    │   │   └── wenjing.jpg
    │   ├── stardict-dict.dict.dz
    │   ├── stardict-dict.idx
    │   ├── stardict-dict.ifo
    │   └── stardict-dict.syn
    └── stardict-dictd_www.dict.org_wn-2.4.2
        ├── dictd_www.dict.org_wn.dict.dz
        ├── dictd_www.dict.org_wn.idx
        └── dictd_www.dict.org_wn.ifo

Comments are Closed

The opinions expressed on this website are those of each author, not of the author's employer or of Red Hat. Fedora Magazine aspires to publish all content under a Creative Commons license but may not be able to do so in all cases. You are responsible for ensuring that you have the necessary permission to reuse any work on this site. The Fedora logo is a trademark of Red Hat, Inc. Terms and Conditions