Comments on How To Add Bash Completion In Debian
Bash completion is a useful tool for completing file paths, commands, etc. It is enabled by default on Ubuntu but not on Debian. With two simple steps, it can also be enabled on Debian.
15 Comment(s)
Comments
I've just installed my Debian and the completion works out-of-the-box for all options and filenames. The bash_completion package was installed by default.
did you install a minimal system or just default server?
Only bash completion for filenames and directories is enabled by default -- bash completion for options and restricting filenames requires the installation of the bash-completion package from lenny onwards.
The completion of "apt-get i" to "apt-get install" will work only with the bash-completion package installed... unless you have a file called "install" in that directory.
apt-cache show bash-completion
(read first, reply second)
as far as i can remember it was always ON :-)
but it is always good to know how to turn it off too.
thanks !
Why would you install an external package? I mean, the completion support is already there. You uncomment the bash completion part in /etc/bash.bashrc and then just source this file in /etc/profile
Ekhm? I have always thought that the completion system was always ON in Debian? I have never needed to turn it on?
Hi, please, check out bash completion script for clearcase UNIX tools. Cheers, Jan.
http://jan.tomka.name/project/clearcase-completion-bash
Good evening
I followed the above instructions and copy and paste the informations as asked.
I logged out and i am now unable to logon back
I use a Debian 8.2 upgradeg to 8.5
Regards
Same here. Unable to log back in. Anybody got a solution?
On Jessie (Debian 8) install only the bash-completion package (step 1) and stop here (all else is already set up in your ~/.bashrc file if it's still unmodified after install - you can check if is present the part starting with "enable programmable completion features"). Log off and back on again and try, it should work ...if you're late and can't log back in then press ctrl+alt+f2 to change pts, login by shell and then remove last modify done on your profile file either in /etc or in your home (aka remove step 2) and you should be fine.
Today install on virtualbox debian stretch -- bash autocomplete properly work for regular users. Try to perform this actions: launch a terminal, type su (not sudo!) enter a password and trying to type something like this apt install nginx. Or type something like that: nano ~/.bashrc (under root!). Bash completion don't properly work.
You do not need to log out and in again.
Just type this:
. .bashrc
It chould re'source' your environmental settings, including the changes you've just made
Thanks for this. Worked like a charm.
# How I solved it
I had auto completion problems trying to autocomplete `wget` with `apt-get install wg[TAB][TAB]` and I managed to solve it by removing the `--no-generate` parameter from the flies below:
```
/usr/share/bash-completion/completions/apt-cache
/usr/share/bash-completion/completions/apt-get
```
It is worth mentioning that these files are available only after you install `bash-completion`.
The `--no-generate` parameter I'm referring to can be seen in the line below, but I removed ALL `--no-generate`, not only from this line:
https://github.com/scop/bash-completion/blob/master/completions/apt-get#L28
# How did I come to this point?
I got to this point after running `set -v` previous to `apt-get install wg[TAB][TAB]`, which showed that the command executed was:
```
apt-cache --no-generate pkgnames wg
```
and the output was an error:
```
E: Could not open file - open (2: No such file or directory)
```
When I executed `apt-cache pkgnames wg` without the `--no-generate` I correctly got the list for autocompletion:
```
root@484f5c8f56ba:/# apt-cache pkgnames wg
wgalician-minimos
wget2
wgaelic
wget
wgerman-medical
wget2-dev
```
Hope this helps.
you made me break my profile, i had to fix it