前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >[943]thefuck的安装和使用

[943]thefuck的安装和使用

作者头像
周小董
发布2021-03-03 10:55:09
8480
发布2021-03-03 10:55:09
举报
文章被收录于专栏:python前行者python前行者

文章目录

简介

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

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

thefuck支持Mac OS X和Linux系统。

截图

examples
examples

示例

1、命令拼写不对

代码语言:javascript
复制
# 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、命令输错

代码语言:javascript
复制
# git brnch
git: 'brnch' is not a git command. See 'git --help'.
 
Did you mean this?
    branch
 
# fuck
git branch
* master

3、权限不够

代码语言:javascript
复制
# 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 运行以下命令:

代码语言:javascript
复制
#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、配置

代码语言:javascript
复制
#编辑bashrc配置文件
vim ~/.bashrc
#在文件尾加入一行给thefuck取别名fuck
eval "$(thefuck --alias fuck)"
#使生效
source ~/.bashrc

最后使用fuck命令来纠正命令行拼写错误。

更新到最新的 thefuck 的方法非常简单: sudo pip3 install thefuck --upgrade

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2021-02-19 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 文章目录
  • 简介
  • 截图
  • 示例
  • 安装
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档