Bash 中的 Tab 自动完成功能对目录不起作用,但对程序起作用 Ubuntu 16.04

Bash 中的 Tab 自动完成功能对目录不起作用,但对程序起作用 Ubuntu 16.04

每次我尝试按 [TAB] 自动完成目录时,都会收到相同的消息: test目录内的var/www/html

# hitting [TAB] after typing 'test'
$ ll test-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

使用llcatcd[TAB]来表示错误

我可以使用自动完成功能vim

$ vim test/testing.html

我读了一些关于此问题的帖子,但无法解决我的问题。我做的最后一件事是运行:

sudo apt install bash-completion

在我的底部~/.bashrc有:

# 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 ! 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
source /etc/profile.d/bash_completion.sh

使用/etc/profile.d/bash_completion.sh如下命令:

# /etc/profile.d/bash_completion.sh
# Check for interactive bash and that we haven't already been sourced.
if [ -n "$BASH_VERSION" -a -n "$PS1" -a -z "$BASH_COMPLETION_COMPAT_DIR" ]; then

# Check for recent enough version of bash.
bash=${BASH_VERSION%.*}; bmajor=${bash%.*}; bminor=${bash#*.}
if [ $bmajor -gt 4 ] || [ $bmajor -eq 4 -a $bminor -ge 1 ]; then
    [ -r "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion" ] && \
        . "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion"
    if shopt -q progcomp && [ -r /usr/share/bash-completion/bash_completion ]; then
        # Source completion code.
        . /usr/share/bash-completion/bash_completion
    fi
fi
unset bash bmajor bminor

fi

任何建议都很好。很容易感受到我在 bash 中自动完成的程度。$ which bash /bin/bash

谢谢戴夫

更新:我运行了一下df,它看起来像问题吗?

$ df
Filesystem                      1K-blocks    Used Available Use% Mounted on
udev                              8196256       0   8196256   0% /dev
tmpfs                             1643260   33636   1609624   3% /run
/dev/mapper/vg-root               3566896 3366004         0 100% /
tmpfs                             8216288       0   8216288   0% /dev/shm
tmpfs                                5120       0      5120   0% /run/lock
tmpfs                             8216288       0   8216288   0% /sys/fs/cgroup
/dev/sda1                          482922  267633    190355  59% /boot
tmpfs                             1643260       0   1643260   0% /run/user/1000

答案1

@thomas-ward 由于我之前的回答已改为评论,而我没有权限添加评论,所以我将添加另一个答案,然后由您来更改。抱歉。

@kaplan 查看根文件系统行df

Filesystem                      1K-blocks    Used Available Use% Mounted on
/dev/mapper/vg-root               3566896 3366004         0 100% /

可用的块数为0。这是卷上文件的可用空间。

3566896是个1k 块count 是卷的总大小(已用 + 可用 + 保留)

相关内容