RedHat/Fedora/Centos 下bash 自動補全命令


本文轉自:運維生存時間:http://www.ttlsa.com/linux/rhel- ... matically-function/ 

              linuser  :http://www.linuser.com/thread-1085-1-1.html


Bash命令自動完成功能只不過是收集各種黑客指定參數是如何通過Readline使用內置完成來完成的。該功能在其他linux分支是啟用的,如ubuntu、debian等等。然而,基於RHCE分支發布的linux版本卻沒有安裝和啟用,如CentOS。

如果你使用過ubuntu系統,bash命令自動補齊會覺得非常方便高效。再使用RHCE或CentOS的話,你肯定會吐槽一番的,“這bash是什么鬼東西,不能自動補齊。”

那么RHEL / CentOS 怎么啟用bash命令自動補齊功能呢?請看下面

1、首先需要安裝bash-completion 包:

[root@server src]# yum install -y bash-completion

2、安裝完成后,需要用source 命令或者是注銷當前登陸用戶重新登陸系統使其立即生效,如下:

[root@server src]# source /etc/bash_completion


3、此時你就可以使用bash 的自動補全了,如下:

[root@server src]# yum [Tab 鍵]
--assumeyes        --config           distro-sync        groupinfo          history            -
--cacheonly        --debuglevel       downgrade          groupinstall       info               -
check              deplist            --enableplugin     grouplist          install            -
check-update       --disableexcludes  --enablerepo       groupremove        --installroot      p
clean              --disableplugin    --errorlevel       help               list               -
--color            --disablerepo      --exclude          --help             makecache          -
[root@server src]# yum in[Tab 鍵]
info     install  

4、實例,加入我現在不知道apache 在centos 上面的包名,而我需要使用apache 服務,則可以這樣:

[root@server src]# yum install -y htt[Tab 鍵]
httpd-devel.i686          httpd-manual.noarch       httping.x86_64            http-parser.i686  
httpd-devel.x86_64        httpd-tools.x86_64        http-parser-devel.i686    http-parser.x86_64
httpd-itk.x86_64          httpd.x86_64              http-parser-devel.x86_64  httpry.x86_64  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM