centos命令自动补全增强

CentOS默认没有像Ubuntu系统一样命令参数补全功能,例如yum install无法补全。通过安装bash-completion安装命令参数补全增强。

CentOS6

默认情况下,CentOS6官方源不包含bash-completion,需要从epel源中安装。可直接安装rpm包

# rpm -ivh https://mirrors.ustc.edu.cn/epel/6/x86_64/bash-completion-1.3-7.el6.noarch.rpm

或者安装epel的repo源,通过yum安装

# rpm -ivh https://mirrors.ustc.edu.cn/epel/epel-release-latest-6.noarch.rpm
# yum -y install bash-completion

CentOS7

CentOS7官方源默认已经包含bash-completion,直接安装

# yum -y install bash-completion

最后

退出当前shell,重新登陆shell,即可生效

[root@ftpserver conf]# yum group
groupinfo     groupinstall  grouplist     groupremove

扩展

EPEL的全称叫 Extra Packages for Enterprise Linux 。EPEL是由 Fedora 社区打造,为 RHEL 及衍生发行版如 CentOS、Scientific Linux 等提供高质量软件包的项目。装上了 EPEL之后,就相当于添加了一个第三方源以获得 RHEL 的高质量、高性能、高可靠性,又需要方便易用(关键是免费)的软件包更新功能。

一些开源的Linux镜像站都已经提供epel源,如:

https://mirrors.ustc.edu.cn/
https://mirrors.aliyun.com/
原文地址:https://www.cnblogs.com/st-jun/p/bash-completion.html