Linux CLI 47 🐧 aspell command
cat test.txt
aspell -c test.txt
aspell -a
aspell list
echo "Helo to everone and godmorning" | aspell -a
echo "<p>Helo to everone and godmorning</p>" | aspell -a --mode=html
sudo apt/dnf/zypper install aspell-it
echo "Cia tuti, come stat" | aspell -a --lang=it
aspell is a command-line spell checker. It can check a whole file interactively, check individual words or sentences piped in from stdin, or filter text in special formats like HTML, email, or LaTeX. It supports dozens of languages and several suggestion modes.
Key point: aspell is the successor to ispell and is generally more accurate and flexible. Most Linux distributions ship it, but language dictionaries are separate packages — you install the one(s) you need.
a – aspell command
aspell is used to check text in various languages. It can be used directly from the command line or on files.
Syntax:
aspell [options] [input]
Common options:
| Option | Purpose |
|---|---|
-a | Check text in pipe mode (one word or line at a time) |
-c FILE | Check a file interactively |
list | Check multiple words from stdin, print only misspelled ones |
--sug-mode=MODE | Suggestion mode: fast, normal, slow, ultra |
--mode=MODE | Input format: url, email, html, tex, nroff, none |
--lang=LANG | Language (e.g., en_US, it, de) |
-l | List misspelled words (same as list) |
--ignore=N | Ignore words of N characters or fewer |
--dont-suggest | Don’t suggest corrections |
Pipe mode (-a):
This is how you feed aspell text from a pipe or a script. It outputs one line per word, with a status code:
| Prefix | Meaning |
|---|---|
* | Word is correct |
& | Word is misspelled, with suggestions |
# | Word is misspelled, no suggestions |
+ | Word is correct (root form) |
- | Word is correct (compound) |
Example:
$ echo "Helo to everone and godmorning" | aspell -a
@(#) International Ispell Version 3.1.20 (but really Aspell 0.60.8)
& Helo 4 0: Hello, Helot, Hero, Halo
* to
& everone 6 0: everyone, every one, Everton, overone, evzone, evertone
* and
& godmorning 10 0: good morning, good-morning, godmothering, goodmorning, ...
Breaking down one line:
& Helo 4 0: Hello, Helot, Hero, Halo
│ │ │ │ │
│ │ │ │ └── suggestions
│ │ │ └──── offset in the line
│ │ └────── number of suggestions
│ └─────────── the misspelled word
└───────────── status (& = misspelled)
Interactive file mode (-c):
$ aspell -c test.txt
This opens an interactive terminal UI where you can:
- Accept a suggestion
- Type your own replacement
- Add the word to your personal dictionary
- Skip the word
- Abort
List mode:
$ cat words.txt
hello
wrld
correct
speling
$ aspell list < words.txt
wrld
speling
list prints only the misspelled words, one per line — perfect for scripts.
Language and dictionary installation:
Dictionaries are separate packages:
| Distro | Command |
|---|---|
| Debian/Ubuntu | sudo apt install aspell-it |
| Red Hat/Fedora | sudo dnf install aspell-it |
| openSUSE | sudo zypper install aspell-it |
The naming convention is aspell-<lang>. Examples: aspell-en, aspell-fr, aspell-de, aspell-es, aspell-it.
Check a sentence in another language:
$ echo "Cia tuti, come stat" | aspell -a --lang=it
@(#) International Ispell Version 3.1.20 (but really Aspell 0.60.8)
& Cia 3 0: Ci, Cina, Città
* tuti
& come 4 0: Come, com'è, com, como
* stat
HTML mode:
When checking HTML, you want aspell to ignore tags and entities, not flag them as misspelled:
$ echo "<p>Helo to everone and godmorning</p>" | aspell -a --mode=html
@(#) International Ispell Version 3.1.20 (but really Aspell 0.60.8)
& Helo 4 0: Hello, Helot, Hero, Halo
* to
& everone 6 0: everyone, every one, Everton, ...
* and
& godmorning 10 0: good morning, ...
Without --mode=html, aspell would try to spell-check the tags and entities too.
Other modes:
| Mode | Use for |
|---|---|
html | HTML files — skips tags and entities |
tex | LaTeX — skips commands |
email | Email — skips headers, quotes |
url | URLs — skips http://, slashes |
nroff | man pages — skips troff macros |
none | Plain text |
# Check an HTML page
$ aspell -c page.html --mode=html
# Check a LaTeX document
$ aspell -c paper.tex --mode=tex
# Check an email draft
$ aspell -c draft.eml --mode=email
# Check plain text
$ aspell -c notes.txt --mode=none
Suggestion modes:
| Mode | Speed | Accuracy |
|---|---|---|
ultra | Fastest | Least accurate |
fast | Fast | Decent |
normal | Medium | Good (default) |
slow | Slow | Best |
$ echo "godmorning" | aspell -a --sug-mode=fast
$ echo "godmorning" | aspell -a --sug-mode=slow
b – aspell examples
Here are the practical examples you’ll use most.
1. Check a file interactively:
$ cat test.txt
Helo to everone and godmorning
This is a testt of the speling checker
$ aspell -c test.txt
aspell opens an interactive UI at each misspelled word. You can pick a suggestion by number, type your own, add to dictionary (a), ignore (i), or quit.
2. Check a single word from stdin:
$ aspell -a
@(#) International Ispell Version 3.1.20 (but really Aspell 0.60.8)
helo
& helo 4 0: hello, halo, hero, help
^D
Type words one per line, press Ctrl+D to exit.
3. Check a list of words:
$ aspell list
helo
wrld
hello
correct
^D
helo
wrld
Only misspelled words are printed — great for scripts.
4. Check a sentence piped in:
$ echo "Helo to everone and godmorning" | aspell -a
@(#) International Ispell Version 3.1.20 (but really Aspell 0.60.8)
& Helo 4 0: Hello, Helot, Hero, Halo
* to
& everone 6 0: everyone, every one, Everton, overone, evzone, evertone
* and
& godmorning 10 0: good morning, good-morning, godmothering, goodmorning, ...
5. Check HTML with the right mode:
$ echo "<p>Helo to everone and godmorning</p>" | aspell -a --mode=html
The --mode=html tells aspell to skip tags like <p> and </p> instead of flagging them.
6. Install a new language:
$ sudo apt install aspell-it
$ sudo dnf install aspell-it
$ sudo zypper install aspell-it
7. Check a sentence in Italian:
$ echo "Cia tuti, come stat" | aspell -a --lang=it
Without --lang=it, aspell would check the sentence against the English dictionary and flag almost every word.
More practical examples:
# Check a whole file, print only misspelled words
$ aspell list < document.txt
# Count misspelled words
$ aspell list < document.txt | wc -l
# Unique misspelled words
$ aspell list < document.txt | sort -u
# Check a Markdown file as plain text
$ aspell -c README.md --mode=none
# Check a Python source file (comments and strings)
$ aspell -c script.py --mode=none
# Ignore words of 2 characters or fewer
$ echo "a bc def ghijk" | aspell -a --ignore=2
# Skip suggestions, just flag
$ echo "Helo wrld" | aspell -a --dont-suggest
# Use a personal dictionary
$ aspell -c notes.txt --personal=~/.aspell.en.pws
# Add a word to your personal dictionary
$ echo "kronos" | aspell -a
# then at the prompt in -c mode, press 'a'
# Check a directory of files
$ for f in *.txt; do
echo "=== $f ==="
aspell list < "$f"
done
# Check a file and save the corrections interactively
$ aspell -c report.txt
# saves automatically when you exit
Using aspell list in scripts:
# Fail if there are misspellings
$ if aspell list < README.md | grep -q .; then
echo "README has misspellings!"
aspell list < README.md
exit 1
fi
# Report the count
$ COUNT=$(aspell list < doc.txt | wc -l)
$ echo "Misspelled words: $COUNT"
# Most common misspellings
$ aspell list < doc.txt | sort | uniq -c | sort -rn | head
Personal and project dictionaries:
# Your personal dictionary
$ ls ~/.aspell.*.pws
/home/kronos/.aspell.en.pws
# Add words manually
$ echo "personal_ws-1.1 en 2" > ~/.aspell.en.pws
$ echo "kronos" >> ~/.aspell.en.pws
$ echo "olympos" >> ~/.aspell.en.pws
# Use a project dictionary
$ aspell -c doc.txt --personal=./project.pws
Complete Example Session
# ============================================
# PART 1: LOOK AT THE FILE
# ============================================
$ cat test.txt
Helo to everone and godmorning
This is a testt of the speling checker
# ============================================
# PART 2: CHECK THE FILE INTERACTIVELY
# ============================================
$ aspell -c test.txt
# Interactive UI opens at "Helo"
# Options: 0) Hello 1) Helot 2) Hero 3) Halo
# Pick a number, or type a replacement, or:
# a = add to dictionary
# i = ignore
# r = replace
# x = exit
# ============================================
# PART 3: PIPE A SENTENCE
# ============================================
$ echo "Helo to everone and godmorning" | aspell -a
@(#) International Ispell Version 3.1.20 (but really Aspell 0.60.8)
& Helo 4 0: Hello, Helot, Hero, Halo
* to
& everone 6 0: everyone, every one, Everton, overone, evzone, evertone
* and
& godmorning 10 0: good morning, good-morning, godmothering, goodmorning, ...
# ============================================
# PART 4: SINGLE WORD MODE
# ============================================
$ aspell -a
@(#) International Ispell Version 3.1.20 (but really Aspell 0.60.8)
helo
& helo 4 0: hello, halo, hero, help
hello
* hello
^D
# ============================================
# PART 5: LIST MODE
# ============================================
$ aspell list
helo
wrld
hello
correct
^D
helo
wrld
# ============================================
# PART 6: HTML MODE
# ============================================
$ echo "<p>Helo to everone and godmorning</p>" | aspell -a --mode=html
@(#) International Ispell Version 3.1.20 (but really Aspell 0.60.8)
& Helo 4 0: Hello, Helot, Hero, Halo
* to
& everone 6 0: everyone, every one, ...
* and
& godmorning 10 0: good morning, ...
# ============================================
# PART 7: INSTALL ITALIAN DICTIONARY
# ============================================
$ sudo apt install aspell-it
Reading package lists... Done
Building dependency tree... Done
...
Setting up aspell-it (2.2-3) ...
$ aspell dicts
en
en_US
it
it_IT
# ============================================
# PART 8: CHECK ITALIAN TEXT
# ============================================
$ echo "Cia tuti, come stat" | aspell -a --lang=it
@(#) International Ispell Version 3.1.20 (but really Aspell 0.60.8)
& Cia 3 0: Ci, Cina, Città
* tuti
& come 4 0: Come, com'è, com, como
* stat
# ============================================
# PART 9: SCRIPT USAGE
# ============================================
# Count misspellings in a file
$ aspell list < test.txt | wc -l
3
# Unique misspellings
$ aspell list < test.txt | sort -u
godmorning
helo
speling
testt
# Most common
$ aspell list < big-doc.txt | sort | uniq -c | sort -rn | head -5
12 recieve
8 seperate
6 definately
4 occured
3 enviroment
# ============================================
# PART 10: CHECK A DIRECTORY
# ============================================
$ for f in *.txt; do
echo "=== $f ==="
aspell list < "$f"
done
=== test.txt ===
Helo
everone
godmorning
testt
speling
=== README.txt ===
recieve
seperate
Quick Reference
aspell — Modes
| Command | Purpose |
|---|---|
aspell -c FILE | Interactive check on a file |
aspell -a | Pipe mode — word by word |
aspell list | List misspelled words from stdin |
aspell -l | Same as list |
aspell check FILE | Same as -c |
aspell dump dicts | List installed dictionaries |
aspell — Options
| Option | Purpose |
|---|---|
--lang=LANG | Language (en_US, it, de, …) |
--mode=MODE | Input format |
--sug-mode=MODE | Suggestion mode |
--ignore=N | Ignore short words |
--dont-suggest | No suggestions |
--personal=FILE | Personal dictionary |
--dict-dir=DIR | Dictionary directory |
aspell — Input Modes
| Mode | Use for |
|---|---|
html | HTML files |
tex | LaTeX |
email | |
url | URLs |
nroff | man pages |
none | Plain text |
aspell — Suggestion Modes
| Mode | Speed | Accuracy |
|---|---|---|
ultra | Fastest | Lowest |
fast | Fast | Decent |
normal | Medium | Good |
slow | Slow | Best |
aspell — Pipe Output Codes
| Prefix | Meaning |
|---|---|
* | Correct word |
& | Misspelled with suggestions |
# | Misspelled, no suggestions |
+ | Correct (root) |
- | Correct (compound) |
Dictionaries by Distro
| Distro | Install |
|---|---|
| Debian/Ubuntu | sudo apt install aspell-it |
| Red Hat/Fedora | sudo dnf install aspell-it |
| openSUSE | sudo zypper install aspell-it |
Best Practices
✅ Do This:
# Use -c for interactive correction
aspell -c document.txt # ✅
# Use list in scripts
aspell list < document.txt # ✅
# Use the right mode for HTML/LaTeX
aspell -c page.html --mode=html # ✅
# Specify the language explicitly
aspell -c text.txt --lang=en_US # ✅
# Install the dictionary you need
sudo apt install aspell-en aspell-fr # ✅
# Use --ignore to skip short tokens
aspell list --ignore=2 < file.txt # ✅
# Count misspellings in CI
aspell list < README.md | wc -l # ✅
# Use a personal dictionary for names
aspell -c notes.txt --personal=~/.aspell.en.pws # ✅
❌ Don’t Do This:
# Don't run aspell on HTML without --mode=html
aspell -c page.html # ❌ flags tags
# Don't forget to install the dictionary
aspell -a --lang=it # ❌ fails if aspell-it missing
# Don't use -a interactively expecting suggestions
aspell -a < file.txt # ⚠️ use list for scripts
# Don't pipe binary files
aspell list < image.png # ❌ garbage output
# Don't ignore the mode for LaTeX
aspell -c paper.tex # ❌ flags \commands
# Don't rely on the default language
aspell -c doc.txt # ⚠️ may be wrong locale
Common Pitfalls
| Pitfall | Problem | Solution |
|---|---|---|
| No dictionary | “No word lists” | Install aspell-<lang> |
| HTML tags flagged | Wrong mode | --mode=html |
| LaTeX commands flagged | Wrong mode | --mode=tex |
| Wrong language | Everything flagged | --lang=xx |
aspell list empty | No input | Pipe a file |
| Slow suggestions | Default mode | Use --sug-mode=fast |
| Names flagged | Not in dictionary | Add to personal dictionary |
-a not interactive | It’s pipe mode | Use -c for interactive |
Real-World Examples
1. Check a Document Interactively
$ aspell -c report.txt
# Fix each misspelling in the UI, save on exit
2. List Misspellings in a File
$ aspell list < report.txt
recieve
seperate
definately
3. Count Misspellings
$ aspell list < report.txt | wc -l
3
4. Unique Misspellings
$ aspell list < report.txt | sort -u
definately
recieve
seperate
5. Check HTML with the Right Mode
$ aspell -c index.html --mode=html
6. Check LaTeX
$ aspell -c paper.tex --mode=tex
7. Check Italian Text
$ echo "Cia tuti, come stat" | aspell -a --lang=it
& Cia 3 0: Ci, Cina, Città
...
8. Install Multiple Dictionaries
$ sudo apt install aspell-en aspell-fr aspell-de aspell-es aspell-it
$ aspell dicts
en
en_US
fr
fr_FR
de
de_DE
es
es_ES
it
it_IT
9. Check Comments in Source Code
$ aspell -c script.py --mode=none
10. CI Gate for Documentation
$ if aspell list < README.md | grep -q .; then
echo "Misspellings found:"
aspell list < README.md
exit 1
fi
echo "No misspellings."
11. Add a Word to Your Personal Dictionary
$ echo "personal_ws-1.1 en 1" > ~/.aspell.en.pws
$ echo "kronos" >> ~/.aspell.en.pws
# Now "kronos" won't be flagged
12. Use a Project Dictionary
$ aspell -c doc.txt --personal=./project-words.pws
13. Most Common Misspellings in a Directory
$ for f in *.txt; do aspell list < "$f"; done | sort | uniq -c | sort -rn | head
12 recieve
8 seperate
6 definately
14. Check Email Draft
$ aspell -c draft.eml --mode=email
15. Ignore Short Words
$ aspell list --ignore=3 < code.txt
# Skips words of 3 characters or fewer
16. Compare Suggestion Modes
$ echo "godmorning" | aspell -a --sug-mode=fast
$ echo "godmorning" | aspell -a --sug-mode=slow
17. Check a URL’s Text
$ curl -s https://example.com | aspell list --mode=html
18. Spell-Check a man Page Source
$ aspell -c mytool.1 --mode=nroff
Visual: How aspell Works
┌──────────────────────────────────────────────┐
│ aspell -c FILE │
│ │
│ Reads the file, presents each misspelling │
│ interactively: │
│ │
│ ┌────────────────────────────────────────┐ │
│ │ Helo │ │
│ │ 1) Hello 2) Helot 3) Hero │ │
│ │ 4) Halo 5) Halo │ │
│ │ │ │
│ │ [a]dd [i]gnore [r]eplace [x]it │ │
│ └────────────────────────────────────────┘ │
│ │
│ Saves corrections when you exit │
│ │
└──────────────────────────────────────────────┘
┌──────────────────────────────────────────────┐
│ aspell list < FILE │
│ │
│ Non-interactive — prints misspelled words │
│ │
│ Input: │
│ Helo to everone and godmorning │
│ │
│ Output: │
│ Helo │
│ everone │
│ godmorning │
│ │
│ Perfect for scripts │
│ │
└──────────────────────────────────────────────┘
┌──────────────────────────────────────────────┐
│ aspell -a (pipe mode) │
│ │
│ Each word gets a status line: │
│ │
│ * → correct │
│ & → misspelled with suggestions │
│ # → misspelled, no suggestions │
│ │
│ Example: │
│ & Helo 4 0: Hello, Helot, Hero, Halo │
│ │
└──────────────────────────────────────────────┘
Summary
| Command | Purpose | Example |
|---|---|---|
aspell -c FILE | Interactive check | aspell -c test.txt |
aspell -a | Pipe mode | echo "helo" | aspell -a |
aspell list | List misspellings | aspell list < file.txt |
aspell -l | Same as list | aspell -l < file.txt |
--lang=LANG | Set language | --lang=it |
--mode=MODE | Input format | --mode=html |
--sug-mode=MODE | Suggestion mode | --sug-mode=fast |
--ignore=N | Skip short words | --ignore=2 |
--personal=FILE | Personal dictionary | --personal=~/.aspell.en.pws |
aspell dicts | List dictionaries | aspell dicts |
Key takeaways:
aspell -cchecks a file interactively — you fix each word as you goaspell -ais pipe mode — feed it words and read status linesaspell listprints only misspelled words — perfect for scripts and CI- Language dictionaries are separate packages — install
aspell-<lang>for each language - Use
--lang=xxto check text in another language - Use
--mode=html(ortex,email,url,nroff) to skip markup - Use
--sug-modeto trade speed for better suggestions - Use
--ignore=Nto skip short words that are often false positives - The personal dictionary (
~/.aspell.en.pws) is where you add names and jargon - In pipe mode,
*= correct,&= misspelled with suggestions,#= misspelled without
Remember: aspell is simple but powerful — interactive for one-off corrections, list for automation, -a for piping. Install the dictionaries you need. Set --lang and --mode correctly, or you’ll get noise. Add names to your personal dictionary once and forget about them. And if you’re spell-checking in a script or CI pipeline, aspell list with a wc -l or grep -q is all you need.
Stop using slow, ad-bloated tool sites! 🤮
🔎 Search “KandZ Tools” on Google to use many professional utilities for free.
KandZ.me is the ultimate minimalist hub for:
✅ Finance (Mortgage, Interest, Inflation)
✅ Tech (Base64, JSON, Dev Suite, IP)
✅ Health (BMI, BMR, TDEE)
✅ Productivity (Timer, Workspace, QR)
⚡️ Fast & Private
🔒 No data leaves your device
💎 100% Free
🔗 Use it now: https://tools.kandz.me
🔖 Bookmark it—you’ll need it later!