Enabling bash/git auto-completion in Ubuntu

I now use git quite a lot for various projects.  I noticed that on one computer I had very handy tab completion, and the other one did not.  They are both running Ubuntu 8.10, so there shouldn’t be a difference.

It turns out that I had enabled bash completion on one machine but not on the other.

To enable it for all users on your system you need to edit  /etc/bash.bashrc and uncomment lines 32 – 34 (in the default file) so it looks like:

# enable bash completion in interactive shells
if [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
fi

Open a new terminal and auto-completion should now work.

About Anthony Batchelor

Job: Software engineer at Mercurytide Hobbies: Guitar/Band, Kendo, Beer Brewing, Simple Electronics, Python hacking.
This entry was posted in How-to, Programming and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>