简介
你是不是经常在终端敲错命令? 敲错命令, 删掉重敲, 很烦有没有? 当你一再敲错的时候, 内心一定是崩溃的, 一定在默念 What The FUCK!. 就这样 thefuck 神器就诞生了. thefuck 不仅能修复字符输入顺序的错误, 在很多别的你想说 fuck 的情况下, thefuck 依然有效, 反正只要你因为命令的问题报错, 就请 fuck 一下.
项目地址
https://github.com/nvbn/thefuck
功能展示
示例
1, 命令拼写不对
- # puthon
- No command'puthon'found, did you mean:
- Command'python'frompackage'python-minimal'(main)
- Command'python'frompackage'python3'(main)
- zsh: commandnotfound: puthon
- # fuck
- python
- Python3.4.2
2, 命令输错
- # Git brnch
- Git:'brnch'isnot a Git command. See'git --help'.
- Did you meanthis?
- branch
- # fuck
- Git branch
- * master
3, 权限不够
- # apt-get install VIM
- E: Could not openlockfile /var/lib/dpkg/lock- open (13: Permission denied)
- E:Unable to lock the administration directory (/var/lib/dpkg/), are you root?
- # fuck
- sudo apt-get install VIM
- [sudo] password for nvbn:
- Reading package lists... Done
安装
1, 安装 thefuck
运行以下命令:
- #CentOS 系统
- yum-y update && yum -y install gcc
- wget https://bootstrap.pypa.io/get-pip.py
- pythonget-pip.py && yum -y install python-devel
- sudo -H pip install thefuck
- #Ubuntu/Debian 系统
- sudo apt update
- sudo apt install python3-dev python3-pip
- sudo pip3 install thefuck
更多安装及使用方法查看官网
2, 配置
- # 编辑 bashrc 配置文件
- VIM ~/.bashrc
- # 在文件尾加入一行给 thefuck 取别名 fuck
- eval"$(thefuck --alias fuck)"
- # 使生效
- source~/.bashrc
最后使用 fuck 命令来纠正命令行拼写错误.
更新到最新的 thefuck 的方法非常简单: sudo pip3 install thefuck --upgrade
温馨提示, 请谨慎使用此命令, 执行的时候千万不要读出来. 用习惯了容易成为口头禅.
来源: http://www.jianshu.com/p/0d37b22aabba