Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

While trying to compile using a C/C++ file using cc/c++ commands, I find that it is no longer possible for me to use Tab key for bash-completion.

I could do the same before 12.10. Also, when compiling with gcc and g++, bash-completion works fine.

share|improve this question
up vote 2 down vote accepted

What you are seeing is a bug in bash-completion.

Luckly there's a workaround: you can open /usr/share/bash-completion/completions/cc, find the following:

complete -F _gcc gcc g++ g77 gcj gpc &&
    cc  --version 2>/dev/null | grep -q GCC && complete -F _gcc cc  || :
    c++ --version 2>/dev/null | grep -q GCC && complete -F _gcc c++ || :

and replace it with the following:

complete -F _gcc gcc g++ g77 gcj gpc cc c++
share|improve this answer

I found a really simple and easy way to do it :

open .bashrc file

$ gedit ~/.bashrc

and add the following lines :

complete -f cc
complete -f c++
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.