We all have fat fingers sometimes and mistype commands, often transposing letters in a word or leaving letters out. When using Bash, you can fix it with the magic carets instead of retyping the whole command.
example:
[root@pippi opt]# usradd -u 666 -g 100 udergahad bash: usradd: command not found |
Oops, it should be “useradd”. OK, we’ll use the magic carets to fix.
[root@pippi opt]# ^ra^era^ useradd -u 666 -g 100 udergahad [root@pippi opt]# |
By replacing the string “ra” with the string “era”, we correct our spelling and the command runs as intended. The substitution will act on the first instance of the string. This one is pretty cool when people are hovering around looking over your shoulder, especially if you do it quickly.