常常使用tab来补全需要的命令参数,但在最小化安装系统的时候默认不安装,由于软件在epel库中,安装时先安装epel-release,再安装bash-completion,且需要重新建立bash环境。
yum -y install epel-release
yum -y install bash-completion
# or Debian
apt-get install bash-completion -y
brew install bash-completion
# 写入设置,具体的可以通过 brew info bash-completion 查看
vim ~/.zshrc
fpath=(/usr/local/share/zsh-completions $fpath)
plugins=(... zsh-completions)
autoload -U compinit && compinit
Docker
curl https://raw.githubusercontent.com/docker/docker-ce/master/components/cli/contrib/completion/bash/docker -o /etc/bash_completion.d/docker.sh
# 激活,在.bashrc中添加如下配置
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
文章评论
非技术的路过。