FREE BURMA!

( ? , qUeStIoNMaRk )

Seeking for a sustainable amount of chaos. AKA an electronic stream of consciousness about software engineering, open source, life. By Marco Fabbri.

February 12, 2006

Small Enlightenments (2)

Filed under: wisdom, linux, sysadmin

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.

Comments »

The URI to TrackBack this entry is: http://questionmark.blogsome.com/2006/02/12/small-enlightenments-2/trackback/

No comments yet.

RSS feed for comments on this post.

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>


Get free blog up and running in minutes with Blogsome | Theme designs available here