ubuntu如何实现自动补齐

1211
2021/2/1 14:36:31
栏目: 智能运维
开发者测试专用服务器限时活动,0元免费领,库存有限,领完即止! 点击查看>>

ubuntu如何实现自动补齐

ubuntu实现自动补齐的方法:

1.以root权限利用vi编辑器打开/etc/bash.bashrc文件,命令:

sudo vi /etc/bash.bashrc

2.找到/etc/bash.bashrc文件中的下列代码进行修改。


#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


需要去掉去掉 if 到 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 



辰迅云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>

推荐阅读: ubuntu如何退出命令行界面