If you run Ubuntu or another Linux distro where you have to prepend a command with sudo
and you're anything like me, you may from time to time forget to type sudo
. Next time you forget, try typing in sudo !!
and then press enter. This will prepend the previously ran command with sudo
and run it.
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (6)
nvbn / thefuck
Magnificent app which corrects your previous console command.
The Fuck
The Fuck is a magnificent app, inspired by a @liamosaur tweet that corrects errors in previous console commands.
Is The Fuck too slow? Try the experimental instant mode!
More examples:
➜ git push fatal: The current branch master has no upstream branch. To push the current branch and set the remote as upstream, use git push --set-upstream origin master ➜ fuck git push --set-upstream origin master [enter/↑/↓/ctrl+c] Counting objects: 9, done. ...
What an interesting app. I prefer alias commands to save ample time
It's definitely not for everyone but the post reminded me of this app when it first launched as a meme. The beauty of our community.
From unix.stackexchange.com/questions/8...
alias please='sudo $(fc -ln -1)'
For the people who want to be extra careful when running commands with
sudo
, you can enable history expansion with the space key. Put this in.bashrc
.Now typing
!!<space>
will replace the!!
with your last command.If you use zsh with oh-my-zsh this is enabled by default. If you're not using oh-my-zsh, you can enable it using.
Thank you for sharing, I'll give this a try.