How to use Hunspell to spell check in the terminal
Spell checking before uploading is a clever thing to do, especially if you are like me and power through getting an idea written while making a few errors along the way. I seem to work efficiently like that.
But all those errors can't go online; I mean, they could but I like to have everything spelled correctly and hope for the best with my grammar and punctuation.
There are hundreds of tools online, but that means:
- Firing up a browser
- Search for spell checking tools
- Yes, I'll accept your damn cookies
- No, I don't want to sign up to your newsletter
- Deal with any other evil website shenanigans
Oh, you are still focused on that word, right?
What was it again?
I'll just read this article for a bit after watching a video.
2 hours later.....
All this just to get the spelling checked....NOPE!
In all my years using Linux, I am always learing something new. I've know about and sometimes used command line based spell-checkers, but always defaulted beck to the crappy method mentioned above.
Hunspell is a great tool and it follows the UNIX philosophy of doing one thing and doing it well.
Make sure you have two hunspell packages installed, in my case I'm using Australian English so I would install:
Taylor the language to your locale.
You have several options, but the two I mainly use are:
- Check the spelling of a document interactively
- Get a list of misspelled words
To check the spelling of a document simply use this command:
To get a list of all the incorrect words, use this command;
hunspell -l /path/to/file your mispelled words will appear like this
Many other options are available, best to check the man page for all of the options.
I'm regretting not using this amazing little application years ago, but never late than never.