💾 Archived View for jan.bio › bash › repeating-a-command-with-sudo.gmi captured on 2023-05-24 at 17:47:24. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2020-10-31)

-=-=-=-=-=-=-

Repeating a command with sudo

Sometimes I forget to run a command as sudo. Bash comes to help and can repeat the previous command:

$ pacman -Suy docker
Sorry, you need to be root to execute docker.
$ sudo !!
sudo pacman -Suy docker
[sudo] passord for jans:  
...
$ 

`!!` can also be used to repeat the previous command.