/ shell

Run the last shell command with sudo

I often an into the situation where I type in a long command, hit enter and then figure out that I needed to run that command as root user. Instead of typing the same command with sudo prefixed we can do the same thing using a shortcut.

To run the last command 'as is', you can just do

$ !!

If you want to run it as root, with sudo; just do

$ sudo !!

Hope you find it useful.

Manu S Ajith

Manu S Ajith

Tech Entrepreneur, dating Elixir, in long-term ❤️ w/ Ruby, had multiple one night stands w/ Go. Into functional paradigms DDD/CQRS/EventSourcing architecture these days. @manusajith on the interwebs

Read More