Description #
Dash (Debian Almquist Shell) is a POSIX-compliant shell optimized for speed and minimalism. It is primarily used as the default system shell for scripting on Debian-based Linux systems due to its performance advantages over Bash in non-interactive contexts.
History #
Dash originated as a port of the Almquist Shell (ash) and was introduced to Debian in the early 2000s. It was adopted as the default /bin/sh
in Ubuntu starting from version 6.10 (Edgy Eft) to improve system boot times and script execution speed. Unlike Bash, Dash avoids non-POSIX extensions, making it highly compatible and lightweight for shell scripting.
Hello World Code #
#!/bin/dash
echo "Hello, World!"
How to Run #
Save the code in a file like hello.sh
Make it executable:
chmod +x hello.sh
Run it with Dash:
./hello.sh
Dash is typically pre-installed on Debian, Ubuntu, and derivatives.
Key Concepts #
- POSIX-compliant
- Lightweight and fast
- Lacks Bash-specific features (e.g., arrays)
- Minimal memory usage
- Interprets
/bin/sh
symlinks - Useful for boot scripts
- Great for embedded systems
- No interactive features like tab-completion
- Common in system-level automation
- Ideal for portability
Try It Online #
- Linux Containers Playground (Try Dash)
- Or use any online Bash interpreter and set
#!/bin/dash
Fun Facts #
- Ubuntu switched to Dash for
/bin/sh
to reduce boot time by about 33%. - Dash scripts fail fast on syntax errors, making debugging easier.
- It’s a favorite for testing script portability across Unix systems.