Last Updated: February 25, 2016
·
807
· adamrights

Repeat your last shell command.

Shell alias for last command.

Typing two exclamation marks at the command prompt '!!' is an alias for the last command, and is real useful if you forget to type sudo after typing some long command.
Example:

''' shell
$ mv './foo' '/some/place/root/owns/bar' 
# you forgot to type sudo
$ sudo !! <CR>  #<CR> == hitting enter.   
#produces
$ sudo mv './foo' '/some/place/root/owns/bar'
'''

'

1 Response
Add your response

How did I not know about this? Sheesh, what a great time-saver!

over 1 year ago ·