Correcting Command Line Mistakes
Two ways to correct mistakes at the command line:
Let’s say you accidentally try to cd into a directory called stoat that doesn’t exist, then remember it’s the weasel directory you’re after:
$ cd ~/stoat cd: no such file or directory: stoat $ !!s/stoat/weasel/ $ pwd /home/you/weasel
What if you type the wrong command by accident, or change your mind about the best command to use? ^ to the rescue:
$ less ~/weasel.txt # Less shows the file, but it needs to be edited, so... $ ^less^vim # ...and the original argument is passed to the new command.