前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >介绍一头GitHub上的"草泥马"- thefuck,妈妈再也不用担心我打错命令行了

介绍一头GitHub上的"草泥马"- thefuck,妈妈再也不用担心我打错命令行了

作者头像
短短的路走走停停
发布2019-05-14 17:33:33
9510
发布2019-05-14 17:33:33
举报
文章被收录于专栏:程序猿声程序猿声

作为全球最大的同性社交网站,GitHub上面真的是无奇不有,最近小编在上面逛了逛,发现了一个有趣的项目:thefuck

作为程序员,经常工作于Linux下的我们来说,你是不是经常在终端敲错命令?敲错命令,删掉重敲,很烦有没有?当你一再敲错的时候,内心一定是崩溃的,一定在默念“What the fuck!”。

有位名为 @liamosaur 的哥们就忍不住发出了愤怒的吼声并且付诸实践,每天都要骂他的终端几百遍啊几百遍:

受此启发, 一位名为 Vladimir Iakovlev 程序员和他的 90 位愤怒的小伙伴们打造出了一个名为 “thefuck” 的神器! 如下:

thefuck 不仅能修复字符输入顺序的错误,任何情况下你想说“我*”的时候,你都可以用得到 thefuck:

当你的终端没有按你想象的输入命令时,请 fuck 它!

当你的终端没有按你想象的以 sudo 执行命令时,请 fuck 它!

当你的的终端不知道填上显而易见的参数时,请 fuck 它!

示例

1、命令拼写不对

1# puthon
2No command 'puthon' found, did you mean:
3 Command 'python' from package 'python-minimal' (main)
4 Command 'python' from package 'python3' (main)
5zsh: command not found: puthon
6
7# fuck
8python
9Python 3.4.2
1➜ sl
2The program 'sl' is currently not installed. You can install it by typing:
3sudo apt-get install sl
4➜ fuck
5ls #修正
6a.go                   b.php           dockerui      jekyll-casper  main.go  PureBlog   sss.png                              typecho
7a.php                  c-hash          Font-Awesome  jekyll-pure    mili     signal.c   TeamTalk                             upload
8bii-ubuntu-64_3_0.deb  Dockerfile      harmony       JekyllPure     ngircd   signal.c~  tingyun-agent-php-latest.x86_64.deb  web.go
9blog                   Dockerfile.bak  hashmap       kasper         php-src  sss.jpg    tipi                                 zerver

2、命令输错

1# git brnch
2git: 'brnch' is not a git command. See 'git --help'.
3
4Did you mean this?
5    branch
6
7# fuck
8git branch
9* master

3、权限不够

1# apt-get install vim
2E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
3E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
4# fuck
5sudo apt-get install vim
6[sudo] password for nvbn:
7Reading package lists... Done

4、忘记 sudo

1➜ apt-get install vim
2E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
3E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
4
5➜ fuck
6sudo apt-get install vim
7[sudo] password for nvbn:
8Reading package lists... Done

5、操作 git

1➜ puthon
2No command 'puthon' found, did you mean:
3 Command 'python' from package 'python-minimal' (main)
4 Command 'python' from package 'python3' (main)
5zsh: command not found: puthon
6
7➜ fuck
8python
9Python 3.4.2 (default, Oct  8 2014, 13:08:17)

6、选项修正

1➜ git brnch
2git: 'brnch' is not a git command. See 'git --help'.
3
4Did you mean this?
5    branch
6
7➜ fuck
8git branch
9* master

既然这么好用,那它到底是安装使用呢?别着急啊,这就来说说这款神器如何装13的。

1、安装thefuck

运行以下命令:

 1#CentOS系统
 2yum -y update && yum -y install gcc 
 3wget https://bootstrap.pypa.io/get-pip.py
 4python get-pip.py && yum -y install python-devel
 5sudo -H pip install thefuck
 6
 7#Ubuntu/Debian系统
 8sudo apt update
 9sudo apt install python3-dev python3-pip
10sudo pip3 install thefuck

2、配置

1#编辑bashrc配置文件
2vim ~/.bashrc
3#在文件尾加入一行给thefuck取别名fuck
4eval "$(thefuck --alias fuck)"
5#使生效
6source ~/.bashrc

3、更新到最新的 thefuck

1sudo pip3 install thefuck --upgrade
本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2018-12-19,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 程序猿声 微信公众号,前往查看

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

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

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 5、操作 git
  • 6、选项修正
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档