Typed a command and rushed to hit Enter, only to find that you had a typo in it. While you can use the up and down arrows to navigate the command history and edit the typo, there’s an easier and faster way.


You can easily replace the typo with the correct command and execute it like so:

# nestat -npltu | grep 22
# ^nestat^netstat


That’s right. Using two carat signs (they should be followed by the typo and the right word, respectively) you can correct the typo and run the command automatically afterwards.


You must take note that this method only works for the previous command (most recent command executed), when you try to correct a typo for a command executed earlier on, the shell will print out an error.

Esta resposta foi útil? 0 Utilizadores acharam útil (0 Votos)