How to fix bash command line completion

· Linux
Author

If auto-completion in bash doesn’t work you suddenly notice how much you normally use it. Suddenly you have to list all directories first and then type all paths and file names in full, instead of just pressing TAB a couple of times. Clearly unacceptable, and in some cases it can take a long time to figure out the problem. Here’s a quick fix for you if it suddenly stopped working on Ubuntu in some cases (recent updates and XUbuntu).

Check out the end of your .bashrc file. It will likely contain something like this:

if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
. /etc/bash_completion
fi

Now just remove any hashes (#) in front of these lines if they are there, and also remove the “shopt -oq posix” bit, so the result looks exactly like this:

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

If you are using XFCE (XUbuntu) you also need to edit ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml, replacing the line:

<property name="&lt;Super&gt;Tab" type="string" value="switch_window_key"/>

With the line:

<property name="&lt;Super&gt;Tab" type="empty"/>

Logout, then login again and command line completion should now work.

1 Comment

Comments RSS
  1. ZappedC64

    Thank you for this blog post. I just switched to xfce on my work laptop and the command line completion would jump to another window. The information you posted about editing the XML file was the fix. TY!

Leave a Comment