2015/09/10

Changing dash to bash

The default shell for Ubuntu is dash. To change it to bash, the command update-alternatives could be used. The system used to create this tutorial is Ubuntu Studio 14.04.3.

Current Alternatives for ``sh``

Check the current alternatives for sh with the command:

# update-alternatives --config sh
update-alternatives: error: no alternatives for sh

The message showed that there were no alternatives for sh. It bash is already installed as an alternative, jump to Configure the Alternatives.

Install bash as an Alternative

To install bash as an alternative for sh:

# update-alternatives --install /bin/sh sh /bin/bash 100
update-alternatives: using /bin/bash to provide /bin/sh (sh) in auto mode

Where /bin/sh is the symbolic name of the alternative, sh is the alternative name, /bin/bash is the path to bash and 100 is the priority of this alternative.

As there were no alternatives for sh before, just installing bash will make it the default alternative. Just to illustrate the example, to install dash:

sudo update-alternatives --install /bin/sh sh /bin/dash 50
update-alternatives: using /bin/dash to provide /bin/sh (sh) in auto mode

Now, both bash and dash are installed as an alternative for sh. bash is the selected on auto mode, because it has higher priority.

Configure the Alternatives

To manually configure an alternative, use the --config paramater for update-alternatives:

update-alternatives --config sh
There are 2 choices for the alternative sh (providing /bin/sh).

  Selection    Path            Priority   Status
------------------------------------------------------------
* 0            /bin/bash        100       auto mode
  1            /bin/bash        100       manual mode
  2            /bin/dash        50        manual mode

Press enter to keep the current choice[*], or type selection number:

And to change the priority of an alternative, just use the install parameter as described above.

Revision History

Post built on: 2015-09-10 22:29:15
Last modified on: 2015-09-10 22:29:09
First published on: 2015-09-10

Revision Date Description
1.00 2015-09-10 Initial version. Published

No comments :

Post a Comment