1、利用vi编辑器打开 /etc/bash.bashrc文件(需要root权限)

sudo vi /etc/bash.bashrc

接下来会提示输入密码

2、找到文件中的下列代码

#enable bash completion in interactive shells
#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

将注释符号#去掉,即改成

#enable bash completion in interactive shells
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、最后 source一下 /etc/bash.bashrc即可, 即

sudo source /etc/bash.bashrc

相关文章:

  • 2021-12-30
  • 2021-04-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-30
  • 2022-12-23
猜你喜欢
  • 2022-02-12
  • 2021-04-23
  • 2022-12-23
  • 2022-01-29
  • 2021-06-26
  • 2022-01-05
  • 2022-02-27
相关资源
相似解决方案