Bash Tab Auto-complete not working for apt
Solution 1
Actually, I found the solution ~
Install the auto-complete-el
sudo apt-get install auto-complete-el
After installing this package, I got everything back to normal.
Solution 2
Open /etc/bash.bashrc
with gedit or other text editor and uncomment the following lines:
#if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
# . /etc/bash_completion
#fi
It works for me.
On Ubuntu 16.04 the it looks like this:
#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
Solution 3
The cause might be that you are missing the package bash-completion
.
In that case, you can try installing it with
sudo apt-get install bash-completion
followed by
source ~/.bashrc
for enabling it. (Or just log out and in again).
Solution 4
Is your shell prompt looking like $
instead of user@host:~$
? If yes, then it could be case of wrong shell causing problem with autocompletion. Try changing login shell to /bin/bash
from /bin/sh
as below.
sudo chsh -s /bin/bash *username*
Related videos on Youtube
![beanaroo](https://i.stack.imgur.com/KD8ox.png?s=256&g=1)
beanaroo
Updated on September 18, 2022Comments
-
beanaroo almost 2 years
apt-get install
andapt-cache policy
do not complete package names.I have double checked /etc/bash.bashrc, no irregularities.
Googled for answers but none suffice.
Any help/advice?
-
beanaroo about 12 yearsApologies. Apt commands in general.
-
geirha about 12 yearsIs completion set up for apt-get?
complete -p apt-get
-
beanaroo about 12 yearsThe result reads: 'complete -F _apt_get apt-get' Not sure what that means
-
-
jokerdino almost 12 yearsI can't find any
/etc/bash.bashrc
. You sure about that? -
Sajesh Kumar almost 10 yearsIt works, but I don't get why, the
el
stands for Emacs Lisp... -
Robin Winslow over 9 yearsAny ideas about autocompletion for
apt
itself? (as opposed toapt-get
) -
kiranpradeep over 8 yearsDear Downvoter, please leave a comment helping me avoid repeating, the perceived mistake.
-
LittleByBlue almost 8 yearsAdding those lines to
~/.bashrc
should work, too. -
Pierre.Vriens about 7 yearsIs this a question or an answer?
-
Felix Hall about 7 yearsRephrased to read more like an answer
-
My-Name-Is over 6 yearsRelogin was required, but then it worked!