1. 程式人生 > 實用技巧 >針對Tab鍵不能使用解決辦法(Linux系統)

針對Tab鍵不能使用解決辦法(Linux系統)

Tab鍵在裝Linux作業系統時,有的可能沒有自動安裝能使用Tab鍵的安裝包,這時就會發現使用Tab鍵無法使用,但命令和本該有的目標也有。

這時就需要安裝bash-completion包.,廢話不多說,直接上!

【RHEL7.4】

1、檢視是否安裝了bash-completion包

[root@dnsserver2 ~]# rpm -qa | grep bash-*
bash-4.2.46-28.el7.x86_64

2、在本地yum倉庫檢視是否有bash-completion包

[root@dnsserver2 ~]# yum info bash-*
已載入外掛:product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
已安裝的軟體包
名稱    :bash
架構    :x86_64
版本    :4.2.46
釋出    :28.el7
大小    :3.5 M
源    :installed
來自源:anaconda
簡介    : The GNU Bourne Again shell
網址    :http://www.gnu.org/software/bash
協議    : GPLv3+
描述    : The GNU Bourne Again shell (Bash) is a shell or command language
         : interpreter that is compatible with the Bourne shell (sh). Bash
         : incorporates useful features from the Korn shell (ksh) and the C shell
         : (csh). Most sh scripts can be run by bash without modification.

可安裝的軟體包
名稱    :bash-completion
架構    :noarch
時期       :1
版本    :2.1
釋出    :6.el7
大小    :85 k
源    :dvd
簡介    : Programmable completion for Bash
網址    :http://bash-completion.alioth.debian.org/
協議    : GPLv2+
描述    : bash-completion is a collection of shell functions that take advantage
         : of the programmable completion feature of bash.

或者
[root@dnsserver2 ~]# yum list bash-*
已載入外掛:product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
已安裝的軟體包
bash.x86_64                                                                                 4.2.46-28.el7                                                                      @anaconda/7.4
可安裝的軟體包
bash-completion.noarch                                                                      1:2.1-6.el7                                                                        dvd          

3、安裝bash-completion包

[root@dnsserver2 ~]# yum install -y bash-completion
[root@dnsserver2 ~]# rpm -qa bash-completion
bash-completion-2.1-6.el7.noarch

4、安裝後就可以使用Tab鍵補全功能了

示例:

[root@dnsserver2 ~]# ll /tmp/
總用量 0
drwx------. 3 root root 17 7月  31 10:46 systemd-private-74ec873b7e79494ab8276e8f0fcf97d4-chronyd.service-Dui4hA
drwx------. 3 root root 17 7月  31 10:46 systemd-private-74ec873b7e79494ab8276e8f0fcf97d4-vgauthd.service-LRaedH
drwx------. 3 root root 17 7月  31 10:46 systemd-private-74ec873b7e79494ab8276e8f0fcf97d4-vmtoolsd.service-RRkIJD
[root@dnsserver2 ~]# ll /tmp/systemd-private-74ec873b7e79494ab8276e8f0fcf97d4-
systemd-private-74ec873b7e79494ab8276e8f0fcf97d4-chronyd.service-Dui4hA/  systemd-private-74ec873b7e79494ab8276e8f0fcf97d4-vmtoolsd.service-RRkIJD/
systemd-private-74ec873b7e79494ab8276e8f0fcf97d4-vgauthd.service-LRaedH/