What is /bin/dash? I noticed that the default system shell /bin/sh was changed to /bin/dash. Why was this change made?
Dash is an acronym for Debian Almquist shell (dash). It is a Unix and Linux shell which is much smaller than bash but still aiming at POSIX-compliancy. dash is a POSIX-compliant implementation of /bin/sh that aims to be as small as possible. dash is a direct descendant of the NetBSD version of ash (the Almquist SHell), ported to Linux in early 1997. It was renamed to dash in 2002.
From the dash man page:
dash is the standard command interpreter for the Linux system. The current version of dash is in the process of being changed to conform with the POSIX 1003.2 and 1003.2a specifications for the shell. This version has many features which make it appear similar in some respects to the Korn shell, but it is not a Korn shell clone. Only features designated by POSIX, plus a few Berkeley extensions, are being incorporated into this shell.
Starting with DebianSqueeze and Ubuntu 6.10, the default shell will be dash. The default system shell, /bin/sh, was changed to /bin/dash due to the following technical reasons:
- To speed up the system boot time. The reason is that dash starts faster than bash, and the shell is started quite a lot of times during boot. Measurements showed that they run equally fast, so the improved boot time must be due to dash doing less work during initialization.
- It requires less disk space but is also less feature-rich.
- It depends on fewer libraries.
- It is believed to be more reliable in the case of upgrade problems or disk failures.
A Note About Bash Specific Scripts
It is recommend that to avoid errors with your own Bash-specific scripts you can use the shebang line as follows:
#!/usr/bin/env bash.
OR
#!/path/to/real/bash.binary
OR
#!/usr/local/bin/bash
However, Ubuntu wiki recommends that:
Developers of shell scripts adhere to the POSIX standard, omitting those items flagged as XSI extensions. Doing so will improve portability to a variety of Unix systems, and will provide assurance that problems you encounter will be treated as bugs rather than as undocumented features.
Test all your scripts and see if they will break once /bin/sh defaults to /bin/dash using virtualization or test machine.
References:
- Dash page from the Debian wiki.
- Dash as /bin/sh page from the Ubuntu wiki.
- Proposed release goal: Switch to dash as /bin/sh to speed up the boot.
- man dash
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop














{ 3 comments… read them below or add one }
Hi,
you can use checkbashisms to spot if your scripts can work under dash.
http://man.he.net/man1/checkbashisms
or. under debian/ubuntu aptitude install devscripts
Anybody else getting tired of Ubuntu making radical changes to the OS with each release? Changes to the desktop is one thing but internals like the system shell, init scripts, inittab, and the list goes on.. seem to me like change for the sake of change. Having the system boot a couple seconds faster holds absolutely no value to me in light of the fact that I pay the price of no longer having easy access to bash and also having to re-evaluate all my scripts now. So what’s next? Maybe eliminating the whole /etc directory? I’m sure that has to be on the list somewhere.
Dash being used to speed up the system scripts is fine. But as a user you can specif some other shell as the shell to use.
However on point that dash does loose compliance in is that it only allows 1 digit file descriptors! That is you can not open a file descriptor numbered 10 or above.
For example this fails, and it is POSIX compliant.
$ exec 10>log_file
exec: 1: 10: not found