Tuesday, August 31, 2010

[Level 2] Bash completion in Ubuntu

As we know, we can use "tab" for word completion.
And now, you can also use "tab" for bash completion.
That means when you finished typing your command,
ex. # apt-get
and you press "tab", then you will get the options for apt-get.
# apt-get
autoclean        clean            purge            upgrade
autoremove       dist-upgrade     remove          
build-dep        dselect-upgrade  source          
check            install          update

How could you enable this feature?
add the following command in your ~/.bashrc, if not exists.
if [ -f /etc/bash_completion ] then;
    . /etc/bash_completion

Wish this helps.
Stanley Huang