Wednesday, August 15, 2007

spell check text file from terminal

This blog entry is here to do spell check of text file(s) remotely via terminal or without using X. This can be done non-interactively and interactively using linux spell and aspell binary.

Here are more details.

Assuming we have an existing file named file.txt .

# cat file.txt

Hey diddle diddle,
The cat and the fiddle,
The cow jumped over the moon,
The little dog laughed to see such a sight,
And the dish ran away with the spoon.

This word is not in the dictionary linux

How to spell check text file in terminal non-interactively?

# spell file.txt

gives out mispelled or unknown dictionary words below


If you wish to spell check interactively, this can be done as follows

# aspell -c file.txt

Launching the above commands open up somewhat read only text editor from your screen. Aspell presents you interactively with suggested spelling words that is currently based on aspell dictionary lookup table.

The menus are presented in a friendly way. Mispelled and unknown dictionary words are being highlighted for further action. These available action for mispelled and unknown words are available from choosing single shortcut keys as shown with the lower portion of the screen.

From the above screenshot, solaris is unknown to english dictionary that is why it was highlighted for further correction and/or spell check action.

Spell checking are based on English language as its default, which can be modified by changing the command line arguments. There are more than 100 language options to choose from and Tagalog is one of them! Aspell website can be visited here. If you wish to check all supported languages, you can simply view them by

# info aspell

If you wish to view or dump current aspell configuration, do as follow (/etc/aspell.conf)

# aspell config

Another binary that comes with aspell rpm package is ispell.

How to check the spelling of a text file interactively using ispell?

# ispell textfile.txt


Related Post:

Spell Check from Command Line Terminal


Sign up for PayPal and start accepting credit card payments instantly.
ILoveTux - howtos and news | About | Contact | TOS | Policy