I know lot of people think that Unix/Linux has very less functionality, but the fact is Unix/Linux has all the functionality in it’s core. It won’t be wrong, if I say that other Operating Systems have copied some awesome stuff from Linux. Today we are going to see how you can spell-check a document from Linux’s terminal / command line. It may be useful for many of the Linux users lovers.

We are going to use the command aspell. The documentation says –

aspell is a utility program that connects to the Aspell library so that it can function as an ispell -a replacement, as an independent spell checker, as a test utility to test out Aspell library features, and as a utility for managing dictionaries used by the library.

The Aspell library contains an interface allowing other programs direct access to it’s functions and therefore reducing the complex task of spell checking to simple library calls. The default library does not contain dictionary word lists. To add language dictionaries, please check your distro first for modified dictionaries, otherwise look here for base language dictionaries http://aspell.net.

How to use SpellChecker to check your documents in command line

  1. Create a file called file.txt and input a sample “incorrect” content 🙂
  2. I typed the following erroneous line and saved the file – “hel i ma going to ptu this in a fiel”
  3. Now type the command aspell check file.txt
  4. You should be able to see the spell check as show in the following image.

You can see the suggestions below the file, just choose the correct by pressing the number show before it. In the above screenshot to replace hel with hello just press number 4 and it will move forward to next error. In this way it will check the complete file from top to bottom. You can exit the spell check by pressing “x” anytime. You can also a new word to dictionary by pressing “a”. This works as a usual spellchecker.

I am sure this will help you a lot and especially to users who do their mos of the stuff from command line.

Stay Digified!!
Sachin Khosla

Share this post: