Linux spell command

Updated: 11/06/2021 by Computer Hope
spell command

On Unix-like operating systems, the spell command is a spell-checking program which scans a text file for misspelled words, and prints each misspelled word on its own line.

This page covers the GNU/Linux version of spell.

Description

spell is a very minimalistic spell-checking program, based on the original UNIX spell checker. It reads the contents of file FILE, word for word, checking them against its dictionary. If a word does not correspond with any of spell's dictionary words, the word is printed.

If an input FILE is not specified, or is specified as a dash ("-"), spell performs a spell check of standard input.

Spell and ispell

spell is essentially a wrapper for the more complex ispell utility. However, unlike ispell (or the very similar GNU program, aspell), spell does not make any spelling suggestions. It only reports which words were misspelled.

Syntax

spell [OPTIONS] FILE ...

Options

-I, --ispell-version Print the version number of ispell, and exit.
-V, --version Print the version number of spell, and exit.
-b, --british Instead of an American English dictionary, use the British English dictionary, if it's available.
-d FILE, --dictionary=FILE Use FILE as a personal dictionary file.
-h, --help Display a help summary, and exit.
-i, --ispell=PROGRAM Use PROGRAM as the ispell executable.
-D DICTIONARY,
--ispell-dictionary=DICTIONARY
Use dictionary file DICTIONARY as the ispell dictionary.
-l, --all-chains (Ignored, but included for compatibility reasons.)
-n, --number Print line numbers. (For each misspelled word, also print the number of the line it was in.)
-o, --print-file-name Print file names. (For each misspelled word, also print the name of the file it was in.)
-s FILE, --stop-list=FILE (Ignored, but included for compatibility reasons.)
-v, --verbose When a word is not found in its literal form in the dictionary, it is printed.
-x, --print-stems (Ignored, but included for compatibility reasons.)

Examples

spell -on words.txt words2.txt

Checks the spelling of files words.txt and words2.txt, printing the file name (-o) and the line number (-n) of each misspelled word. Output resembles the following:

words.txt:1: Thisz
words.txt:2: fyle
words.txt:5: haz
words.txt:13: miztakes
words.txt:16: innit
words2.txt:1: Mannny
words2.txt:1: wordsis
words2.txt:4: aree
words2.txt:6: miszpelleds
words2.txt:19: inthis
words2.txt:21: fyyle
words2.txt:42: allso

deroff — Remove nroff/troff, tbl, and eqn constructs from files.
eqn — Language processor for describing equations.
sort — Sort the lines in a text file.
tbl — Preprocessor which formats tables for nroff or troff.
troff — Typeset or format documents for terminal display or line-printer.