fuck
Corrects previous command-line mistakes
TLDR
Set the fuck alias to thefuck tool
Try to match a rule for the previous command
Confirm the first choice immediately (correct argument depends on level of annoyance)
SYNOPSIS
fuck [options] [query]
PARAMETERS
-h, --help
Show this help message and exit.
-v, --version
Show program's version number and exit.
-D, --debug
Launch debug info with script trace.
-n, --no-numbers
Don't number suggestion list.
-y, --yes
Automatically confirm first suggestion.
-r N, --repeat N
Repeat last command N times after correction.
-V, --verbose
Enable verbose logging.
DESCRIPTION
The fuck command is part of the thefuck Python package, a delightful tool that automatically corrects previous console commands you've mistyped. When you run a command that fails, simply type fuck and it suggests and optionally executes the corrected version.
Under the hood, thefuck uses a collection of rules to match common errors, such as forgotten sudo, wrong flags, or misspelled commands like 'sl' instead of 'ls'. It scans your shell history, applies relevant rules, and presents numbered suggestions. You select one by number or confirm the top suggestion.
Installation requires Python and pip: pip install thefuck. Then, add an alias to your shell profile, e.g., echo 'alias fuck="thefuck"' >> ~/.bashrc and source it. It supports Bash, Zsh, Fish, and others via shell scripts.
Popular for its humor and utility, it has thousands of rules contributed by the community. While not a native Linux command, it's widely used by developers to save time on typos. Debug mode helps create new rules.
CAVEATS
Requires Python 3.6+ and thefuck package installation via pip. Needs shell alias setup (e.g., alias fuck='thefuck'). Not available by default on Linux; humorous name may be blocked by some shells or corporate filters. Relies on rules database which may miss rare errors.
INSTALLATION
pip3 install thefuck
Add to ~/.bashrc: eval $(thefuck --alias) or alias fuck='thefuck'. Run source ~/.bashrc.
EXAMPLE USAGE
$ git bracn
git: 'bracn' is not a git command.
$ fuck
git branch [y/n]? y
git branch
HISTORY
Created by Vladimir Iakovlev (nvbn) in 2014 as 'thefuck' on GitHub. First stable release in 2015, gained popularity with 70k+ stars. Community-driven rules added continuously; supports 100+ shells and commands.


