Disable Bash's programmable autocompletion (based on command)

8

3

Bash in my Fedora 16 seems to autocomplete arguments based on the command itself. So if I for example type

cd Tab

… it will only show directories.

There are however far too many commands where it doesn't know the expected input types, so is there any way to disable this feature?

MTilsted

Posted 2012-05-07T01:28:25.077

Reputation: 982

Answers

6

Remove the bash-completion package.

Ignacio Vazquez-Abrams

Posted 2012-05-07T01:28:25.077

Reputation: 100 516

You will need to restart any running instances of bash for the change to take effect. Also consider using sudo apt-get --purge remove bash-completion as suggested below. This appears to remove a file from /etc referencing a completion-related file that bash will otherwise complain about. – neuralmer – 2018-05-01T14:03:05.943

10

shopt -u progcomp

will disable program based completion and TAB will do regular file/dir completion again. You can do this on a shell by shell basis (or put in in .bashrc for all shell in your account) rather than remove the bash-completion package for everyone. Running complete -r removes all program completion settings so there are none defined. This means if you want to turn it on again you have to redefine them all again. Whereas if you used shopt -u progcomp to turn it off, you can just run shopt -s progcomp to turn it back on again.

raines

Posted 2012-05-07T01:28:25.077

Reputation: 101

Sounds great, and actually disables it (like the Q asked) instead of removing it entirely. Could put in .bashrc too. Should be the correct answer IMO – Xen2050 – 2017-03-18T09:18:25.093

6

Another way to disable it on a per-user basis is by doing complete -r in your .bashrc file. Type help complete for more information.

xioxox

Posted 2012-05-07T01:28:25.077

Reputation: 181

This is a very good option to take when one doesn't have superuser privileges (e.g., using a computer at a university). – rbrito – 2019-10-01T19:53:51.717

1

Just removing the package is not enough, you also want to purge the files:

sudo apt-get --purge remove bash-completion

mianos

Posted 2012-05-07T01:28:25.077

Reputation: 111