At some moment
apt-get install
autocomplete was broken
It was very useful to me to see packages name with Tab press
How to repair this autocomplete?
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.
Sign up to join this communityAt some moment
apt-get install
autocomplete was broken
It was very useful to me to see packages name with Tab press
How to repair this autocomplete?
As stated in the comments to the other answer, first make sure that bash-completion
is installed:
sudo apt-get install bash-completion
and apparently for @diapir, it helped to reinstall it:
sudo apt-get install --reinstall bash-completion
However, for me, the problem was not that bash-completion was not installed or broken, the problem was that I had accidently deleted my .bashrc
file. You can get a new one by copying it from /etc/skel
:
cp /etc/skel/.bashrc ~/
sudo
on the chmod
command is unnecessary though, right?
Dec 24, 2012 at 4:32
/etc/
is 0644/-rw-r--r--
with user:group = root:root
, and when copied to your user folder, will automatically go to user:user
Type the following command:
sudo -H gedit /etc/bash.bashrc
Look for these lines:
# enable bash completion in interactive shells
# if ! shopt -oq posix; then
# if [ -f /usr/share/bash-completion/bash_completion ]; then
# . /usr/share/bash-completion/bash_completion
# elif [ -f /etc/bash_completion ]; then
# . /etc/bash_completion
# fi
# fi
Uncomment some lines, to make it look like this:
# enable bash completion in interactive shells
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
Save, close terminal, then reopen it.
I have this issue after installing 13.04, and that's how I resolve it.
Note that output of this command:
apt-config dump | grep "Dir::Cache"
Should be something like this:
Dir::Cache "var/cache/apt";
Dir::Cache::archives "archives/";
Dir::Cache::srcpkgcache "srcpkgcache.bin";
Dir::Cache::pkgcache "pkgcache.bin";
If value of Dir::Cache::pkgcache
is empty, apt will not be able to auto complete package names. Take a look at your /etc/apt/apt.conf.d/
files and search for this key to be sure that it's not set to empty string.
grep -r pkgcache /etc/apt/apt.conf.d/
Also take a look at this answer.
rm /etc/apt/apt.conf.d/docker-clean
Feb 14, 2021 at 15:45
Download the latest stable release from http://bash-completion.alioth.debian.org/
./configure
make
sudo make install
insert
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
to ~/.bashrc
bash-completion
is in packages - is there any reason you did it manually? The package should do pretty much exactly this :)
bashrc
file.