Forgot to Sudo? !! is your friend
Bash has a neat built in command for replaying the last command you typed:
> !!
Knowing this, you can do the following:
> make me a sandwich
What? Make it yourself.
> sudo !!
sudo make me a sandwich
Okay.
It also works wonders when you forget to bundle exec before you rake:
> rake db:migrate
barf due to wrong version of rake
> bundle exec !!
bundle exec rake db:migrate
success etc...
Written by David Underwood
Related protips
1 Response
Zsh has the same command.
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Rails
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#