How to spell check in Linux Terminal
Most text editors often come with a spell checker to check the spelling of your text. But did you know that Linux also has a command line spell checker in Terminal?
The utility is called aspell and is installed by default on Ubuntu. This tool has many switches available, making users really appreciate its capabilities. This is how you can use aspell to check spelling in Terminal.
Introduction to aspell
The article works with a file called README.md , in which some words were misspelled.
File README.mdThe example will run it through the spell checker with the following command.-C switch is used to specify the file to check.
aspell -c README.md
This command will open an interactive window as below. In the top section, the file content is displayed.aspell found spelling mistakes. Now, it will prompt each error, along with the proposed error correction plan that the user can choose. Here, 'Attempyting' is the first spelling mistake.
The bottom section contains suggested words to replace the wrong word. A numeric value should be entered near the suggested words for the spell checker to do its job.
The bottom section contains suggested words to replace the wrong wordAfter typing 1
, aspell will move to the next wrong word and display suggestions for fixing it.
In this way, all necessary edits can be made. When all changes have been made to a file, the interactive spell checker will automatically exit. A backup for this file is created with the .bak extension.README.md is the modified file and README.md.bak is a file with typos.
The configuration file is located in /etc/aspell.conf. The same content can be viewed with the following command:
aspell dump config
The configuration file is located in /etc/aspell.conf The result has information on the dictionary being used, the position of the word list to check, etc.
The result has information about the dictionary in useUse another dictionary
Consider the country.txt file that has two spelling versions for the word 'recognize'. The version with 's' corresponds to British English and the version with 'z' corresponds to American English.
The Indian English dictionary is similar to the English English dictionary. Suppose you want to perform a spell check on this file based on the American English dictionary.
File country.txtThe following command shows a long list of available dictionaries.
apsell dump dicts
Long list of dictionaries available You can specify dictionaries to use in spell checking, using the -d switch . Use the American English dictionary as below.
aspell -d en_US -c "country.txt"
The first error is the word 'recognize' with the letter s and the proposed suggestion is to replace s with z .
The first error is the word 'recognize'When the correction is made, the third line in the file is identified as an error and may be corrected.
The correction is madeUse accented letters
Some languages that combine accented letters as shown in the accent-example.txt file are shown below.
File accent-example.txtPerforming a spell check on this file with the default dictionary will treat the accented letter as an error.
aspell -c accents-example.txt
The default dictionary will treat the accented letter as an error Proposals are provided to replace accented letters with regular letters. In this case, you can use a dictionary that supports accented letters to handle those files.
aspell -d en-w_accents -c accents-example.txt
The specified dictionary accepts accented letters and the accents-example.txt file successfully passes the spelling test.
Other options
aspell can also be used with HTML / XML files and Tex / LaTex files by providing predefined switches. It can also be configured to handle hyphenated words and skip upper or lowercase letters.
The full list of options and switches available for aspell can be found on the man page and in the Texinfo guide .
You should read it
- Top 7 best Linux terminal emulators
- How to use Guake Terminal in Linux
- 6 interesting terminal commands on Mac
- How to fix the problem of being unable to enter Terminal in Linux
- 8 methods to quickly check website status from Linux Terminal
- How to install dictionaries in Linux Terminal
- How to back up and restore Linux Terminal history
- 8 best free Terminal Emulator apps for Android
- How to play Game Boy games on Linux Terminal
- How to use Linux Terminal as a computer
- How to use Terminal on a Mac
- How to Create and Edit Text File in Linux by Using Terminal
Maybe you are interested
9 ways to fix the error of not being able to save files as JPEG or PNG in Photoshop
Download standard and beautiful Word file experience initiative cover template
How to use the file search command on Windows, find saved files
How to split sheet into multiple separate Excel files
How to merge PDF files, merge and join multiple PDF files into a single file
How to clean up iPhone junk, delete junk files to free up iPhone storage