Terminal GuideTerminal Guide

Dash

Debian Almquist Shell

Lightweight POSIX-compliant shell, fast and minimal

POSIX CompliantReleased: 1997Official Site

Overview

Dash (Debian Almquist Shell) is a POSIX-compliant shell that is much smaller and faster than bash. Ubuntu and Debian use dash as /bin/sh for system scripts, providing faster boot times and script execution.

Quick Facts

Full NameDebian Almquist Shell
CategoryPosix
POSIX CompliantYes
Config File.profile (via /bin/sh)
Default OnUbuntu (/bin/sh), Debian (/bin/sh)
First Release1997

Who Should Use Dash?

  • System scripts - Fast execution for init scripts
  • Container developers - Minimal image size
  • Performance optimization - Scripts that need speed
  • Embedded systems - Resource-constrained environments

Installation

Install dash for faster script execution.

bash
# Install on Debian/Ubuntu (usually pre-installed as /bin/sh)
sudo apt install dash

# Install on macOS
brew install dash

# Install on Fedora
sudo dnf install dash

# Check if sh is dash
ls -la /bin/sh
# On Debian/Ubuntu: /bin/sh -> dash

Basic Usage

Dash follows POSIX strictly.

bash
#!/bin/dash

# Variables (no declare, no local outside functions)
NAME="World"
echo "Hello, $NAME!"

# No arrays! Use positional parameters
set -- apple banana cherry
echo "$1"  # apple

# Arithmetic
result=$((5 + 3))
echo "$result"

# Functions
greet() {
    local name="$1"  # local only in functions
    echo "Hello, $name!"
}

# No [[ ]], use [ ] or test
if [ "$NAME" = "World" ]; then
    echo "Match!"
fi

Configuration

Dash is not intended for interactive use.

bash
# Dash reads ~/.profile for login shells
# ~/.profile

PATH="$HOME/bin:$PATH"
export PATH

# Note: Dash has no interactive features
# - No command history editing
# - No tab completion
# - No prompt customization beyond PS1

# Use dash for scripts, not interactive shells
# In scripts, prefer:
#!/bin/dash

Key Features

Speed

4x faster startup than bash, faster script execution

Small Size

Much smaller binary than bash (~150KB vs ~1MB)

POSIX Compliance

Strict adherence to POSIX standard

Low Memory

Minimal memory footprint for embedded use

FAQ

Why does Ubuntu use dash for /bin/sh?

Dash is much faster than bash for script execution. Ubuntu switched to dash for system scripts to improve boot times and overall system performance.

Can I use dash as my interactive shell?

Technically yes, but dash lacks interactive features like history editing, tab completion, and line editing. It's designed for scripting, not interactive use.

Summary

Key takeaways for Dash:

  • Fastest POSIX-compliant shell available
  • Default /bin/sh on Debian and Ubuntu
  • Ideal for system scripts and containers
  • Not suitable for interactive use

Official Documentation

For authoritative information, refer to the official documentation:

Written by Dai AokiPublished: 2026-01-20

Related Articles