How do I fix bash autocomplete?

Asked by Justin Dugger

I installed Feisty on my new laptop and noticed that bash has many more autocomplete features than my desktop. I've been upgrading my desktop from version to version since hoary or so. It's very nice to have less invoke zless when I try to read compress documentation, autocomplete on apt-get install is also helpful, etc; how do I go about enabling these features on my upgraded desktop?

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Justin Dugger
Solved:
Last query:
Last reply:
Revision history for this message
Dennis Dirdjaja (dcd-ditsch) said :
#1

Hello Justin,
I don't get what you mean by »desktop«. You probably want to change the default shell to bash instead of dash. This can be done by changing the symlink /bin/sh to point on /bin/bash. I have never done it though, so I can't say if there are some negative impacts in doing it.

Revision history for this message
Hanusz leszek (leszek-skynet) said :
#2

edit your bash.bashrc file:

sudo gedit /etc/bash.bashrc

add these lines (or comment them out):

if [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
fi

save and reboot

Revision history for this message
Best Justin Dugger (jldugger) said :
#3

Dennis, there's also the chsh command that will change a user's shell to be explicitly whatever, including bash. Mine's already set up correctly though.

Hanusz, that's interesting, and I think I remember doing that on my laptop now, but it doesn't seem to be quite enough. I figured out what I was looking for though. There's a LESSOPEN and LESSCLOSE env variable that are used to make autocomplete smarter with less, that's set in .bashrc. I must have enabled that on my laptop too. Thanks for the pointers!