hunspell(1) General Commands Manual hunspell(1)
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
Hunspell is fashioned after the Ispell program. The most common usage is
"hunspell" or "hunspell filename". Without filename parameter, hunspell
checks the standard input. Typing "cat" and "exsample" on two input
lines results in 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 are marked with an '*', '+' or '-', unrecognized words with
'#' or '&', in output lines (see below). (Close the standard input with
Ctrl-d on Unix/Linux and Ctrl-Z Enter or Ctrl-C on Windows.)
With filename parameters, hunspell will display each word of the files
which does not appear in the dictionary at the top of the screen and
allow you to change it. If there are "near misses" in the dictionary,
then they are also displayed on following lines. Finally, the line
containing the word and the previous line are printed at the bottom of
the screen. If your terminal can display in reverse video, the word
itself is highlighted. You have the option of replacing the word
completely, or choosing one of the suggested words. Commands are single
characters as follows (case is ignored):
R Replace the misspelled word completely.
Space Accept the word this time only.
A Accept the word for the rest of this hunspell session.
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 Suspend hunspell.
? Give help screen.
OPTIONS
-1 Check only the first field on each line (delimiter = tab).
-a The -a option is intended to be used from other programs through a
pipe. In this mode, hunspell prints 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 (see WORDCHARS, ICONV and OCONV in hunspell(1)).
--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.
hunspell(1) 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. If
unzip program 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.
The default personal dictionary is $HOME/.hunspell_dicname, where
dicname is the dictionary set with -d or the DICTIONARY
environment variable. Otherwise it depends on the locale settings.
The following environment variables are searched: LC_ALL,
LC_MESSAGES, and LANG. If none are set then the default personal
dictionary is $HOME/.hunspell_en_US.
--no-default-personal
Don't use the default personal dictionary. A dictionary named with
-p or WORDLIST is still used, and words added during the session
are saved to it. Without one, added words are kept for the session
only. This gives the same result for every user, for example when
checking files in a shared repository.
-r Warn of rare words, which are also potential spelling mistakes.
hunspell(1) about
stemming). It depends on the dictionary data.
-t The input file is in TeX or LaTeX format.
--trace
Report how each word of the input text was decided, for the use of
dictionary developers. One record is printed per decision,
indented to show which decision it belongs to. It can be given
alongside the other modes, and on its own it checks the input and
prints only the records.
-u For each misspelled word that has a suggestion, print the line
number, the word itself and the first suggestion. A word with no
suggestion is not reported.
-U Print the input text to the standard output with each misspelled
word replaced by its first suggestion. The replacements are listed
on the standard error output in the same form as -u. The input
file itself is left unchanged.
-u2 Print the replacements that -U would make as a sed script, one
substitution per line, each followed by the original line as a
comment. The script is written in the encoding of the input text,
so that it can be applied to the file.
-u3 Print one line for each misspelled word, giving the name of the
file, the line number, the word, and the first suggestion when
there is one. This is the form that compilers use to report
errors, so editors and build tools can usually read it and go
straight to the word.
-v, --version
Print version number.
-vv Print ispell(1) compatible version number.
-w Print misspelled words (= lines) from one word/line input.
-X The input file is in XML format.
-- End the options. Every argument after it is a file name, even one
that starts with a hyphen. The options also end at the first file
name.
EXAMPLES
hunspell example.html
Interactive spell checking of an HTML file with the default
dictionary.
hunspell -d en_US example.html
Interactive spell checking of an HTML file with the en_US
dictionary.
hunspell -d en_US,en_US_med medical.txt
Interactive spell checking with multiple dictionaries.
hunspell *.odt
Interactive spell checking of ODF documents.
hunspell -l *.odt
List bad words of ODF documents
hunspell -l *.odt | sort | uniq >unrecognized
Save unrecognized words of ODF documents (removing duplicates).
hunspell -p unrecognized_but_good *.odt
Interactive spell checking of ODF documents, using the previously
saved and reduced word list, as a personal dictionary, to speed up
spell checking.
ENVIRONMENT
DICTIONARY
Similar to -d.
DICPATH
Dictionary path: a list of folders, separated by colons
(semicolons on Windows), searched before the standard folders.
XDG_DATA_HOME
Folder of the user's own data. Dictionaries installed in its
hunspell subfolder are found without a path. If it is not set,
$HOME/.local/share is used.
XDG_DATA_DIRS
Colon-separated list of folders of shared data. Dictionaries in
the hunspell subfolder of each are found without a path. If it is
not set, /usr/local/share:/usr/share is used.
WORDLIST
Equivalent to -p.
FILES
The default dictionary depends on the locale settings. The following
environment variables are searched: LC_ALL, LC_MESSAGES, and LANG. If
none are set, or the locale is C or POSIX, the dictionary en_US is used.
$HOME/.hunspell_dicname Default path to personal dictionary.
A dictionary named without a path is searched for in the current folder,
then in DICPATH, then in the hunspell subfolders of XDG_DATA_HOME and
XDG_DATA_DIRS (not on Windows), then in the standard system folders such
as /usr/share/hunspell. On Windows
%USERPROFILE%\AppData\Roaming\hunspell is also searched. The -D option
prints the full search path.
SEE ALSO
hunspell(1)
AUTHOR
Author of Hunspell executable is Laszlo Nemeth. For Hunspell library, see
hunspell(1).
This manual is based on Ispell's manual. See ispell(1).
2026-04-30 hunspell(1)
hunspell 1.7.6 - Generated Wed Oct 28 13:24:01 CDT 2026
