r/bashtricks • • May 17 '11

Execute previous command as root

If you type out a long command and forget to sudo it, it's a pain to type it out again. Instead:

sudo !!
13 Upvotes

4 comments sorted by

View all comments

Show parent comment

2

u/QuantumCow May 17 '11

Also

history 5

will show you the past 5 commands in your history which avoids being overwhelmed with text. Obviously that works with any number, not just 5.