Even though we all profess to being keyboard ninjas we all have the occasional fat-finger moment and a typo creeps in. When you turn to the command line, in either Windows or Linux, it’s generally in an attempt to accomplish a task faster than it would normally take when you used a traditional GUI. It’s easy to see then how a typo destroys all that efficiency you graved in the first place! Sometimes our fingers just can’t keep up with our minds in this instance.

Terminal users in Linux or even OS X have an awesome keyboard shortcut that can greatly swing the efficiency balance back to your favor when the inevitable typo happens.

Here I meant to execute vi

Rather than retype or otherwise edit the previous command you can use the carat ^ to rerun the last command with your corrections. In our example, execute ^vo^vi.

It can be quite the time-saver once you’ve conditioned yourself to use it. Unfortunately, though, it only works on commands and not any file paths – if I typed apache instead of apache2 the ^ would not help me. You are probably using auto completion with the tab key – so no big deal right?