Skip to content

Shell aliases

Pablo Aguiar edited this page Jan 3, 2018 · 25 revisions


Add this alias to .bashrc or .bash_profile (for OSX):

eval "$(thefuck --alias)"


Add this alias to .zshrc:

eval "$(thefuck --alias)"

If you use oh-my-zsh, try this awesome thefuck plugin.


Add this function to

thefuck --alias | source 

To avoid the delay of the shell startup, you could also create an autoloaded function. Create a file ~/.config/fish/functions/ instead and paste the output of thefuck --alias into that file. Fish should start as fast as before.

For cases when you override a command and turn it into an alias (e.g. alias sed=gsed or alias git=hub), you should add all them to the THEFUCK_OVERRIDDEN_ALIASES environment variable, separated by comma. For example, in your



Put this in your Powershell $PROFILE on Windows:

iex "$(thefuck --alias)"

To overcome Python unicode warning on your unicode Powershell console:

c:\python3\lib\site-packages\win_unicode_console\ RuntimeWarning: sys.stdin.encoding == 'utf-8', whereas sys.stdout.encoding == 'ascii', readline hook consumer may assume they are the same

Add this line before the line above in your Powershell $PROFILE on Windows:



alias fuck 'set fucked_cmd=`history -h 2 | head -n 1` && eval `thefuck ${fucked_cmd}`'


Install the xonsh extension:

pip install xontrib-thefuck

And then load it (you can add this to xonshrc for it to be loaded in every xonsh session):

xontrib load thefuck


If the following error message is shown when trying to run thefuck:

command not found: thefuck

Ensure that ~/.local/bin is present in your path. eg. add PATH="$PATH:$HOME/.local/bin" to .bashrc, .zshrc etc.

Clone this wiki locally
You can’t perform that action at this time.