Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have recently installed ubuntu hardy and found that shell command completion with TAB doesn't work, the package 'bash-completion' is installed in my system. I guess it is related to dash being the default shell? Is there a way to use tab completion in dash? If there isn't a way then how can i change my default shell to bash?

share|improve this question
Thus the question really isn't "Tab doesn't work", it's, "Running the wrong shell". Note that you can run bash from dash with "/bin/bash" and immediately see if the tab key works there. "exit" to get back to dash. – gbarry Oct 24 '09 at 18:51
up vote 1 down vote accepted

Dash shouldn't be the default user shell. That would make life much less convenient, because bash is way more usable in interactive sessions. You can check what shell you're actually running with echo $SHELL.

Have a look at /etc/bash.bashrc around line 32. Uncomment the enabling configuration.

share|improve this answer
It's also enabled (or can be) on a per-user basis in ~/.bashrc – Dennis Williamson Oct 24 '09 at 18:27
If he added his account (i.e. not the first account made), using adduser instead of useradd, I believe it defaults to sh. – Kyle Smith Oct 24 '09 at 20:11
Thanks Novelocrat, uncommenting at /etc/bash/bash.rc solved the problem – Tutul Oct 25 '09 at 7:49

I believe sh is actually symlinked to /bin/dash in Ubuntu. There is no tab completion support with this shell. To set your shell to bash use the following command:

sudo usermod -s /bin/bash username
share|improve this answer
Thank you Kyle, for your response. But changing the shell didn't solve it, i had to edit /etc/bash/bash.rc – Tutul Oct 25 '09 at 7:49
Very strange, I've never had to do that with any Ubuntu version, but I do see the code in bash.bashrc. – Kyle Smith Oct 28 '09 at 14:06
Actually, to change your shell, use chsh command, not sudo ... – osgx May 1 '12 at 5:30

/bin/sh is symlinked to /bin/dash To change it, do: sudo rm /bin/sh sudo ln -s /bin/bash /bin/sh

share|improve this answer
I don't think "correct it" is the right phrase. "Change it" would be better. The ubuntu folks wrote up something explaining why they changed the symlink for sh to point to dash instead of bash . It looks like bash is better for interactive site and dash is faster for running shell scripts. – Doug Harris Mar 12 '10 at 14:49
You're absolutely correct, changed. +1 – fahadsadah Mar 27 '10 at 17:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.