Thefuck command automatically corrects the spelling of the previous command on the command line

Introduction to the

Thefuck is an open source gadget written in Python that automatically corrects the spelling of the previous command. This tool is pretty cool, especially for kids who use the command line a lot. Thefuck supports Mac OS X and Linux systems.

Necessary environment

  • macOS&linux
  • python3

The installation

pip install thefuck
Copy the code

configuration

To create an alias, start by editing the bashrc configuration file:

$ vim ~/.bashrc
Copy the code

Add a line at the end of the file:

eval "$(thefuck --alias fuck)"
Copy the code

Make effective:

$ source ~/.bashrc
Copy the code

use

$pythn -v bash: pythn: command not found $fuck Python -v [Enter /↑/↓/ CTRL + C] python 2.7.13Copy the code

Note: After fuck is run, the revised command will be returned, which will be executed by press enter. You can also use the up or down key to select a different matching command, CTRL + C to cancel the operation.