连接 Ubuntu 的 vnc 终端,Tab 键未能自动补齐命令行

Linux 2020-08-17 阅读 32 评论 0

在 Ubuntu 服务器上安装了 vncserver,通过 VNC Viewer 连接后,打开终端输入命令,按键盘的 Tab 键,未能实现自动补全命令的效果。可以参考以下步骤修复。

1. 在 .bashrc 文件添加补全命令

确保 .bashrc 文件包含自动补全的命令。如:

if [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
fi

如我的电脑上的 .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

2. 禁用 Tab 键更改窗口的行为

这是通过更改行在 ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml 中完成的。将

<property name="<Super>Tab" type="string" value="switch_window_key"/>

更改为:

<property name="<Super>Tab" type="empty"/>

3. 重启 vnc 服务

重启电脑 reboot,或者重启 vncserver

最后更新 2020-08-17