Linux ispell command
The Linux ispell command is used for a spell checking program.
ispell will use the /usr/lib/ispell/english.hash dictionary file by default to check text files. If words not found in the dictionary are found in the checked file, ispell will suggest words to use, or let you add the new words to your personal dictionary.
Syntax
ispell [-aAbBClmMnNPStVx][-d<字典文件>][-L<行数>][-p<字典文件>][-w<非字母字符>][-W<字符串长度>][要检查的文件]
Parameters:
- -a This parameter must be used when output from other programs is sent to ispell.
- -A When the "&Include File&" string is read, check the contents of the file specified after the string.
- -b Create a backup file named .bak.
- -B Check for run-together word errors.
- -C Do not check for run-together word errors.
- -d<dictionary file> Specify the dictionary file.
- -l Read strings from the standard input device, and display misspelled words after finishing.
- -L<number of lines> Specify the number of lines of context to display.
- -m Automatically consider changes in word endings.
- -M After entering ispell, display the command keys at the bottom of the screen.
- -n Check files in nroff or troff format.
- -N After entering ispell, do not display the command keys at the bottom of the screen.
- -p<dictionary file> Specify a personal dictionary file.
- -P Do not consider word ending changes.
- -S Do not sort the suggested replacement words.
- -t Check files in TeX or LaTeX format.
- -V Non-ANSI standard characters will be displayed in the "M-^" format.
- -w<non-alphabetic characters> When checking, specifically pick out the specified characters.
- -W<string length> Do not check words of the specified length.
- -x Do not create a backup file.
Examples
Check the spelling of a file. For example, to check the testfile file, use the following command:
ispell testfile
If suspicious words appear in the file, the first suspicious word that appears is highlighted, and word correction suggestions along with ispell operation commands are shown at the bottom of the screen. As shown below:
netwrks File: testfile Linux netwrks are becoming more and more common, but security is often an overlooked issue. Unfortunately 0: networks [SP] <number> R)epl A)ccept I)nsert L)ookup U)ncap Q)uit e(X)it or ? for help
In this example, "netwrks" is detected as an error, and correction information is displayed. At this point, type "0" to use "networks" to correct the error, while it continues to display the next error until all errors have been displayed.
From the above example, we can see that the file testfile contains spelling errors. After correcting the file, a backup file is needed. At this point, use the following command:
ispell-b testfile #检查拼写错误的同时,备份文件
If the file has no spelling errors, no information is displayed. Using the ls command, we can also see that the backup file testfile.bak of testfile has been created in the current directory. The result is as follows:
$ ls #以列表的形式查看当前目录下的文件 examples.desktop testfile_1 testfile.bak xx01 模板图片 音乐 testfile testfile1 testfile_2 xx00 公共的视频文档桌面
Among them, the testfile.bak file is the backup file generated by the previous command, and its content is the same as the original testfile file.
Other Extensions
Linux Command Encyclopedia