← All open source projects

The Fuck

nvbn/thefuck

The Fuck is a Python command-line utility that analyzes the previous command and suggests a corrected version through a rule system.

Forks 3,942
Author nvbn
Language Python
License MIT
Synced 2026-06-09

What it is

The Fuck became popular because of a very simple idea: you make a mistake in the terminal, type a short command, and the utility suggests a fix. Behind the rude name is a practical tool with rules for shells, git, package managers, and other programs.

The project was inspired by a Liam O’Connor tweet, and the main implementation is written in Python. The utility looks at the previous command and its output, matches a rule, shows the corrected command, and asks for confirmation. Confirmation matters because commands can be dangerous.

What is inside and how people use it

The repository contains rules, settings, support for different shells, installation documentation, and a way to write custom rules. That makes The Fuck interesting not only as a funny command, but as an extensible analyzer for console errors.

Fixing the previous command

This example shows the mechanics: first an error, then a short utility call and the proposed command.

Language: Bash
git push
# fatal: The current branch main has no upstream branch

fuck
# git push --set-upstream origin main

Typical scenarios include missing sudo, mistyping git branch, writing python incorrectly, or forgetting the upstream for git push. The utility saves seconds, but more importantly it removes irritation from repeated small mistakes.

Strengths and limitations

The strength is immediate usefulness and broad support for common errors. It works well in local development where mistakes are usually everyday friction rather than critical operations.

The limitation is that rules are not omniscient, and the corrected command still needs human review. For system commands, file deletion, and production work, confirmation should stay enabled.