Thefuck is a magnificent app which corrects your previous console command.
Thefuck is a python tool, hosted on github, which looks at your previous command and tries to correct it. You of course invoke it after a typo for instance, by typing fuck in your terminal.
A few examples in image, from the developer himself:
A few more examples:
Adds sudo for you:
~> apt-get install thefuck E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied) E: Unable to lock the administration directory (/var/lib/dpkg/), are you root? ~> fuck sudo apt-get install thefuck [enter/↑/↓/ctrl+c] Reading package lists... Done
Corrects your git branch syntax (this is my main use of thefuck):
~/gits/lomignet-apt> git push fatal: The current branch newfeature has no upstream branch. To push the current branch and set the remote as upstream, use git push --set-upstream origin newfeature ~/gits/lomignet-apt> fuck git push --set-upstream origin newfeature [enter/↑/↓/ctrl+c] Total 0 (delta 0), reused 0 (delta 0) To email@example.com:lomignet/lomignet-apt.git * [new branch] newfeature -> newfeature Branch newfeature set up to track remote branch newfeature from origin.
The installation is trivial as the package is uploaded to the python package index:
pip install thefuck
To then have the command available, add to your .bashrc or whichever your startup script is:
eval $(thefuck --alias)