Everyone needs a little spell checking in their routine. Even the best of us make mistakes. This article goes over the ‘aspell‘ Linux command for spell checking the contents of files that you specify.
Synopsis: aspell [options]
|-?||help||Displays the help information.|
|-c||check filename||Spell checks a specific file. This is the most used purpose for the aspell command.|
|-list||Displays a list of misspelled words from the command line.|
|-v||version||Displays the version number.|
Below are the different options that are available to customize the aspell command.
|-W||–ignore=n||Aspell will ignore words less than or equal to n characters in length.|
|–ignore-case=true/false||Sets whether to ignore case or not. It is set to false by default, meaning aspell is case sensitive.|
|–sug-mode=mode||You can set between different modes: ultra, fast, normal (default), and bad-spellers|
Spell checking a specific file
Here we give the most common base use for the aspell command. To do this, simply use the -c option and then list the file you want to check. The example below shows how to check a file named test.txt.
# aspell -c test.txt
Spell check without regard to case
If you want to make the spell checker case insensitive, use the following example. You can see we use the previous example and add the –ignore-case=true option.
# aspell --ignore-case=true -c test.txt
Spell check but ignore smaller words
In this example, we do a spell check on the test.txt file but we want to ignore words of less than 7 characters in length. Again, we use the first example and simply add the –ignore=7 option. You can change the number to be any length you want.
# aspell --ignore=7 -c test.txt