I avoid this type of mistakes using # whenever I am doing something delicate
The symbol # is for comments so if you do $ # sudo commandNothing will happen because of the # after I did that I make sure everything is well written by pressing up and then when I am sure everything is OK is when I delete the # and hit enter
This have saved me from mistakes when using rm for example.