Usually, for some commands such as apt-get install xxx, I forget to add sudo first, then I need to retype it. What I want is in such cases, I just type a simple command, for example resudo. It will sudo my last command sudo apt-get install xxx. Is it possible in bash?
Asked
Active
Viewed 1,146 times
4
1 Answers
19
You could just use bash's !!: it is a shortcut to rerun the last command.
sudo !!
Anyway bash offers many shortcuts for anything, you could just press the up arrow (in order to get back the last typed line), then press ^A or Home and add sudo there.
peoro
- 1,171