CentOS安装autojump - Go语言中文社区

CentOS安装autojump


前言

系统
CentOS6.5,CentOS6.9,CentOS7.4 (64位操作系统)

Shell
bash,强烈推荐zsh,玛尼?没听说过?池建强大神的博客推荐一下:
终极 Shell
有人说顶级程序员可以顶得上100个初级程序员,好多人不信,这!里!让!你!相!信!一!下!

autojump是什么
autojump是一个Linux命令行工具,它允许你通过模糊匹配就可以一步跳转到想要的目录,不管你在哪里(目录)!是不是很神奇?是不是比cd``````tab这些命令好用百倍?OK,下面介绍一下autojump的安装、配置及使用

通过yum安装基本安装不上,应该是yum源里没有,去网上看了下也没有找到autojumpyum源,这里通过git安装

第一步:下载autojump

git clone git://github.com/joelthelion/autojump.git

第二步:安装

先跳转到autojump的根目录下

cd autojump/

安装:

./install.py

或者

python install.py

还是把安装日志附上吧

[root@data3 autojump]# ./install.py
Installing autojump to /root/.autojump ...
creating directory: /root/.autojump/bin
creating directory: /root/.autojump/share/man/man1
creating directory: /root/.autojump/etc/profile.d
creating directory: /root/.autojump/share/autojump
copying file: ./bin/autojump -> /root/.autojump/bin
copying file: ./bin/autojump_argparse.py -> /root/.autojump/bin
copying file: ./bin/autojump_data.py -> /root/.autojump/bin
copying file: ./bin/autojump_match.py -> /root/.autojump/bin
copying file: ./bin/autojump_utils.py -> /root/.autojump/bin
copying file: ./bin/icon.png -> /root/.autojump/share/autojump
copying file: ./docs/autojump.1 -> /root/.autojump/share/man/man1
creating directory: /root/.autojump/etc/profile.d
creating directory: /root/.autojump/share/autojump
creating directory: /root/.autojump/functions
copying file: ./bin/autojump.sh -> /root/.autojump/etc/profile.d
copying file: ./bin/autojump.bash -> /root/.autojump/share/autojump
copying file: ./bin/autojump.fish -> /root/.autojump/share/autojump
copying file: ./bin/autojump.zsh -> /root/.autojump/share/autojump
copying file: ./bin/_j -> /root/.autojump/functions

Please manually add the following line(s) to ~/.bashrc:

        [[ -s /root/.autojump/etc/profile.d/autojump.sh ]] && source /root/.autojump/etc/profile.d/autojump.sh

Please restart terminal(s) before running autojump.

CentOS安装autojump日志

第三步:配置

根据安装日志的提示,在.bashrc文件里添加下面的配置

[[ -s /root/.autojump/etc/profile.d/autojump.sh ]] && source /root/.autojump/etc/profile.d/autojump.sh

Centos配置autojump

第四步:使配置生效

source一下就行了

source .bashrc

工作原理:

autojump会在你每次启动命令时记录你当前的位置,并把它添加到自身的数据库。
这样哪个目录使用的次数越多,表示这个目录越重要,权重越大,进行模糊跳转的时候输入得越简单。
使用方式

基本使用

autojump pattern

**autojump 也可以缩写为j **
pattern就是要跳转的目录的模糊匹配

不太明白?好,来个Demo
比如说你经常使用的一个目录为:/home/java/apache-tomcat-8.5.16-case/webapps/case/WEB-INF/classes/config
使用命令

j co

CentOS使用autojump
就可以直接跳转到该目录下
j是autojump的简写
co是config目录的简写
当然如果这个目录你使用得特别特别多的话使用j c也是可以的
如果使用得没有那么多的话j co可能匹配到其他的目录上,这个时候你可能就需要输入j config

另外你刚刚安装好的时候是不能直接使用的,autojump不知道你经常使用哪个目录,怎么给你跳转?用一会儿就行了

你还可以查看一下当前多个目录的权重

j --stat

auto查看权重

版权声明:本文来源CSDN,感谢博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
原文链接:https://blog.csdn.net/daerzei/article/details/80250582
站方申明:本站部分内容来自社区用户分享,若涉及侵权,请联系站方删除。

0 条评论

请先 登录 后评论

官方社群

GO教程

猜你喜欢