Why Debian Uses Dash as Default /bin/sh Shell
Debian uses the Debian Almquist Shell (dash) as its default system
shell (/bin/sh) instead of the GNU Bourne-Again Shell
(bash) to achieve faster execution speeds, lower resource consumption,
and strict POSIX standard compliance. While interactive user accounts
continue to use bash by default, shifting the non-interactive
/bin/sh target to dash optimizes system boot times, package
installation hooks, and maintenance scripts without altering the
day-to-day terminal experience of users.
Superior Execution Speed and Faster Boot Times
Dash is significantly lighter and faster than bash. Because operating
systems run hundreds of shell scripts during startup, shutdown, and
package management operations, the overhead of the interpreter directly
impacts system latency. Dash initializes faster, executes basic control
flow more rapidly, and avoids the computational overhead of the advanced
scripting features present in bash. When Debian transitioned
/bin/sh to dash in Debian 6.0 (Squeeze), the immediate
result was a measurable reduction in system boot and maintenance
times.
Minimal Resource Footprint
Bash is a feature-rich, complex program designed primarily for interactive use, resulting in a large binary size and substantial memory overhead. In contrast, dash is derived from the NetBSD Almquist Shell and focuses purely on simplicity. The dash binary is typically under 150 KB, whereas the bash binary often exceeds 1 MB. This small memory footprint makes dash ideal for resource-constrained environments, such as embedded hardware, minimal containers, and virtual machines. Dash also has fewer library dependencies, making it more resilient during system recovery or low-memory conditions.
Strict POSIX Compliance and Portability
According to the Single UNIX Specification and POSIX standards,
scripts specifying #!/bin/sh must adhere strictly to
portable shell syntax. Because bash contains numerous non-standard
extensions—commonly referred to as "bashisms"—developers writing scripts
under a bash-linked /bin/sh frequently introduce
non-portable code without realizing it. Dash implements only the
standard POSIX shell specifications. By making dash the system shell,
Debian forces system packages and maintainers to write clean, portable
scripts, ensuring that code functions consistently across other
UNIX-like platforms.
Reduced Attack Surface
Complex software containing extensive feature sets inherently carries a higher risk of security vulnerabilities. Dash contains only the logic required to parse and execute standard shell syntax, resulting in a much smaller codebase. This simplicity reduces the attack surface of critical system tasks. Notable security vulnerabilities that affected bash in the past, such as the "Shellshock" vulnerability, had no effect on dash-powered systems.
System Shell vs. User Login Shell
It is essential to distinguish between the system shell
(/bin/sh) and the interactive login shell. Debian uses dash
strictly for /bin/sh, which is intended for non-interactive
scripts. When a user creates a new account or opens a terminal emulator,
the default login shell remains bash. This architecture gives users the
advanced interactive features of bash—such as command completion,
history management, and custom aliases—while reserving the high
efficiency of dash for background operating system operations.