The Command Line Completion in bash Does Not Work as Expected

Support knowledgebase (drahn_bash_completion)
Applies to

SuSE Linux: Versions since 7.3

Situation:

bash's command line completion with <TAB> does not work as expected.

Cause:

From SuSE Linux 7.3 on, the bash shell has been set to use intelligent command line completion. bash knows about a number of programs and consequently only suggests file names with suffixes matching these programs. This reduces the choice of files offered by <TAB>, improving its usability. However, you may have files with non-standard suffixes on your hard disk so find this feature annoying.

Solution:

  1. Adapting completions (system-wide): If you just miss a suffix for a program (e.g., .ZIP for unzip on SuSE Linux 7.3), you can edit the file where those completions are defined. The file to edit is /etc/profile.d/complete.bash. If you think your change might be useful for others, please submit it to SuSE feedback <feedback@suse.de>. Be aware that the file complete.bash may be overwritten by updates. (It is part of the package aaa_base.)

  2. Disabling this feature (per user or system-wide): A user can turn off this feature at the running shell by using the command

    shopt -u progcomp

    To turn it off for all shells, add this shell command to the user's login script ~/.bashrc. It can be reenabled using

    shopt -s progcomp

    A system administrator can change it for all users by adding the statement to /etc/profile.local

    shopt -u progcomp >/dev/null 2>&1
    Individual users can turn it on again using shopt -s progcomp in their bash login scripts. However, we do not recommend changing the system-wide default.

Keywords: BASH, COMPLETION, TAB, TABULATOR, PROGCOMP, ZIP

Categories: Frequently asked Questions

SDB-drahn_bash_completion, Copyright SuSE Linux AG, Nürnberg, Germany - Version: 15. Mär 2002
SuSE Linux AG - Last generated: 21. Mai 2002 by drahn (sdb_gen 1.40.0)