How to add bash auto completion in Ubuntu Linux

Bash auto-completion is a feature that provides suggestions for commands and arguments as you type. To add bash auto-completion in Ubuntu Linux, you can use the following steps:

  1. Install the bash-completion package by running the following command:
sudo apt-get install bash-completion

This package contains the necessary files and scripts to enable bash auto-completion.

  1. Once the package is installed, you need to enable bash auto-completion by adding the following line to the ~/.bashrc file:
source /etc/bash_completion

You can do this by running the command:

echo "source /etc/bash_completion" >> ~/.bashrc
  1. Reload the .bashrc file by running:
source ~/.bashrc
  1. Now you should have bash auto-completion enabled in your Ubuntu Linux system. You can test it by typing a command and pressing the TAB key to see suggestions for the command and arguments.

Note: Some software packages may provide additional bash completion scripts for their own commands. You can install these scripts in the /etc/bash_completion.d/ folder.

The above steps should work on most Ubuntu versions, but if you are having trouble enabling bash auto-completion, you can check the version of your Ubuntu, and also check if the package is already installed or not.

Leave a Comment