本篇内容介绍了“thefuck的安装和使用方法”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!
简介
截图
示例
安装
你是不是经常在终端敲错命令?敲错命令,删掉重敲,很烦有没有?当你一再敲错的时候,内心一定是崩溃的,一定在默念What The FUCK!
。就这样thefuck
神器就诞生了。thefuck
不仅能修复字符输入顺序的错误,在很多别的你想说fuck
的情况下,thefuck
依然有效,反正只要你因为命令的问题报错,就请fuck
一下。
thefuck是一个使用Python编写的开源小工具,它可以自动纠正前一个命令的拼写错误。这个工具非常酷,尤其对于常常使用命令行的童鞋。
thefuck支持Mac OS X和Linux系统。
1、命令拼写不对
# puthon
No command 'puthon' found, did you mean:
Command 'python' from package 'python-minimal' (main)
Command 'python' from package 'python3' (main)
zsh: command not found: puthon
# fuck
python
Python 3.4.2
2、命令输错
# git brnch
git: 'brnch' is not a git command. See 'git --help'.
Did you mean this?
branch
# fuck
git branch
* master
3、权限不够
# apt-get install vim
E: Could not open lock file /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
python get-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
更多安装及使用方法查看Github
项目地址:https://github.com/nvbn/thefuck。
2、配置
#编辑bashrc配置文件
vim ~/.bashrc
#在文件尾加入一行给thefuck取别名fuck
eval "$(thefuck --alias fuck)"
#使生效
source ~/.bashrc
最后使用fuck
命令来纠正命令行拼写错误。
更新到最新的 thefuck 的方法非常简单: sudo pip3 install thefuck --upgrade
“thefuck的安装和使用方法”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注亿速云网站,小编将为大家输出更多高质量的实用文章!
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。
原文链接:https://my.oschina.net/zhouxinfei/blog/4957059