1.如果未安装bash-completion,安装bash-completion。
2.修改/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
前面的#去掉。
3.修改/etc/profile文件,在最后增加一行
source /etc/bash.bashrc
注销重新登录就好了。
Linux下命令参数自动补全bash-completion:http://www.linuxdiyf.com/linux/18210.html
Fedora sudo指令补全扩展bash-completion:http://www.linuxdiyf.com/linux/11730.html