I've got an annoying problem with completion and sudo apt-get.

To give an example:

$ sudo apt-get in[Tab][Tab]    
in                           intel_bios_reader
includeres                   intel_disable_clock_gating
indicator-multiload          intel_dpio_read
info                         intel_dpio_write
infobrowser                  intel_error_decode
infocmp                      intel_forcewaked
infokey                      intel_gpu_abrt
infotocap                    intel_gpu_time
inimf                        intel_gpu_top
init                         intel_gtt
init-checkconf               intel_l3_parity
initctl                      intel_reg_checker
initctl2dot                  intel_reg_dumper
initex                       intel_reg_read
inkscape                     intel_reg_snapshot
inkview                      intel_reg_write
inputattach                  intel_sprite_on
insmod                       intel_stepping
install                      intel_upload_blit_large
install-docs                 intel_upload_blit_large_gtt
installfont-tl               intel_upload_blit_large_map
install-info                 intel_upload_blit_small
installkernel                interdiff

While is working right both with just apt-get or doing it in root:

$ apt-get in[Tab]stall
$ sudo -i
[sudo] password for davide: 
root@brenna:~# apt-get in[Tab]stall

So the problem is using autocompletion after sudo? Not really, because

$ sudo apt-[Tab][Tab]
apt-add-repository    apt-extracttemplates  apt-key
apt-cache             apt-file              apt-mark
apt-cdrom             apt-ftparchive        apt-sortpkgs
apt-config            apt-get 

Summing up, the problem seems to be using sudo and auto-completion for programs options together.

Any good advice for that?

  • Works under 12.04, might be a bug. – user98085 Oct 28 '12 at 14:42

I found the problem.

It was that I had

complete -cf sudo

in my ~/.bashrc.

I don't really know what does that mean, but I'm pretty sure I added it a long time ago to make autocompletion work with sudo.

What I think is that the newer versions don't need it anymore, which is a great news! :D

So, this is solved.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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