sudo make me a sandwich


If this was BuzzFeed this post would be entitled something like:

You wouldn't believe how much time you'll save from this one neat trick!

I've worked with a lot of people who know bash and its derivatives very well, but I don't think this is too widely known.

$ make me a sandwich

Oh no! We forgot we needed elevated permissions for that command.

At this point, people hit:

up left left left left left left ... sudo enter

The marginally more enlightened might go for:

up ctrl+left sudo enter

Or perhaps,

up home sudo enter

However, the quickest way is to use !!:

$ sudo !!

!! repeats the last command, but you can prepend it with sudo to gain those elevated permissions. A small thing, but one that can save quite a bit of accrued time.