Feb 072012
 

Today i publish another interesting article of Ankur Aggarwal, follow him in his Blog about Floss Stuff.

We all need to look for word definition. Online dictionaries and wikipedia are great but we are not always connected to the net. sdcv is a console version of StarDict dictionary. Using sdcv you can search for definitions while still offline. So here are the step to install and make use of this great program.


Step 1. Installation

On Ubuntu

Open Up terminal and type:

$ sudo apt-get install sdcv

On Fedora

Open Up terminal and type:

$ su -cyum install sdcv”

On Mac OS X

Mac OS comes with a great GUI based dictionary, but cli enthusiasts will enjoy sdcv.

Please install Macports and then open Finder, Go to Application Folder > Utilities Folder and launch terminal and type

$sudo port install sdcv

Step 2. Download Dictionary Files

Now that we have installed sdcv, we need to download dictionary files from the net.

Go to this site1 , site 2  and download dictionary files according to you requirements. For open source fans, Free On-Line Dictionary of Computing (FOLDOC) and Jargon file are must. They are both available from site1.

FOLDOC: Dictionary for computing subjects.

Jargon File: “A comprehensive compendium of hacker slang illuminating many aspects of hackish tradition, folklore, and humor.” – From Jargon File Homepage.

GNU/Linux English-English Dictionary: You can download it from here.

Step 3. Install downloaded Dictionary Files

Now that you have downloaded the dictionary files we need to put them in the folder where sdcv looks for dictionary files when invoked.

On Linux based systems do the following

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

or

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

Note: Make sure the user who will be invoking the sdcv command has read and execute permissions on /usr/share/stardict/dic/ and its subfolders.

On Mac OS X

$mkdir -p $HOME/.stardict/dic
 
$sudo tar -xvjf downloaded.tar.bz2 -C $HOME/.stardict/dic

Note: Unfortunately you need to repeat this process for every user that needs access to these dictionary files.

Step 4. Enjoy sdcv

Searching for definition

$ sdcv Linux                         (looks for linux in the dictionary.)

$ sdcv                                  (invokes sdcv in the interactive mode, press Control-D to quit).

In earlier article we covered how to use eSpeak, now you can combine sdcv and espeak together. Sdcv to look for definition and espeak for pronunciation.

$ sdcv Linux && espeak Linux

Here is a picture.

screen-shot-2012-01-23-at-1-59-36-am

Note: Sometimes due to the long definition of a particular word text scrolls down too fast for you to read, advanced users can set SDCV_PAGER environment variable to /usr/bin/less. Now, less will be used to display to the dictionary’s article. You may consider adding this to your .bashrc file. Check out manpage for sdcv for more information.

Popular Posts:

Flattr this!

  4 Responses to “sdcv: command-line based Dictionary for Linux”

  1. Thanks for telling me about sdcv. Can you please explain why the user needs read and execute permissions on /usr/share/stardict/dic/ and its subfolders.

  2. What’s the PPA for “sudo apt-get install sdcv” ?
    I get “$ sudo apt-get install sdcv” error after running above command on Ubuntu 10.04 (lucid)!

  3. I also need a dictionary file showing phonetics?!

Leave a Reply to dtigue Cancel reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

*