Button to go to Home Page Home Button to go to About Page About Button to go to Archive Page Archive

Setting up spell check for navigating directories

03/24/2017 • 2 minute read

This is a neat trick I somehow just learned about. By running:

$ shopt -s cdspell

You can set Bash to fix minor spelling errors in cd commands. Here is an example:

$ mkdir spellingIsHard
$ cd spelingIsHard
bash: cd: spelingIsHard: No such file or directory
$ shopt -s cdspell
$ cd spelingIsHard

This only works in the interactive shell (for good reason) and I wish there was a set equivalent so it would be more portable, but overall this a very handy option.

Further Reading:

Got Questions, Comments, or Insults?

You May Also Enjoy