Command Overview:
GNU Aspell is a free and open-source spell checker designed to replace Ispell. It provides both interactive and batch spell-checking capabilities, with support for multiple languages and document formats. Aspell is known for offering better suggestions for misspelled words than many other spell checkers.
Operating Modes:
- Interactive mode (
check command): Opens a UI where you can check and correct each misspelled word
- List mode (
list command): Outputs a list of misspelled words
- Pipe mode (
pipe command): Behaves like Ispell's pipe mode for compatibility with other programs
- Config dump (
dump command): Outputs various configuration information
Supported Document Types:
Aspell can handle various document formats through its mode option:
none: Plain text with no special processing
url: Text with URLs and email addresses
email: Email messages
sgml: SGML/XML documents
html: HTML documents
tex: TeX/LaTeX documents
texinfo: Texinfo documents
nroff: Nroff/Troff/Groff documents
man: Man pages
ccpp: C/C++ source code (spellchecks comments and strings)
perl: Perl source code
python: Python source code
Interactive Commands:
When using interactive mode (aspell check), you can use these commands:
- Space: Accept the word this time
- r: Replace with the suggested word or a manually entered one
- a: Add the word to your personal dictionary
- l: Add the word to the current session (forgotten at exit)
- i: Ignore the word for the rest of the session
- x: Exit the program, saving changes
- q: Quit without saving changes
- ?: Show help screen
- number: Replace with the suggestion at that number
Personal Word Lists:
Aspell maintains personal word lists to remember words you've added:
- Personal word lists typically have the
.pws extension
- By default, Aspell looks for
~/.aspell.[lang].pws
- You can specify a custom personal word list with
--personal=FILE
- Personal word lists are plain text files that can be edited directly
- The first line of a personal word list contains metadata (including encoding)
Replacement Modes:
Aspell offers several suggestion modes for misspelled words:
- ultra: Ultra fast, but fewer suggestions
- fast: Less accurate but faster
- normal: Default balance of speed and quality
- slow: More accurate but slower
- bad-spellers: Most accurate but slowest, best for those with severe spelling difficulties
Dictionary Management:
Aspell supports multiple dictionaries and languages:
- Use
aspell dump dicts to see available dictionaries
- Dictionaries are typically installed via the package manager (e.g.,
apt install aspell-en)
- Aspell looks for dictionaries in
/usr/lib/aspell or /usr/share/aspell
- Dictionary files have
.rws extension for the main wordlist
Configuration Files:
Aspell's behavior can be customized with configuration files:
- System-wide config:
/etc/aspell.conf
- Personal config:
~/.aspell.conf
- These are plain text files with option=value pairs
- Run
aspell dump config to see current configuration
Language Support:
Aspell has dictionaries for many languages:
- Set language with
--lang=LANG where LANG is a language code (en, fr, de, etc.)
- Some languages have multiple variants (e.g., en_US, en_GB)
- Language-specific dictionaries must be installed separately
- Some languages may require specific encodings (set with
--encoding)
Integration with Other Tools:
Aspell can be integrated with various tools:
- Text editors: Many editors like Vim, Emacs, and Nano can use Aspell
- Mail clients: Can be used for spell checking emails
- Build systems: Can be part of documentation generation pipelines
- Git hooks: Can check commit messages or documentation
Common Issues and Solutions:
- Encoding problems: Use
--encoding=utf-8 for Unicode text
- Markup in documents: Use the appropriate mode (html, tex, etc.)
- Technical terms: Create a domain-specific personal dictionary
- Performance issues: Use faster suggestion modes for large documents
- Missing dictionaries: Install the required language pack
Compared to Alternatives:
- Ispell: Aspell is designed as a more modern replacement with better suggestions
- Hunspell: Used by many office suites, better with compound words in some languages
- Language-specific tools: May offer better support for specific languages
- Grammar checkers: Tools like LanguageTool go beyond spelling to check grammar
Important Notes:
- Aspell does not check grammar, only spelling
- For multi-language documents, you need to check each language separately
- Personal dictionaries are not checked for correct spelling
- Aspell can be CPU-intensive with large documents and comprehensive dictionaries
- For programming files, only comments and strings are checked by default
- Aspell creates backup files by default when modifying documents
Related Commands:
ispell: Older spell checker that Aspell was designed to replace
hunspell: Alternative spell checker used in many office suites
spell: Simple UNIX spell checker
grep: Can be used with word lists to find potentially misspelled words
sed: Stream editor often used to process Aspell output
awk: Text processing tool useful for working with spell checker output
wc: Count words in a document
look: Display lines beginning with a given string (useful for dictionary lookups)
languagetool: Grammar, style and spell checker