Software & AppsOperating SystemLinux

Fixing Terminal Autocomplete in Ubuntu Minimal Installation

Ubuntu 20

The terminal is a powerful tool for any Ubuntu user, especially for those using a minimal installation. One of the most useful features of the terminal is autocomplete, which saves you time by completing filenames, commands, and more as you type. However, in some cases, this feature might not work as expected. This article will guide you through several methods to fix terminal autocomplete in an Ubuntu minimal installation.

Installing bash-completion

The first step to ensure terminal autocomplete functionality is to install bash-completion. This is a utility for command line users which provides programmable completion for Bash.

To install bash-completion, open your terminal and run the following command:

sudo apt-get install bash-completion

In this command, sudo is used to run the command as an administrator, apt-get is the package handling utility in Ubuntu, and install is the command to install a new package. bash-completion is the name of the package we want to install.

If bash-completion is already installed, you can try reinstalling it with the following command:

sudo apt-get install --reinstall bash-completion

The --reinstall option tells apt-get to reinstall the package.

Enabling bash-completion in .bashrc file

After installing bash-completion, you need to enable it in the .bashrc file. This file is a script that runs every time you open a new terminal window.

Open the .bashrc file using a text editor with the following command:

gedit ~/.bashrc

Then, add the following code at the end of the file:

if ! shopt -oq posix; then
 if [ -f /usr/share/bash-completion/bash_completion ]; then
 . /usr/share/bash-completion/bash_completion
 elif [ -f /etc/bash_completion ]; then
 . /etc/bash_completion

This script checks if bash-completion is installed and, if so, enables it.

After adding the code, save the file and either source it with source ~/.bashrc or reopen the terminal.

Checking the Shell Being Used

Ensure that the shell being used supports auto-complete. The most common shell that supports this feature is Bash. You can switch to the Bash shell using the following command:

chsh -s /bin/bash

In this command, chsh is used to change the login shell, -s specifies the shell, and /bin/bash is the path to the Bash shell.

Verifying Permissions and Sourcing

Make sure that the .bashrc file has the correct permissions. You can check this with the following command:

ls -l ~/.bashrc

The permissions should be -rw-r--r--, which means that the owner can read and write the file, and everyone else can only read it.

After making changes to the .bashrc file, you need to source it to apply the changes. You can do this with the following command:

source ~/.bashrc

Terminal-Specific Settings

If you are using xfce4-terminal, you might need to modify the keyboard shortcuts configuration file. Open it with the following command:

gedit ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml

Change the value of <property name="<Super>Tab" type="string" value="switch_window_key"/> to <property name="<Super>Tab" type="string" value="empty"/>.

After making this change, save the file and restart the terminal.


Terminal autocomplete is a powerful feature that can save you time and effort. If it’s not working in your Ubuntu minimal installation, the steps outlined in this article should help you fix it. If none of these solutions resolve the issue, further troubleshooting may be required.

How do I know if `bash-completion` is already installed on my Ubuntu minimal installation?

You can check if bash-completion is already installed by running the command dpkg -l bash-completion in your terminal. If it is installed, you will see information about the package. If it is not installed, you will see a message indicating that there is no package found matching the specified name.

Can I use a different text editor to open the `.bashrc` file?

Yes, you can use any text editor of your choice to open the .bashrc file. In the instructions provided, we used the gedit text editor as an example. If you prefer a different text editor, simply replace gedit with the command for your preferred editor.

Can I use a different shell instead of Bash?

Yes, you can use a different shell instead of Bash. However, the instructions in this article specifically address enabling autocomplete for the Bash shell. If you are using a different shell, you may need to follow different steps to enable autocomplete.

Leave a Comment

Your email address will not be published. Required fields are marked *