ubuntu 设置tab键自动补全

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

  • 9
    点赞
  • 44
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值