Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I saw the command

sudo !!

in a video.

What does this mean?

share|improve this question

migrated from Feb 19 '11 at 19:00

This question came from our site for professional and enthusiast programmers.

Run the previous command with sudo. – The Pixel Developer Feb 19 '11 at 18:55
Related. – Dennis Williamson Feb 19 '11 at 19:05
@jmort253: SU, etc., is intended to be the font of all knowledge. Google is simply the search engine that leads here. We don't do RTFM except as a supplement to a usable answer. – Dennis Williamson Feb 19 '11 at 19:06
Furthermore there is enough documentation on a linux distribution. Learn how to use commands like info and man. If you have them installed man COMMAND will give you information on what the command does like man sudo. If you don't have it installed install apt-file with sudo apt-get install apt-file then you can search with apt-file which packet contains the man command (if you are using debian or derivate of debian). – Darokthar Feb 19 '11 at 19:19
It means Sudo with a vengeance! If two machines are close by (2-3 inches), you can actually run commands on the other machine with this. It's that strong. – Pekka 웃 Feb 19 '11 at 21:46
up vote 45 down vote accepted

From the bash manual:

9.3.1 Event Designators

!! - Refer to the previous command. This is a synonym for ‘!-1’.

And from the sudo man page:

sudo allows a permitted user to execute a command as the superuser or another user, as specified in the sudoers file.

So, sudo !! means to execute the previous command as the superuser.

share|improve this answer
Congratulations for the only response that actually answers the question. – Daniel Beck Feb 19 '11 at 19:11
So to emphasize this: !! is a history-function of the shell, and not in any way bound to sudo. You may use it everywhere where it makes sense. – user unknown Feb 19 '11 at 22:19
Thanks for telling, get the "superuser" part? – Ja5087 Apr 6 '11 at 8:42

The double exclamation point "!!" is used to recall the last line entered into a shell. sudo is shorthand for "Super User DO" and is used when you want to execute a function with super user privileges.

So if I executed


but then remembered I needed super user privelages, one could simply type

sudo !!

rather than typingsudo ./foobar all the way out. This is particularly useful when your last command was on the order of dozens of characters.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.