How Auto Complete Works in Shell Linux

  1 min read  

By default, after installing Gentoo Linux, or another distribution, the auto complete in the Shell (in this case we will talk about BASH, however, we will give tips for the other shells) is not installed. Usually you find him on the way:


That is, if you use git, man, … You will notice that the next command parameters will not be auto-completed with the [TAB] key.

If you just want to use it at the moment it is, you can use the complete command with the arguments ‘c’ and ‘f’. Example to auto complete the parameters with the complete command:

complete -cf man

After running this command, you will notice that if you use the man command and a parameter (man [command]) will now appear. Although with this solution appear some observations:

It can auto complete several commands that do not even have manual; In other commands there may be an excessive number of possibilities that are not always linked to the command you want. When closing the terminal you will notice that the configuration will be lost (but in this case you can add it to your .bashrc, for example echo “complete -cf [comando]” » ~/.bashrc).

If you noticed some ‘mess’ in your Shell, you can “remove” with the ‘r’ option this configuration with the command below:

complete -r man

However, the most correct solution is you install an application for Shell, the bash-completion.

To install it, use:

emerge --ask app-shells/bash-completion

After installed check that the git, man, … commands are auto completing the parameters with the [TAB] key !!!

If you want to see the file, run the command

cat /etc/bash_completion.d/gentoo-style-init

For other shells and applications, there are the options below:


For more information, run the Portage search commands:

emerge --search completion
emerge --searchdesc bash-completion

Useful links


via: Marcos Oliveira Medium

Add our feed: to: