Generally,the value of environment variable SHELL is /bin/bash, it means normal shell environment is Bash,However,the /bin/sh is the link of Dash, what is the Dash effect?

Another question: Although our shell environment is bash, why sometimes it will go wrong because of dash?

  • Welcome to Ask Ubuntu. Maybe this will help - wiki.ubuntu.com/DashAsBinSh , which states "The major reason to switch the default shell was efficiency. bash is an excellent full-featured shell appropriate for interactive use; indeed, it is still the default login shell. However, it is rather large and slow to start up and operate by comparison with dash"
    – guiverc
    Dec 26, 2018 at 7:07

2 Answers 2


General comment about sh

The shell sh is a symbolic link to dash, which is a shell with a very light foot-print. It means that it can work quickly and will not use much memory. But the built-in commands are few, simple and have different syntax compared to more advanced shells (for example bash).

Both shells (sh and bash) are useful but for different purposes.

How to make a shellscript run by bash

If you run a text file with commands, a shellscript, you can force it to run by a certain shell. Otherwise it may default to a shell, that does does not work as intended, for example because some built-in command does not exist or the syntax for a built-in command is different.

So in order to make a shellscript run with bash, you can force it

  • by calling it from bash

    bash shellscriptname
  • by writing a line at the top of the file, a first line with the content


    This is called 'shebang'. The shebang can point to other shells too, for example sh or csh but also other programs, for example python or bc. If you make the shellscript file executable

    chmod +x shellscriptname

    you can run it with the following command

    ./shellscriptname                        # when in the current directory
    path-to-the-script-file/shellscriptname  # when somewhere else
    shellscriptname                          # when in a directory in PATH

    and it will be executed by the shell or other program in the shebang.


They main point is that bash is meant for interactive use, dash is used for system scripts.

bash comes with whole lot of features, among which is line editing. You have specific shortcuts to delete a word, jump to beginning of line, etc. This is convenient for writing commands interactively. However that comes at a price of performance and boot up times.

dash on the other hand is meant for writing system scripts that are fast and portable, thus helping keep the boot times short, and on Ubuntu it is compiled without line editing, even without vi editing mode. Thus, it has less overhead. bash is capable of running exactly same scripts /bin/dash runs ( if they are written with portable syntax, of course ), but dash is just faster at doing these same things.

Note, of course, that users are free to change their login shell via chsh command, and you don't have to stick with bash if that's not what you prefer.

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