Skip to content

The Fuck

Corrects your previous console command after you mistype it.

Stars
97.9k
Forks
4k
Licence
MIT
Language
Python
Last update
2.3 years ago
Type
CLI

No commits in over a year — check for forks or alternatives before adopting.

What it is

The Fuck is a command-line tool that looks at the last command you ran, finds a likely fix for an error, and offers the corrected command for you to run. It works through a set of rules, such as fixing misspelled git subcommands or adding a missing sudo. You can confirm each suggestion before it runs, or turn confirmation off.

  • Fix a misspelled git command like `git brnch` to `git branch`
  • Add a missing sudo when apt-get fails with a permission error
  • Correct a misspelled command name such as `puthon` to `python`
  • Create a missing directory before a cd when the folder does not exist

Great for

  • Developers who often mistype git, docker, or other common commands
  • People who use a terminal regularly and want quicker recovery from typos
  • Users on macOS, Linux, or FreeBSD who can install it with a package manager or pip

Not ideal for

  • People who would rather not run suggested commands at all, since the README warns against blindly running corrected commands
  • Users on Windows, where the README does not describe a supported install path beyond pip and the listed systems
  • People who need the tool to be instant on every keystroke, since the README mentions an experimental instant mode because the default can be slow
Step-by-step guide: how to use The FuckInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Install with a package manager

    You'll need: Python 3.5+ · pip

    Install with Homebrew (macOS or Linux)

    brew install thefuck

    Install with pip on other systems

    pip install thefuck
  2. 2

    Run it

    • Install the package with pip or your package manager.
    • Add `eval $(thefuck --alias)` to your .bashrc, .zshrc, or other shell startup file.
    • Open a new shell session or run `source ~/.bashrc` (or your shell config file).
    • After a mistyped command, type `fuck` and confirm the suggested fix.
  3. 3

    Get the most out of it

    • Use `fuck --yeah` (or `-y`) to run fixed commands without confirmation, only if you are comfortable with that risk
    • Use `fuck -r` to fix commands recursively until one succeeds
    • Set a different alias such as `eval $(thefuck --alias FUCK)` if you prefer another name
    • Check the README's settings section to change options such as require_confirmation

Downloads

Strengths

  • Simple to use: run `fuck` after an error and confirm the suggestion
  • Covers many common tools through a built-in list of rules
  • Open source under the MIT license with a large user base

Trade-offs

  • Runs commands it suggests, so you need to review each one unless you disable confirmation
  • Can be slow by default, which the README addresses with an experimental mode
  • Needs Python and a shell alias set up in your shell config

How it compares

ProjectStarsTypeLevelUpdatedBest for
thefuck (this)97.9kCLIbeginner2.3 years agoDevelopers who often mistype git, docker, or other common commands
ohmyzsh190kDev toolbeginner4 days agoPeople who already use zsh and want a ready-made configuration without writing it from scratch
PowerShell56kCLIbeginner4 days agoDevelopers who script or automate tasks across Windows, Linux, and macOS
zsh-autosuggestions36.2kAppbeginner1.4 years agoPeople who use zsh as their daily terminal shell
atuin32.2kDev toolbeginner4 days agoDevelopers who work in a terminal and often need to find past commands
autocomplete25.2kOtherintermediate1.5 years agomacOS developers who use zsh, bash or fish and want suggestions for common CLIs

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.