explaingit

nvbn/thefuck

97,002PythonAudience · developerComplexity · 2/5StaleLicenseSetup · easy

TLDR

A command-line tool that fixes your previous typo or mistake by suggesting the corrected command when you type 'fuck'.

Mindmap

mindmap
  root((repo))
    What it does
      Fixes terminal typos
      Suggests corrections
      Runs corrected command
    How it works
      Named correction rules
      Matches error patterns
      Picks best fix
    Use cases
      Forgot sudo prefix
      Misspelled git commands
      Docker command errors
    Installation
      pip or Homebrew
      Shell alias setup
      Works in any shell
    Tech stack
      Python 3.5+
      Command-line interface

Things people build with this

USE CASE 1

Quickly fix a mistyped git or docker command without retyping it.

USE CASE 2

Automatically add sudo to a command that failed due to permission denial.

USE CASE 3

Correct common shell typos and command misspellings on the fly.

USE CASE 4

Speed up terminal workflows by skipping manual command correction and retyping.

Tech stack

PythonShell

Getting it running

Difficulty · easy Time to first run · 5min
Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

In plain English

The Fuck is a command-line helper that fixes the previous command you typed wrong. When you mistype something in your terminal, for example you forget to put sudo in front of a system command, you misspell a git or docker subcommand, or you try to push a branch that has no upstream, your shell prints an error and stops. Instead of retyping the corrected version, you type the word "fuck" and press enter; the tool guesses what you meant, shows you the corrected command, and runs it once you confirm. Inside, the project is a collection of named rules, each of which knows how to recognise one specific kind of mistake and how to rewrite the command to fix it. The README lists rules for cd, git, docker, brew, apt, cargo, ag, aws, conda, gem, lein, and many other tools, plus generic ones like adding sudo when permission is denied or fixing common typos. When you trigger the tool, it walks through the matching rules, picks the most likely correction, and offers it. People typically install it on their personal machine through a package manager such as pip, Homebrew, apt, pacman, or pkg, then add an alias line to their shell startup file so the word "fuck" works in any new terminal session. There is also an experimental instant mode, options to skip the confirmation step, and a way to retry until a command finally succeeds. The project is written in Python (version 3.5 or later is required) and is released under the MIT licence.

Copy-paste prompts

Prompt 1
How do I install thefuck and set it up as a shell alias so I can use it in my terminal?
Prompt 2
Show me the list of built-in correction rules in thefuck and give examples of what mistakes each one catches.
Prompt 3
How do I create a custom correction rule for thefuck to fix a specific command mistake I make often?
Prompt 4
Can I use thefuck in instant mode or skip the confirmation prompt, and how do I enable those options?
Prompt 5
What shell environments does thefuck support, and are there any known limitations or compatibility issues?
Open on GitHub → Explain another repo

Generated 2026-05-18 · Model: sonnet-4-6 · Verify against the repo before relying on details.