I experienced another small enlightenment, linux administration related, when I discovered bash completition. This feature proves itself useful when you use quite often the shell: during system adminstration, software compilation/testing/deployment/whatever. To enable it, edit your ~/.bashrc file (where ~ means your home directory, e.g. /home/mfabbri), with your favorite editor and uncomment the lines following the one which states # enable programmable completion features .
More extensively from a shell (or a terminal window, as gnome-terminal):
$ vi /etc/bash.bashrc
find the lines :
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
#if [ -f /etc/bash_completion ]; then
# . /etc/bash_completion
#fi
and change them into
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
Logoff and login from your shell (if you are using a terminal, as gnome-terminal, restart it) , and you should be able to use completition not only for command/file names/program names, but also for program commands, for example digiting apt-get and pressing the [TAB] key should produce on the output a list of available actions as:
autoclean clean install update
build-dep dist-upgrade remove upgrade
check dselect-upgrade source
It works for many other programs, as cvs, subversion, darcs, ant, maven, java et cetera.
Java needs a special mention, use this feature with care, cause it scans the whole classpath searching for classes, so when it is dealing with huge classpaths it could slow down things a little.
As you may have noticed, you could also enable this feature system wide editing the same way the file /etc/bash.bashrc.