Ubuntu – Replacing some characters in the previous command

bashcommand linespecial characters

Sometimes, being rushed, it is possible to type some characters wrong in a command-line. If the command is long, the mistake correction may be cumbersome (using arrow keys). So the problem is: how can I replace characters typed wrong in the previous command as quickly as possible?

Best Answer

One character or more can be replaced with zero, one or more characters as follow:

$ some-wrong-long-command
$ ^wrong^correct^
some-correct-long-command

This quick substitution repeat the last command-line from terminal, replacing wrong string with correct string.

Examles:

enter image description here