explaingit

nvbn/thefuck

Analysis updated 2026-06-20

96,802PythonAudience · developerComplexity · 2/5LicenseSetup · easy

TLDR

The Fuck is a command-line tool that automatically corrects the last mistyped shell command, just type 'fuck' after an error and it suggests the fixed version and runs it for you.

Mindmap

mindmap
  root((thefuck))
    What it does
      Fix shell errors
      Auto-correct commands
      Rule matching
    Tech stack
      Python
    Use cases
      Fix typos
      Add sudo
      Correct git commands
    Setup
      pip install
      Shell alias
      Package managers
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Fix a mistyped terminal command instantly without retyping it, just type 'fuck' to see and run the corrected version.

USE CASE 2

Automatically add 'sudo' when a command fails due to missing permissions, without knowing you needed it upfront.

USE CASE 3

Correct misspelled git, docker, brew, or apt subcommands with a single word instead of hunting for the right spelling.

What is it built with?

Python

How does it compare?

nvbn/thefuckfastapi/fastapiopenai/whisper
Stars96,80297,94699,006
LanguagePythonPythonPython
Setup difficultyeasyeasymoderate
Complexity2/52/53/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

Requires adding one alias line to your shell startup file (.bashrc or .zshrc) so the 'fuck' command works in new sessions.

MIT licence, free to use and modify for any purpose, including commercially.

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 on macOS with Homebrew and set it up so 'fuck' works in my zsh terminal?
Prompt 2
I want to add a custom thefuck rule for a CLI tool I use at work. Show me how to write a rule that matches a specific error message and suggests the fix.
Prompt 3
thefuck isn't catching my git mistakes. How do I debug which rules are being checked and why none of them matched my last command?
Prompt 4
How do I configure thefuck to skip the confirmation prompt and just run the corrected command automatically?

Frequently asked questions

What is thefuck?

The Fuck is a command-line tool that automatically corrects the last mistyped shell command, just type 'fuck' after an error and it suggests the fixed version and runs it for you.

What language is thefuck written in?

Mainly Python. The stack also includes Python.

What license does thefuck use?

MIT licence, free to use and modify for any purpose, including commercially.

How hard is thefuck to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is thefuck for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Scan in gitsafehub Deploy in gitdeployhub nvbn on gitmyhub

Verify against the repo before relying on details.