Unbuntu 安装之后就在终端中使用Tab键不能自动补全,解决办法如下:
1、利用vi编辑器打开/etc/bash.bashrc文件(需要root权限)
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
如果在普通用户执行不了的命令,如下操作
sudo source /etc/bash.bashrc
ubuntu设置Tab缩进空格数
如何设置Linux下tab键的缩进空格大小:
命令行下:su boot
输入密码
Vi /etc/vim/vimrc
最后添加:set ts=4
其中4即为你的缩进tab空格为4个空格
扩展
cd命令 tab补全的时候报错
问题场景
在公司的服务器上操作cd命令时,按tab补全的报错,具体信息如下:
[root@179-191 mysql]# cd incl-bash: cannot create temp file for here-document: No space left on device
-bash: cannot create temp file for here-document: No space left on device
-bash: cannot create temp file for here-document: No space left on device
-bash: cannot create temp file for here-document: No space left on device
-bash: cannot create temp file for here-document: No space left on device
根据报错信息显示可能是设备空间不足,于是查看tmp空间,执行命令如下:
#df -hl
显示结果如下:
[root@179-191 mysql]# df -hl
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg0-root 20G 20G 0 100% /
devtmpfs 3.9G 0 3.9G 0% /dev
tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs 3.9G 396M 3.5G 11% /run
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/mapper/vg0-app 102G 5.1G 92G 6% /app
/dev/mapper/vg0-boot 497M 169M 328M 34% /boot
tmpfs 782M 0 782M 0% /run/user/0
tmpfs 782M 0 782M 0% /run/user/990
问题原因 :
主要看第一行,使用达到了100%,是空间占满,导致问题出现:
于是查看哪个文件比较大,删除无用信息,执行命令如下:
#du -ah --max-depth=1
来源 :Linux环境 cd命令 tab补全的时候报错 :https://www.jianshu.com/p/9e8c6bd65963
参考链接 :
ubuntu终端Tab键不能自动补全 :https://blog.csdn.net/zilaike/article/details/78227940
ubuntu tab键不能自动补全命令的参数 :https://blog.csdn.net/chlinwei/article/details/67632558
ubuntu设置Tab缩进空格数 : https://blog.csdn.net/weixin_42988521/article/details/94595565
新建用户之后,不能使用
解决ubuntu新建用户后,tab键不能使用的问题 https://blog.csdn.net/dss875914213/article/details/81626520
Ubuntu终端tab键补全不了 :https://blog.csdn.net/luckytanggu/article/details/80221903
补充
ubuntu&Centos7设置tab自动补全 :https://blog.csdn.net/bai0324lin/article/details/87919274
安装完成后退出终端重新连接服务器后生效
Centos 7安装Tab键自动补全功能(使用systemctl如何补全服务名称,kubectl 自动补全) :https://blog.csdn.net/kevin_junjun/article/details/82084816