2

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?

1
  • 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, 2009 at 18:51

3 Answers 3

1

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.

3
  • It's also enabled (or can be) on a per-user basis in ~/.bashrc Oct 24, 2009 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, 2009 at 20:11
  • Thanks Novelocrat, uncommenting at /etc/bash/bash.rc solved the problem
    – Tutul
    Oct 25, 2009 at 7:49
1

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
3
  • 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, 2009 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, 2009 at 14:06
  • Actually, to change your shell, use chsh command, not sudo ...
    – osgx
    May 1, 2012 at 5:30
0

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

2
  • 2
    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 wiki.ubuntu.com/DashAsBinSh . It looks like bash is better for interactive site and dash is faster for running shell scripts. Mar 12, 2010 at 14:49
  • You're absolutely correct, changed. +1 Mar 27, 2010 at 17:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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