74k stars的项目错了就fuck一下提高工作效率

微信公众号:[开源日记],分享10k+Start的优质开源项目

每个Linux运维开发肯定敲错过命令。有时候做一些紧急的任务,敲错了,得到了错误的结果或异常,是不是想说fuck。看完本教程你就可以在敲错命令后输入fuck,保证你心情舒畅得到正确的结果。

74k stars的项目错了就fuck一下提高工作效率
官方示例

GitHub数据

  • 74k stars
  • 844 watching
  • 3.3k forks

开源地址:https://github.com/nvbn/thefuck

安装

macOS安装

brew install thefuck

Ubuntu安装

sudo apt update
sudo apt install Python3-dev python3-pip python3-setuptools python-pip
pip3 install thefuck --user

FreeBSD安装

pkg install thefuck

通用python环境下

pip install thefuck

最后关键一步

.bash_profile.bashrc文件中配置以下命令

> vim .bashrc
eval $(thefuck --alias)
eval $(thefuck --alias FUCK)
74k stars的项目错了就fuck一下提高工作效率
image-20221012203655164

体验一把

我想进入python命令行,结果敲了pytho就回车了。没关系输入fuck。

root@开源日记:~# pytho

Command 'pytho' not found, did you mean:

  command 'python' from deb python3
  command 'python' from deb python
  command 'python' from deb python-minimal

Try: apt install <deb name>

root@开源日记:~# fuck
python [enter/↑/↓/ctrl+c]
Python 2.7.17 (default, Jul  1 2022, 15:56:32) 
[GCC 7.5.0] on linux2
Type "help""copyright""credits" or "license" for more information.
>>> 
74k stars的项目错了就fuck一下提高工作效率

首次git push提交,一般都需要和远程分支关联,但是很多时候只会敲上git push没关系输入fuck

root@开源日记:~# git push
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin master


root@开源日记:~# fuck
git push --set-upstream origin master [enter/↑/↓/ctrl+c]
Counting objects: 100, done.

查看当前目录下的文件会用ls,但是敲快了成了sl,没关系输入fuck

root@开源日记:~# sl

Command 'sl' not found, but can be installed with:

apt install sl

root@开源日记:~# fuck
ls [enter/↑/↓/ctrl+c]
123.txt 开源日记.txt

经常启动MySQL搞错,关系输入fuck

root@开源日记:~# systemstl start mysql

Command 'systemstl' not found, did you mean:

  command 'systemctl' from deb systemd

Try: apt install <deb name>

root@开源日记:~# fuck
systemctl start mysql [enter/↑/↓/ctrl+c]
74k stars的项目错了就fuck一下提高工作效率

thefuck的匹配原理

The Fuck试图将前面的命令与规则相匹配。如果找到匹配项,则使用匹配的规则创建一个新命令并执行

  • az_cli– 修复拼写错误的命令,例如az providers
  • cargo– 运行cargo build而不是cargo;
  • cargo_no_command– 修复错误命令,例如cargo buid
  • cat_dir–当您尝试访问目录时替换cat为;ls``cat
  • cd_correction– 拼写检查和纠正失败的 cd 命令;
  • cd_cs– 更改cscd
  • cd_mkdir– 在 cd 进入目录之前创建目录;
  • cd_parent– 更改cd..cd ..
  • chmod_x– 添加执行位;
  • choco_install– 为巧克力包装添加通用后缀;

更多功能广大网友可以继续挖掘。

微信公众号:[开源日记],分享10k+Start的优质开源项目

       

原文始发于微信公众号(开源日记):74k stars的项目错了就fuck一下提高工作效率

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/49313.html

(0)
小半的头像小半

相关推荐

发表回复

登录后才能评论
极客之音——专业性很强的中文编程技术网站,欢迎收藏到浏览器,订阅我们!