Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Linux ispell command

Linux ispell command

Linux Command Reference Linux Command Reference

The Linux ispell command is used as a spell-checking program.

By default, ispell uses the /usr/lib/ispell/english.hash dictionary file to check text files. If it finds a word that is not in the dictionary, ispell suggests alternatives or lets you add the new word to your personal dictionary.

Syntax

ispell [-aAbBClmMnNPStVx][-d<字典文件>][-L<行数>][-p<字典文件>][-w<非字母字符>][-W<字符串长度>][要检查的文件]

Parameters:

Example

To check the spelling of a file, for example the file testfile, you can use the following command:



ispell testfile 

If suspicious words appear in the file, the first one is highlighted, and suggestions for corrections along with ispell's operation commands are given 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]  R)epl A)ccept I)nsert L)ookup U)ncap Q)uit e(X)it or ? for help

In this example, the misspelling "netwrks" is detected and a correction is suggested; entering "0" at this point uses "networks" to correct the error and continues to the next error until all errors have been shown.

From the example above we can see that the file testfile contains spelling errors and needs to be backed up after modification. Use the following command:



ispell-b testfile    #检查拼写错误的同时,备份文件 

If the file no longer has spelling errors, nothing is displayed, and the ls command shows that a backup file testfile.bak has been created in the current directory. The result is shown below:



$ ls #以列表的形式查看当前目录下的文件  

examples.desktop testfile_1 testfile.bak xx01 模板图片 音乐  

testfile testfile1 testfile_2 xx00 公共的视频文档桌面 

Here, testfile.bak is the backup file just created by the command, and its content is the same as the original testfile.

Linux Command Reference Linux Command Reference