hunspell(1)
β¨ hunspell(1) β¨
General Commands Manual Β· spell checker, stemmer, morphological analyzer
okay bestie, sit down, hydrate, and let me tell you about the single most underrated CLI tool. it's hunspell. it checks your spelling, it stems, it does morphology. it's giving linguist core. π
π NAME π
hunspell β spell checker, stemmer and morphological analyzer β¨
π¦ SYNOPSIS π¦
hunspell [-1aDGHhLlmnOrstUuvwX] [--check-url] [--check-apostrophe] [-d
dict[,dict2,...]] [--help] [-i enc] [-P password] [-p dict]
[--no-default-personal] [--trace] [-u2] [-u3] [-vv] [--version] [--]
[text/OpenDocument/TeX/LaTeX/HTML/SGML/XML/nroff/troff file(s)]
π DESCRIPTION π
so hunspell is literally fashioned after the Ispell program β respect your elders, but make it cuntier. π
the most common usage is hunspell or hunspell filename. if you don't give it a filename parameter, hunspell checks the standard input. type cat and exsample on two input lines and you get an asterisk (meaning cat is a correct word) and a line with corrections:
$ hunspell -d en_US
Hunspell 1.2.3
*
& exsample 4 0: example, examples, ex sample, ex-sample
correct words get marked with an '*', '+' or '-', and unrecognized words get '#' or '&', on those output lines (more on that below β¨). (btw close the standard input with Ctrl+d on Unix/Linux, and Ctrl+Z Enter or Ctrl+C on Windows. don't just sit there staring at it π)
when you pass filename parameters, hunspell displays each word of the files that does not appear in the dictionary at the top of the screen and lets you change it. if there are "near misses" in the dictionary, those also show up on the following lines. then finally the line containing the word and the previous line get printed at the bottom of the screen. if your terminal can display reverse video, the word itself is highlighted (iconic behavior honestly π). you have the option of replacing the word completely, or choosing one of the suggested words. the commands are single characters, and case is ignored:
Rβ Replace the misspelled word completely.Spaceβ Accept the word this time only.Aβ Accept the word for the rest of thishunspellsession.Iβ Accept the word, capitalized as it is in the file, and update private dictionary.Uβ Accept the word, and add an uncapitalized (actually, all lower-case) version to the private dictionary.Sβ Ask a stem and a model word and store them in the private dictionary. The stem will be accepted also with the affixes of the model word.0-nβ Replace with one of the suggested words.Xβ Write the rest of this file, ignoring misspellings, and start next file.Qβ Exit immediately and leave the file unchanged.^Zβ Suspendhunspell.?β Give help screen.
π OPTIONS π
okay this is the part where we go β¨down the listβ¨. every single one. no skips, no cap. π«Ά
-1β Check only the first field on each line (delimiter = tab).-aβ the-aoption is intended to be used from other programs through a pipe. in this mode,hunspellprints a one-line version identification message, and then begins reading lines of input. for each input line, a single line is written to the standard output for each word checked for spelling on the line. if the word was found in the main dictionary, or your personal dictionary, then the line contains only a'*'. if the word was found through affix removal, then the line contains a'+', a space, and the root word. if the word was found through compound formation (concatenation of two words), then the line contains only a'-'.
if the word is not in the dictionary, but there are near misses, then the line contains an '&', a space, the misspelled word, a space, the number of near misses, the number of characters between the beginning of the line and the beginning of the misspelled word, a colon, another space, and a list of the near misses separated by commas and spaces.
also, each near miss or guess is capitalized the same as the input word unless such capitalization is illegal; in the latter case each near miss is capitalized correctly according to the dictionary.
finally, if the word does not appear in the dictionary, and there are no near misses, then the line contains a '#', a space, the misspelled word, a space, and the character offset from the beginning of the line. each sentence of text input is terminated with an additional blank line, indicating that hunspell has completed processing the input line.
these output lines can be summarized as follows:
OK: *
Root: + <root>
Compound:
-
Miss: & <original> <count> <offset>: <miss>, <miss>, ...
None: # <original> <offset>
for example, a dummy dictionary containing the words "fray", "Frey", "fry", and "refried" might produce the following response to the command echo 'frqy refries' | hunspell -a:
(#) Hunspell 0.4.1 (beta), 2005-05-26
& frqy 3 0: fray, Frey, fry
& refries 1 5: refried
this mode is also suitable for interactive use when you want to figure out the spelling of a single word (but this is the default behavior of hunspell without -a, too).
when in the -a mode, hunspell will also accept lines of single words prefixed with any of '*', '&', '@', '+', '-', '~', '#', '!', '%', '`', or '^'. a line starting with '*' tells hunspell to insert the word into the user's dictionary (similar to the I command). a line starting with '&' tells hunspell to insert an all-lowercase version of the word into the user's dictionary (similar to the U command). a line starting with '@' causes hunspell to accept this word in the future (similar to the A command). a line starting with '+', followed immediately by tex or nroff will cause hunspell to parse future input according to the syntax of that formatter. a line consisting solely of a '+' will place hunspell in TeX/LaTeX mode (similar to the -t option) and '-' returns hunspell to nroff/troff mode (but these commands are obsolete). a line starting with '~' is accepted and ignored. in the original ispell it set internal parameters (in particular, the default string character type) based on the filename given in the rest of the line, but that feature is not implemented in hunspell. the formatter parsing is changed only by the '+' command. a line prefixed with '#' will cause the personal dictionary to be saved. a line prefixed with '!' will turn on terse mode (see below), and a line prefixed with '%' will return hunspell to normal (non-terse) mode. a line prefixed with '`' will turn on verbose-correction mode (see below); this mode can only be disabled by turning on terse mode with '%'.
any input following the prefix characters '+', '-', '#', '!', '%', or '`' is ignored, as is a '~' line in its entirety. to allow spell-checking of lines beginning with these characters, a line starting with '^' has that character removed before it is passed to the spell-checking code. it is recommended that programmatic interfaces prefix every data line with an uparrow to protect themselves against future changes in hunspell. a file given to -a by name, or redirected into it, is read as this protocol too: a line of it that starts with one of these characters is a command, not text.
to summarize these:
* Add to personal dictionary
@ Accept word, but leave out of dictionary
# Save current personal dictionary
~ Accepted and ignored
+ Enter TeX mode
- Exit TeX mode
! Enter terse mode
% Exit terse mode
` Enter verbose-correction mode
^ Spell-check rest of line
in terse mode, hunspell will not print lines beginning with '*', '+', or '-', all of which indicate correct words. this significantly improves running speed when the driving program is going to ignore correct words anyway. β‘
in verbose-correction mode, hunspell includes the original word immediately after the indicator character in output lines beginning with '*', '+', and '-', which simplifies interaction for some programs.
--check-apostropheβ Check and force Unicode apostrophes (U+2019), if the spelling dictionary specifies either the ASCII or the Unicode apostrophe as a word character (seeWORDCHARS,ICONVandOCONVinhunspell(5)).--check-urlβ Check URLs, e-mail addresses and directory paths. π-Dβ Show the detected path of the loaded dictionary, the search path, and the available dictionaries.-d dict,dict2,...β Set dictionaries by their base names with or without paths. example of the syntax:
-d en_US,en_geo,en_med,de_DE,de_med
en_US and de_DE are base dictionaries; they consist of aff and dic file pairs: en_US.aff, en_US.dic and de_DE.aff, de_DE.dic. en_geo, en_med, and de_med are special dictionaries: dictionaries without an affix file. special dictionaries are optional extensions of the base dictionaries, usually carrying domain-specific (medical, legal, etc.) terms. there is no naming convention for special dictionaries other than the .dic extension: a dictionary without an affix file becomes an extension of the preceding base dictionary (the right order of the parameter list is needed for good suggestions). the first item of the -d parameter list must be a base dictionary.
-Gβ Print only correct words or lines.-Hβ The input file is in SGML/HTML format.-h,--helpβ Short help. π«Ά-i encβ Set input encoding.-Lβ Print lines with misspelled words.-lβ the "list" option is used to produce a list of misspelled words from the standard input.-mβ Analyze the words of the input text (see alsohunspell(5)about morphological analysis). without dictionary morphological data, shows the flags of the affixes of the word forms, for the use of dictionary developers. π§¬-nβ The input file is in nroff/troff format.-Oβ The input file is in OpenDocument (ODF or Flat ODF) format. ifunzipprogram is not installed, install it before using this option. β οΈ-P passwordβ Set password for encrypted dictionaries. π€«-p dictβ Set path of an additional personal dictionary. it is loaded together with the default personal dictionary, and words added during the session are saved to it instead of the default one. a relative path is looked for in the current folder and in the home folder. π
and bestieβ¦ we are SO not done. there's more of this page. keep scrolling, the rest of the options are waiting πβ¨
The default personal dictionary is $HOME/.hunspell_dicname, where dicname is the dictionary you set with -d or with the DICTIONARY environment variable. If you didn't do that, it depends on your locale settings β it checks LC_ALL, LC_MESSAGES, and LANG, in that order. And if none of those are set either, the default personal dictionary is $HOME/.hunspell_en_US. that's the whole lore bestie β¨
--no-default-personalβ okay so this one says: do not touch the default personal dictionary. Don't use it, don't write to it. If you named one with-por viaWORDLIST, that one still gets used, and any words you add during the session get saved to it. But without one of those? The words you add just live for the session and vanish when you're done. It's giving ghost words π» β and that's the point, because it means every user gets the same result, which is lowkey perfect for checking files in a shared repository.-rβ warns you about rare words, which ngl are also the words that are like... probably spelling mistakes. rare word, misspelled word, same font honestly.-sβ stems the words of the input text (and if you wanna know more about stemming, go readhunspell(5)). Heads up though: whether it actually works depends on the dictionary data you've got. π§-tβ tells hunspell the input file is in TeX or LaTeX format.--traceβ the β¨receiptsβ¨ mode. It reports how each and every word of the input text was decided, which is for dictionary developers specifically. One record gets printed per decision, and it's indented so you can see which decision it belongs to. You can run it alongside the other modes, or on its own β and on its own it just checks the input and prints only the records. no notes, just the decisions π-uβ for every misspelled word that has a suggestion, it prints the line number, the word itself, and the first suggestion. Important: a word with no suggestion isn't reported at all. if it can't help, it stays quiet.-Uβ prints the input text to standard output with every misspelled word swapped out for its first suggestion. All those replacements get listed on the standard error output in the same form as-u. And crucially: your actual input file is left completely unchanged. don't panic π«Ά-u2β prints the replacements that-Uwould make, but as asedscript β one substitution per line, each one followed by the original line as a comment. And it's written in the encoding of the input text so it can actually be applied to the file. chef's kiss, genuinely π₯-u3β prints one line per misspelled word, giving the file name, the line number, the word, and the first suggestion when there is one. This is the exact form compilers use to report errors, which means editors and build tools can usually read it and go straight to the word. main character format right there π-v,--versionβ print version number.-vvβ print theispell(1)-compatible version number. (yes, two v's. it's a different vibe.)-wβ print misspelled words (= lines) from a one-word-per-line input.-Xβ tells hunspell the input file is in XML format.--β ends the options. Everything after it is a file name, even if it starts with a hyphen. Also worth knowing: the options also end at the first file name anyway, so--is your "no fr fr, this is a file" insurance π
β¨ EXAMPLES β¨
hunspell example.htmlInteractive spell checking of an HTML file with the default dictionary.hunspell -d en_US example.htmlInteractive spell checking of an HTML file with theen_USdictionary.hunspell -d en_US,en_US_med medical.txtInteractive spell checking with multiple dictionaries. (yes bestie, comma-separated, go off)hunspell *.odtInteractive spell checking of ODF documents.hunspell -l *.odtList the bad words of ODF documents.hunspell -l *.odt | sort | uniq >unrecognizedSave the unrecognized words of ODF documents, removing duplicates. πhunspell -p unrecognized_but_good *.odtInteractive spell checking of ODF documents, using the previously saved and reduced word list as a personal dictionary β which speeds up the spell checking. obsessed with this workflow honestly π
π ENVIRONMENT π
DICTIONARYβ basically the same as-d.DICPATHβ the dictionary path: a list of folders separated by colons (semicolons on Windows πͺ), and these get searched before the standard folders.XDG_DATA_HOMEβ folder of the user's own data. Dictionaries installed in itshunspellsubfolder are found without needing a path. If it's not set, then$HOME/.local/shareis used.XDG_DATA_DIRSβ a colon-separated list of folders of shared data. Dictionaries in thehunspellsubfolder of each one are found without a path. If it's not set, then/usr/local/share:/usr/shareis used.WORDLISTβ equivalent to-p.
π¦ FILES π¦
The default dictionary depends on your locale settings. It searches LC_ALL, LC_MESSAGES, and LANG. And if none of those are set β or if the locale is C or POSIX β then the dictionary en_US is used.
$HOME/.hunspell_dicnameβ default path to the personal dictionary.
Okay so here's the β¨search orderβ¨ tea, bestie: a dictionary named without a path gets searched for in the current folder first, then in DICPATH, then in the hunspell subfolders of XDG_DATA_HOME and XDG_DATA_DIRS (not on Windows, sorry), and then in the standard system folders such as /usr/share/hunspell. On Windows, %USERPROFILE%\AppData\Roaming\hunspell is also searched. And if you ever wanna see the whole search path spelled out? That's what the -D option prints. no more guessing where it went π
π SEE ALSO π
hunspell (3)hunspell(5)
πΈ AUTHOR πΈ
The author of the Hunspell executable is LΓ‘szlΓ³ NΓ©meth. For the Hunspell library, go see hunspell(3).
And just so you know where all this came from: this manual is based on Ispell's manual. See ispell(1). π
and that's the whole page bestie, we made it π«Ά this iconic little manpage is dated 2026-04-30 and it's the one and only hunspell(1). go spell something gorgeous, you absolute legend β¨ππ
π¦ where this page comes from
- arch rolling: hunspell 1.7.6-1 Β· LGPL-2.1-or-later OR GPL-2.0-or-later OR MPL-1.1
- fedora 43: hunspell 1.7.6-1.fc43 Β· LGPL-2.1-or-later OR GPL-2.0-or-later OR MPL-1.1
- fedora 43: hunspell 1.7.6-1.fc43 Β· LGPL-2.1-or-later OR GPL-2.0-or-later OR MPL-1.1
- fedora 44: hunspell 1.7.6-1.fc44 Β· LGPL-2.1-or-later OR GPL-2.0-or-later OR MPL-1.1
- fedora 44: hunspell 1.7.6-1.fc44 Β· LGPL-2.1-or-later OR GPL-2.0-or-later OR MPL-1.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms