Here's another pro tip. Say you wanted to run a command in sudo context but forgot that. Usually you'd hit the up arrow, press ctrl+a, or HOME button, type sudo and hit ENTER.

There is a geekier way to do that. Just type:

$ sudo !!

Bash will expand the two exclamation points to the previous command and it will be run through sudo.

Comments

Jeff Erickson Permalink
May 10, 2014, 16:07

It also leaves sudo + the actual command in your history, so that if you want to rerun it by finding it in history, you don't have to worry about it running another command.

jai singh Permalink
November 21, 2014, 05:43
jai singh Permalink
November 21, 2014, 05:46
Simon Permalink
May 11, 2014, 11:06

The variant of that command I usually use is to find and edit a file...

> find . -name whatever.txt

> vim `!!`

May 14, 2014, 16:48

Great little tip Peteris. I love sudo. Some tricks I do are to make s an alias of sudo, but only if the user isn't root.

[[ ${EUID:-} -ne 0 ]] && alias s='sudo ' || alias s=' '

Also are you aware of your spam problem in the comments?

May 15, 2014, 11:16

This is a great trick. Thanks for sharing. I'm aware of the spam problem. These spammers have taken over my blog. I don't now how to fight them. Any ideas?

Ingus T Permalink
May 29, 2014, 04:16

One letter can not be considered a defense mechanism. Implement some kind of CAPTCHA.

Alex Vorobyev Permalink
June 10, 2014, 04:40

To fight with spam use databases from http://www.stopforumspam.com

Louis Permalink
June 01, 2014, 18:54

Nice Article
Forex Bonus
Sudo Tip was a nice one thanks ..

June 07, 2014, 07:08

nice post..

June 26, 2014, 20:51

Great tips. I think content consideration is important today. If we like to give something different then sometimes we want to provide different kind of content. Having known that the themes support this purpose will ease our blogging experience

dharmesh Permalink
July 10, 2014, 18:37

wo check this new galaxy Note 4 Concept
i like this

August 11, 2014, 14:48

Nice post and really love to work as per your guidelines. You can access the article on sarkari naukri easily by visiting the portal

November 19, 2014, 09:56

same idea and thinkking with you sir :)

December 15, 2014, 03:28

I am really enjoying reading your well written articles. It looks like you spend a lot of effort and time on your blog.It will surely help in making a very good organisation

August 11, 2014, 14:51

It is time for party and cannot be fulfill without shopping so should consider best online shopping sites in india before buying any material online.

September 19, 2014, 07:36

Hottubsuppliers UK Dealership of Luxury Zspas & Zen Spas Hot Tub With USA Balboa Systems. Order From Range Or Design Your Own Hot Tub.

September 23, 2014, 18:53
October 02, 2014, 09:47

Whatsapp for PC

dd Mobikwik to your address book to ensure inbox delivery. If you find our email in your spam folder please press the 'not spam' button. If you are unable to view

looks greats this site, i wait the next articel :)

November 19, 2014, 09:49

thanks to shared this information, very awesome :)

November 29, 2014, 09:19

I am Very happy to land of this page. Good post.
RRC Group D results 2014.

Kaur deep Permalink
December 04, 2014, 03:06

Excellent and knowledgeable links and post.thanks for sharing.
Now, The Time has come for the Happy New Year 2015. It wil bring a lot fo happinesin our life.
Happy New Year 2015
And I am sure, You wil anjoy this new year day with yoru fiends and wil send some images wishes,
New Year 2015

Happy New Year 2015 Wishes
Greetings to yoru close ones, Your friends, You lover, etc..
Happy New Year 2015 Images
Even I am waititng for that day, because it just changes our life.
Happy New Year 2015 Greetings

Happy New Year 2015 SMS
So, That's why I am commenting here to wish you a very happy new year.
Happy New Year 2015 Messages
I hope this New year 2015 wil bring success to your website. But before that Merry Christmas is coming.
Merry Christmas Quotes
It is also a big event for everyone.
Merry Christmas Pictures
Everyone knows that Christmas is a day when People seems to be very happy, they just leave all sadness behind.
Merry Christmas Wallpapers
And I am sure, you also enjoy this Merry Christmas day of 2014.
Christmas day Images

Christmas stocking
But if you are not looking out to enjoy this christmas, then you are missing out on a big thing, because it really brings happiness.
Merry Christmas Images

Merry Christmas 2014
So, what you are waiting for?
Merry Christmas 2015
Enjoy This Merry Christmas day. Cheers :).

Diana Permalink
December 17, 2014, 15:46

This article is quite helpful and informative too. I enjoyed a lot. Thanks for sharing such a great article.

Beautiful Christmas Quotes for your friends and family...
christmas quotes
Christmas Messages for Whatsapp

Best Christmas Greetings for your friends and family...
christmas greeting
christmas wishes

What to Write in Christmas Card....... Check out best Christmas Greeting Card Words
What to Write in Christmas Card

GetBeautiful and Unique Christmas Wallpapers for free
free christmas wallpaper
christmas tree decorating ideas

Thanks for sharing such a great article.

Leave a new comment

(why do I need your e-mail?)

(Your twitter name, if you have one. (I'm @pkrumins, btw.))

Type the word "security_420": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.

Advertisements