$linuxjunkies
>

dash(1)

dash is a POSIX-compliant shell designed for speed and minimal size, commonly used as /bin/sh on modern Linux systems.

UbuntuDebianFedoraArch

Synopsis

dash [OPTIONS] [FILE] [ARGUMENTS]

Description

dash is a lightweight shell implementation that prioritizes POSIX compliance and execution speed over feature richness. It is often used as the system shell (/bin/sh) for shell scripts and system initialization, replacing the heavier bash in many distributions. dash executes shell scripts and interactive commands with minimal overhead.

Unlike bash, dash omits many extensions and features, making it faster for script execution and reducing system resource usage. It supports the core POSIX shell syntax and builtins, making it ideal for portable scripts that should work across different Unix-like systems.

Common options

FlagWhat it does
-c STRINGExecute the command string and exit
-eExit immediately if a command exits with non-zero status
-fDisable pathname expansion (globbing)
-iForce interactive mode with prompts
-nRead commands but do not execute them (syntax check)
-sRead commands from standard input
-uTreat undefined variables as an error
-xPrint each command and its arguments before execution (debug mode)
-vPrint shell input lines as they are read

Examples

Execute a shell script using dash as the interpreter

dash script.sh

Run a single command string and exit

dash -c 'echo "Hello World"'

Check syntax of a script without executing it

dash -n script.sh

Execute a loop with debug output showing each command

dash -x -c 'for i in 1 2 3; do echo $i; done'

Read and execute commands from stdin

echo 'echo test' | dash

Run script with immediate exit on any error

dash -e script.sh

Start an interactive dash shell session

dash -i

Treat undefined variable references as errors

dash -u -c 'echo $UNDEFINED_VAR'

Related commands