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:
- 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.
- 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
- Reload the .bashrc file by running:
source ~/.bashrc
- 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.