226 字
1 分钟
启用 Tab 补全
启用 Tab 补全
1、安装 bash-completion 软件包
sudo apt install bash-completion2、修改 /etc/bash.bashrc 文件(需要root权限,全局)或 ~/.bashrc 文件
# enable bash completion in interactive shells# if ! shopt -oq posix; then // [!code --]# if [ -f /usr/share/bash-completion/bash_completion ]; then // [!code --]# . /usr/share/bash-completion/bash_completion // [!code --]# elif [ -f /etc/bash_completion ]; then // [!code --]# . /etc/bash_completion // [!code --]# fi // [!code --]# fi // [!code --]if ! shopt -oq posix; then // [!code ++] if [ -f /usr/share/bash-completion/bash_completion ]; then // [!code ++] . /usr/share/bash-completion/bash_completion // [!code ++] elif [ -f /etc/bash_completion ]; then // [!code ++] . /etc/bash_completion // [!code ++] fi // [!code ++]fi // [!code ++]# 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 [ -f /etc/bash_completion ] && ! shopt -oq posix; then // [!code --]# . /etc/bash_completion // [!code --]# fi // [!code --]if [ -f /etc/bash_completion ] && ! shopt -oq posix; then // [!code ++] . /etc/bash_completion // [!code ++]fi // [!code ++]3、最后 source 重载 /etc/bash.bashrc 文件或用户目录 .bashrc 文件
source /etc/bash.bashrcsource .bashrc 最后更新于 2025-03-13,距今已过 274 天
部分内容可能已过时