Which Shells Are Supported by thefuck? A Complete Guide to Shell Compatibility

Thefuck supports Bash, Zsh, Fish, Tcsh (including Csh), and PowerShell, with a generic fallback for unrecognized shells.

The open-source command correction tool thefuck (maintained in the nvbn/thefuck repository) automatically detects your current interactive shell and loads a specialized implementation to handle alias expansion, history manipulation, and syntax generation. Understanding which shells are officially supported helps you configure the tool correctly for your environment.

Supported Shells in thefuck

The detection logic resides in [thefuck/shells/__init__.py](https://github.com/nvbn/thefuck/blob/master/thefuck/shells/__init__.py), which maps shell identifiers to concrete classes. Each class implements methods for alias parsing, history file access, and version detection.

Bash

Bash is fully supported through the Bash class in [thefuck/shells/bash.py](https://github.com/nvbn/thefuck/blob/master/thefuck/shells/bash.py). This implementation handles standard Bash alias expansion, reads from ~/.bash_history, and generates the appropriate eval alias syntax for your .bashrc file.

Zsh

Zsh support is provided by the Zsh class in [thefuck/shells/zsh.py](https://github.com/nvbn/thefuck/blob/master/thefuck/shells/zsh.py). The implementation accounts for Zsh's extended history format and complex alias definitions, ensuring that corrected commands are properly inserted into ~/.zsh_history with correct timestamps.

Fish Shell

Fish (Friendly Interactive Shell) is supported via the Fish class in [thefuck/shells/fish.py](https://github.com/nvbn/thefuck/blob/master/thefuck/shells/fish.py). This implementation uses Fish-specific function definitions rather than traditional aliases and handles Fish's unique history file format located at ~/.local/share/fish/fish_history.

Tcsh and Csh

Tcsh (and its compatible predecessor Csh) are supported through the Tcsh class in [thefuck/shells/tcsh.py](https://github.com/nvbn/thefuck/blob/master/thefuck/shells/tcsh.py). The implementation handles the distinct C-shell syntax for aliases and history management, recognizing both tcsh and csh as valid shell identifiers.

PowerShell

PowerShell (including powershell and pwsh on Windows) is supported via the Powershell class in [thefuck/shells/powershell.py](https://github.com/nvbn/thefuck/blob/master/thefuck/shells/powershell.py). This implementation interfaces with Windows command history and generates PowerShell-specific alias syntax for your $profile configuration.

Generic Fallback

For any unrecognized shell, thefuck falls back to the Generic class in [thefuck/shells/generic.py](https://github.com/nvbn/thefuck/blob/master/thefuck/shells/generic.py). This provides minimal functionality—basic command correction without alias expansion or history integration—ensuring the tool remains usable even in exotic shell environments.

How thefuck Detects Your Shell

The shell detection mechanism in [thefuck/shells/__init__.py](https://github.com/nvbn/thefuck/blob/master/thefuck/shells/__init__.py) builds a mapping of shell names to classes and inspects the parent process or environment variables to determine the current shell. When you invoke thefuck, it automatically instantiates the appropriate shell class to handle:

  • Alias expansion — Resolving user-defined shortcuts before correction
  • History manipulation — Reading the failed command and writing the corrected version
  • Syntax generation — Formatting the fix command according to shell-specific rules

Setting Up thefuck Aliases for Your Shell

To use thefuck, you must add a shell-specific alias to your configuration file. The tool can generate the correct syntax automatically.

Bash and Zsh Configuration

For Bash or Zsh, append the alias to your respective rc file:


# Bash

thefuck --alias >> ~/.bashrc

# Zsh

thefuck --alias >> ~/.zshrc

The generated alias uses eval to capture the corrected command and add it to history.

Fish Configuration

For Fish, pipe the output directly to source or save it to your functions directory:

thefuck --alias | source

Alternatively, save it permanently:

thefuck --alias > ~/.config/fish/functions/fuck.fish

PowerShell Configuration

For PowerShell, append the alias to your profile:

thefuck --alias | Out-File -Append $profile

This creates a function in your PowerShell profile that invokes the correction logic.

Enabling Instant Mode

Instant mode allows thefuck to execute the corrected command immediately without requiring an additional Enter press. Enable it by setting the environment variable before generating the alias:

export THEFUCK_INSTANT_MODE=true
thefuck --alias >> ~/.bashrc

Summary

  • thefuck officially supports Bash, Zsh, Fish, Tcsh/Csh, and PowerShell through dedicated implementations in thefuck/shells/.
  • Shell detection occurs automatically in thefuck/shells/__init__.py, which maps process names to concrete classes like Bash, Zsh, and Fish.
  • Each shell class handles alias expansion, history file manipulation, and syntax generation specific to that shell's requirements.
  • An unrecognized shell triggers the Generic fallback in thefuck/shells/generic.py, providing basic correction without history integration.
  • Setup requires generating a shell-specific alias using thefuck --alias and appending it to the appropriate configuration file (.bashrc, .zshrc, Fish functions, or PowerShell $profile).

Frequently Asked Questions

How does thefuck determine which shell I am using?

Thefuck inspects the parent process and environment variables to identify your current shell. The detection logic in thefuck/shells/__init__.py maintains a registry mapping shell names (like bash, zsh, or fish) to their respective implementation classes. When you run the tool, it automatically instantiates the correct class for your environment.

Can I use thefuck with a shell that is not officially supported?

Yes. If thefuck encounters a shell it does not recognize (anything other than Bash, Zsh, Fish, Tcsh, or PowerShell), it falls back to the Generic class defined in thefuck/shells/generic.py. This fallback provides basic command correction functionality but cannot expand aliases or write corrections back to your shell's history file.

What is the difference between thefuck's normal mode and instant mode?

In normal mode, thefuck displays the corrected command and requires you to press Enter to execute it. In instant mode, enabled by setting THEFUCK_INSTANT_MODE=true before generating your alias, the corrected command executes immediately without additional confirmation. Instant mode requires shell-specific handling in the alias generation logic found in each shell's implementation file (e.g., thefuck/shells/bash.py).

How do I permanently add the thefuck alias to PowerShell?

To permanently configure thefuck for PowerShell, generate the alias and append it to your PowerShell profile file. Run thefuck --alias | Out-File -Append $profile in a PowerShell session. This command adds the necessary function definition to your $profile script, which loads automatically whenever you start a new PowerShell session. The implementation details for PowerShell-specific syntax are handled in thefuck/shells/powershell.py.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →