bash-completion 套件可以实现在指令模式下自动完成指令, 与 Linux 内建的自动完成不同, 它可以自动完成参数的部份, 以下会示范在 RHEL 及 CentOS 安装的方法。
先用 yum 安装 bash-completion
# yum install bash-completion -y
安装好 bash-completion 后便可以直接使用, 只要像传统的方法按 “Tab” 键便可以, 例如:
# yum re [tab] [tab]
reinstall remove repolist
reinstall remove repolist
上面输入了 yum re 后 按 tab, 便会显示以 re 开头的可用参数, 如果不输入 “re”, 可以显示全部参数:
# yum [tab] [tab]
check history remove
check-update info repolist
clean install search
deplist list shell
distro-sync load-transaction update
downgrade makecache upgrade
groups provides version
help reinstall
check history remove
check-update info repolist
clean install search
deplist list shell
distro-sync load-transaction update
downgrade makecache upgrade
groups provides version
help reinstall