How to enable (or disable) Bash autocompletion in Debian-based distributions

Hello, friends. In this post, you will learn how to enable Bash autocompletion in Debian-based distributions.

Bash is a very versatile shell, but many newcomers to Linux may find it a bit complex. This is not the case, but for them, any help is important.

That is why it is critical to enable Bash autocompletion. This should come by default already in the distribution you use, but you can also take advantage of this post to disable it if necessary.

Let’s go for it. It is simple.

Enabling Bash autocompletion in Debian-based distributions

In the official repositories there is a package called bash-completion. You will need to install this package to enjoy the autocompletion.

So, before you start, the usual, update the operating system.

sudo apt update
sudo apt upgrade

Search for the required package

apt search bash-completion

Sample output:

Bash Completion package
Bash Completion package

Now install it by executing this command

sudo apt install bash-completion

Now we need to make some adjustments.

Set up Bash autocompletion

If everything went well, you will have a file called located in /etc/profile.d/ To make sure then, run

ls -l /etc/profile.d/

You will have an output like this

Enable Bash autocompletion

To apply the changes and thus enable the desired autocompletion, we have to add a few things to ~/.bashrc.

So, we can either copy the contents of the script to the end of the mentioned file or simply source it to the

echo "source /etc/profile.d/" >> ~/.bashrc

We are ready!!! Now you can enjoy the autocompletion.


Bash autocompletion is a help for the most novice users of Bash. This post, also, serves to let you know how to disable it for special situations.

I am Angelo. A systems engineer passionate about Linux and all open-source software. Although here I'm just another member of the family.


Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook