温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

thefuck的安装和使用方法

发布时间:2021-07-19 10:13:28 来源:亿速云 阅读:567 作者:chen 栏目:大数据

本篇内容介绍了“thefuck的安装和使用方法”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!

文章目录


    • 简介

    • 截图

    • 示例

    • 安装


简介

你是不是经常在终端敲错命令?敲错命令,删掉重敲,很烦有没有?当你一再敲错的时候,内心一定是崩溃的,一定在默念What The FUCK!。就这样thefuck神器就诞生了。thefuck不仅能修复字符输入顺序的错误,在很多别的你想说fuck的情况下,thefuck依然有效,反正只要你因为命令的问题报错,就请fuck一下。

thefuck是一个使用Python编写的开源小工具,它可以自动纠正前一个命令的拼写错误。这个工具非常酷,尤其对于常常使用命令行的童鞋。

thefuck支持Mac OS X和Linux系统。

截图

thefuck的安装和使用方法

示例

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的安装和使用方法”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注亿速云网站,小编将为大家输出更多高质量的实用文章!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI