Yes, you heard it right. This console utility is called the fuck, the sources of which can be found on GitHub.
This magical utility performs one very useful task — it fixes errors in the last executed command in the console.
Examples
➜ apt-get install vim
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 vim [enter/↑/↓/ctrl+c]
[sudo] password for nvbn:
Reading package lists… Done
…
or like this
➜ 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.
…
Requirements
- python (3.4+)
- pip
- python-dev
Installation
OS X
brew install thefuck
Ubuntu / Mint
sudo apt update
sudo apt install python3-dev python3-pip python3-setuptools
sudo pip3 install thefuck
FreeBSD
pkg install thefuck
ChromeOS
crew install thefuck
On other systems
Using pip
pip install thefuck
Useful options
To work without confirmation prompts
fuck —yeah
To execute recursively until achieving results
fuck -r
Source: linux.org.ru
