Spell Check on Your Linux Terminal
Tags: programming, linux, opensource, computerscience
Published: 2023-01-23 15:21:06

**Hi everyone, it’s me again. In this article, I will guide you guys on how to check spelling right into our Linux terminal. The advantage for this is that we don’t need the internet to use some online tools like Grammarly or google translate… Cool, right? So, let’s jump into it.**

## How to use spell check in Linux
Well in order to do this, we will use the package name `aspell`.

Aspell is an interactive spell checker which checks the spelling via standard input or by reading a specific file. Also, it can read and check spelling in markdown or HTML files too.

To check if your terminal is currently having aspell or not, run this command.

`aspell --help`


![aspell help](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n2065t7l33texhf151zw.png)

If you encounter some error, then definitely you do not have it at the moment. Don’t worry, run this command to install it to your terminal.

`sudo apt install aspell -Y`

## How To Use Aspell to Check the Spelling of Word one-by-one?

Super straightforward, all you need to do is pass this line of code to your terminal then type the word that need to be checked.

`aspell -a`

For example


![spell check word](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e976hxot2r1x1sj75rkt.png)

As you can see, when I type the wrong word helo, aspell automatically recommend for us all the correct word that related to helo. In this case, hello is the correct one.

##How to Check the Spelling of a Word from a File

Simply execute this command

`aspell -c [fileName]`

For example, let spell check a file name index.txt.

`aspell -c index.txt`


The following screen will display to your terminal.

![aspell](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1hbmfvb3q88448j0mgoj.png)

As you can see, each incorrect word will be highlighted by aspell, to correct that wrong word, simply press the number of word that we want to replace. Number 1 is the best choice for this usecase.

![aspell](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m90n5x7hhskuz9piu703.png)

Note that the second incorrect word will be selected next, and you can do the same with the above example.

## How to Check Spelling on Other Files?

Like I mentioned before, aspell can be used for other files such as HTML or markdown… All you need to do is execute this command line.

`aspell check --mode=[mode_type] [file_name]`

The supported modes are `none`, `url`, `email`, `markdown`, `html`, `tex`, `texinfo`, and `nroff`.


Let’s see a quick example of fixing the spelling mistakes on a markdown file.

`aspell -c --mode=markdown spellcheck.md`


![aspell](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y3n23fiet5o5z7ujshir.png)

## 🧡 Conclusion

And that all for this blog, if this was helpful to you, please leave me a like👋 and follow me 😘. That will help me a lot.

If you want more exciting content like this, then you can refer to my [portfolio](https://minhct.netlify.app/) website or my [Github](https://github.com/trinhcamminh) for more detail 😎.


![my logo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i291ltifo0aaq197sse9.png)