hunspell
Spell check files or text
TLDR
Check the spelling of a file
Check the spelling of a file with the en_US dictionary
List misspelled words in a file
SYNOPSIS
hunspell [OPTION]... [FILE]...
PARAMETERS
-a, --pipe
Pipe/filter mode: read stdin, print good words to stdout with markers under errors
-D, --data-dir=DIR
Specify data/encoding directory (default: /usr/share/hunspell)
-d, --dict=DICT[,DICT2]
Use specified dictionaries (e.g., en_US)
-h, --help
Display help and exit
-i, --input-encoding=ENC
Input encoding (default from locale)
-l
List misspelled words in input files/stdin
-L, --language=ll_CC
Set locale for dictionaries
-m, --stem
Use stemming for suggestions
-O, --output-encoding=ENC
Output encoding
-p, --personal=FILE
Personal dictionary file
-r
Suggest replacement words (default: suggestions)
-S, --savedict=FILE
Save unrecognized good words to dictionary
-T, --from-encoding=ENC
From encoding (for stdin/files)
-u, --userdict=FILE
User dictionary for adding words
-v, --version
Output version information
-w
Check word list on stdin (one word per line)
-B
Best suggestions only
-G
Two-stage suggestion (NGram)
-N
NGram suggestion
-t
TeX input mode
-e
Return false if any misspelling found (exit code)
DESCRIPTION
Hunspell is an open-source spell checker and morphological analyzer designed as a superior replacement for MySpell. It excels in handling complex word formations using affixation rules, making it ideal for languages with rich morphologies like Hungarian, Finnish, and Turkish. Widely integrated into applications such as LibreOffice, Mozilla Firefox, Thunderbird, and Google Chrome, the command-line tool enables interactive spell checking, batch processing of files, stdin filtering, suggestion generation, and hyphenation.
Key capabilities include support for multiple dictionaries, stemming for better suggestions, encoding conversion, and compatibility with MySpell/OpenOffice dictionaries. Users can check text interactively (default mode), list errors only, pipe input/output for scripts, or maintain personal dictionaries. Hunspell dictionaries consist of .dic (word list) and .aff (affix rules) files, often installed in /usr/share/hunspell. It handles UTF-8 and legacy encodings seamlessly.
CAVEATS
Requires matching dictionaries (.dic/.aff) installed; defaults vary by distro. Interactive mode may not work well in non-terminals. Limited hyphenation without specific .aff rules.
EXAMPLES
hunspell -d en_US document.txt
Interactive check of file.
cat file.txt | hunspell -d en_US -l
List misspelled words.
echo 'speling' | hunspell -d en_US -a
Pipe mode output.
DICTIONARY LOCATION
Find dicts: hunspell -D
Typically /usr/share/hunspell or ~/.hunspell
HISTORY
Developed by László Németh in the early 2000s to improve MySpell for OpenOffice.org/LibreOffice, focusing on complex morphologies. Became the standard spell checker for many open-source projects by 2010s, with ongoing enhancements for new languages and performance.


