+1 607 252-6647 Email Questions

How to check spelling at the Linux command line with Aspell

  • Published in News
  • Hits: 117

Proper spelling doesn't seem to be very important to many people these days. There are, however, those of us for whom it is. Yes, I am one of those people.

While I'm not a spelling cop, misspelled words stick out when I encounter them. They hurt my eyes. They hurt my brain. Any good text editor or word processor packs a spelling checker. If you're working in plain text, you can go another route to check spelling: at the command line with a nifty utility called GNU Aspell[1] (which I'll be calling Aspell from here on in).

Aspell is fast, easy to use, and flexible. Let's take a look at how to use it.

Getting going

First, make sure you have Aspell installed on your system. It's standard kit with most Linux distributions. To find out if Aspell is installed, open a terminal window and type which aspell. That command should return something like /usr/bin/aspell. If it returns nothing, you can install Aspell using your distro's package manager, or you can download and install it[2].

So you have a text file that you want to spell check at the command line. Crack open a terminal window and navigate to the directory containing the text file you want to spell check. Then, run the following command:

aspell check file.txt

Aspell opens the text file in a two-pane interactive editor:

The top pane shows the file, with any errors (or perceived errors) highlighted. The bottom lists the suggested corrections (based on Aspell's default dictionary) and various commands that you can use.

In the screen capture above, Aspell has flagged the acronym "PDF" as an error and suggested several alternatives. I can

Read more from our friends at Opensource.com

Contact us

By Mail

PO Box 5613

Katy, TX 77491

USA

Social: twitter facebook

Phone: +1 607 252-6647

Fax: +1 866 573-1096

Email: info [AT] synapticweb [DOT] co