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)

Add comment

Please register in our forum first to comment.

Comments

By: Alex at: 2009-05-05 06:07:52

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.

By: at: 2010-01-22 09:44:49

did you install a minimal system or just default server?

By: Stuart at: 2009-05-04 09:58:33

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)

By: nadavkav at: 2009-05-02 20:00:36

as far as i can remember it was always ON :-)

but it is always good to know how to turn it off too.

thanks !

By: Russ at: 2009-04-30 13:15:02

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

By: Piki at: 2009-04-30 18:06:36

Ekhm? I have always thought that the completion system was always ON in Debian? I have never needed to turn it on?

By: Anonymous at: 2010-05-19 04:09:32

Hi, please, check out bash completion script for clearcase UNIX tools. Cheers, Jan.

http://jan.tomka.name/project/clearcase-completion-bash

By: Alain at: 2016-07-04 22:13:45

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

 

By: Raymond at: 2016-09-27 14:23:28

Same here. Unable to log back in. Anybody got a solution?

By: Marino at: 2016-12-16 19:57:05

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.

By: Alex at: 2017-02-12 18:47:39

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.

By: sew at: 2017-09-05 04:03:50

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

By: Stephen at: 2019-04-07 00:38:27

Thanks for this. Worked like a charm.

By: Ruben Alves at: 2019-10-09 18:04:41

# 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.

By: fir at: 2021-04-16 03:00:32

you made me break my profile, i had to fix it