Disable bash autocompletion on Ubuntu

Some of us old terminal jockeys were annoyed that bash completion was enabled on new Ubuntu installs. Here’s the description for the package:

bash completion extends bash’s standard completion behavior to achieve
complex command lines with just a few keystrokes. This project was
conceived to produce programmable completion routines for the most
common Linux/UNIX commands, reducing the amount of typing sysadmins
and programmers need to do on a daily basis.

The idea is pretty interesting: provide more intelligent tab completions to commands. For example, if you type ‘mysqladmin flush-p<tab>’ it will complete the term ‘flush-privileges’. Very neat.

In practice, those who are quite familiar with tab completion for files and directories may find themselves banging their heads on the tables. One of my fellow programmers was annoyed trying to get filename completion after a perl -d.

Uninstalling Globally

Uninstalling should be as simple as this:

sudo apt-get remove bash-completion

Unfortunately, that still leaves files behind, and hence – not really uninstalled. In fact, if you do a dpkg -l bash-completion, you’ll see it’s in status ‘rc’: removal desired, config files remain. Easily fixed:

sudo dpkg --purge bash-completion

Log out and log in, and voila – all gone!

Uninstalling Locally

If you’re sharing the system with other people who do like tab completion, you’re probably better just adding the following to your .bashrc:

complete -r

With no arguments, this will remove all bash completion statements. You could also use that to fine tune what bash completion. This would remove bash completion for emacs, ack, and perl:

complete -r emacs ack ack-grep perl

To verify that it’s removed, try:

complete -p

This prints all completions currently active.

Tagged with: ,
Posted in How To
2 comments on “Disable bash autocompletion on Ubuntu
  1. […] is no need to uninstall anything, adding complete -r to .bashrc will remove all the completion […]

  2. […] I suppose it has something to do with bash completion; my approach would be to check your defined completions using complete -p and remove the culprit using complete -r . The other option is to disable it completely in the running shell using shopt -u progcomp. As you mentioned that you are running a Linux distro, which seems to be based on Ubuntu 13.04, I suppose other people will stumble across this type of error and it should be fixed in no time. Another option would be to reinstall bash completion: blog.onetechnical.com/2012/06/19/… […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: