CLI tool that corrects errors in previous console commands by suggesting fixes when you type 'fuck'
The Fuck is a command-line error correction tool that analyzes failed commands and suggests fixes. When you mistype a command, forget sudo privileges, or make other common CLI mistakes, typing 'fuck' after the error will present corrected alternatives. The tool includes over 100 built-in rules covering common scenarios like missing sudo permissions, git command errors, typos in package manager commands, and incorrect flags.
The tool works by matching the previous command against a database of error patterns and their corresponding fixes. For example, it can correct 'apt-get install vim' permission errors by suggesting 'sudo apt-get install vim', fix git push upstream issues, correct typos like 'puthon' to 'python', and handle dozens of other command-line mistakes. Users can configure whether corrections require confirmation or run automatically.
The Fuck supports multiple shells (Bash, Zsh, Fish, PowerShell, tcsh) and integrates through shell aliases. It includes an experimental instant mode for faster corrections and allows custom rules for specific workflows. The tool requires Python 3.5+ and can be extended with third-party rule packages for additional command coverage.
# via Homebrew
brew install thefuck
# via APT
sudo apt update && sudo apt install python3-dev python3-pip python3-setuptools && pip3 install thefuck --user
# via pip
pip install thefuck