Enable Tab Completion in Debian

Tab completion makes your life easier at the command line. Just type the first few letters of a command then hit TAB and the computer will fill the rest in for you. You can do the same with files: just type the unique first few digits of a file and hit TAB and bash will do its magic. If there is more than one match you will be presented with all the possibilities.

There is a way of extending this so that you can do the same with the man command. For example, type “man shut” then TAB and the rest of the word you are looking for, “shutdown” is filled in for you.

To enable this, edit .bashrc and enable tab completion by uncommenting the lines in .bashrc

# enable programmable completion features (you don’t need to enable
# this, if it’s already enabled in /etc/bash.bashrc and /etc/profiles
# sources /etc/bash.bashrc).
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi

Some distros do this by default. Debian does not.

Leave a Reply