Offline dictionary for terminal

Before coming to New Zealand I was using online dictionaries, but to be honest, the internet here is not so great and there is quite a lot of latency between the request and Czech servers (where most of the dictionaries I used are hosted). Also, I’m sometimes traveling without the internet so a fast offline replacement would be awesome.

So I found a perfect command line interface for a popular offline Stardict dictionary. To install it on Ubuntu run the following (or use brew for OS X).

sudo apt-get sdcv
mkdir ~/.stardict/dic

Now download one of the many free dictionaries that suits your needs and install it if it is a gzip file with the following.

sudo tar -xvzf dictionary.tar.gz -C ~/.stardict/dic

Or if it’s a bz2 file.

sudo tar -xvjf dictionary.tar.bz2 -C ~/.stardict/dic

The usage is pretty simple as you just call the program with a word you want to translate sdcv hello.

Spelling

While searching for a fast dictionary I stumbled across a terminal tool for spelling suggestions aspell. You can install it with your package manager sudo apt-get install aspell and create the following handy alias.

alias spell='function _spell() { echo $1 | aspell -a; };_spell'

Resources


Would you like to get the most interesting content about programming every Monday?
Sign up to Programming Digest and stay up to date!