thefuck,非常好用的一个终端工具,使用 Python 语言编写。它可以自动纠正前一个命令的拼写错误。你只需要输入fuck,直接敲回车就自动解决输入错误的问题,非常方便。
thefuck 的灵感来自 @liamosaur tweet,旨在快速纠正终端命令中的错误。在 GitHub 上已获得 80.3k stars,功能非常酷。
命令敲错,fuck一下
忘记写 sudo:
写错单词:
忘记命令行参数:
🧰 安装
前提依赖
- python (3.5+)
- pip
- python-dev
在macOS或Linux上通过 Homebrew 安装:
brew install thefuck
在 Ubuntu / Mint 上使用以下命令安装:
sudo apt update
sudo apt install python3-dev python3-pip python3-setuptools
pip3 install thefuck --user
在 FreeBSD 使用以下命令安装:
pkg install thefuck
在ChromeOS上使用 chromebrew 安装命令:
crew install thefuck
基于Arch的系统上使用以下命令安装:
sudo pacman -S thefuck
其他系统,如 Windows 使用 pip 命令安装:
pip install thefuck
安装完之后,将此命令放在 .bash_profile 、 .bashrc 、 .zshrc 或其他启动脚本中,并指定命令别名为 fuck:
eval $(thefuck --alias fuck)
更改后运行如下命令生效(或 .zshrc ):
source ~/.bashrc
运行 thefuck 修复命令时不想每次都要确认一下,可使用 –yeah 选项(或 -y):
fuck --yeah
如果要递归修复命令直到成功,使用 -r 选项:
fuck -r
后续升级可使用如下命令:
pip3 install thefuck --upgrade
暂无评论内容