Last Updated: February 25, 2016
· wkjagt

Copy previous command into current

When you use a double quotation mark in a shell command, it's replaced with whatever your previous command was. This is very useful when you need to execute the previous command, but prefixed with sudo, for example.

$ /etc/init.d/apache2 restart
Permission denied
$ sudo !!