Linux command
dash 命令
网络
复制后可按需替换文件名、目录或参数。
常用示例
Run script
dash [script.sh]
Run command string
dash -c '[command]'
Check syntax without executing
dash -n [script.sh]
Debug mode (print commands)
dash -x [script.sh]
Verbose mode (print input)
dash -v [script.sh]
Interactive shell
dash -i
说明
dash is the Debian Almquist Shell, a POSIX-compliant /bin/sh implementation designed for efficiency and standards compliance. It is significantly faster and smaller than bash, making it ideal for running shell scripts and system initialization. The shell prioritizes script execution speed, startup time, and minimal memory footprint over interactive features. It's approximately 4x faster than bash for script execution, which is why Debian and Ubuntu use it as the default /bin/sh. dash is derived from NetBSD's ash (Almquist shell), which itself was created as a BSD-licensed replacement for the original Bourne shell. It implements the POSIX shell specification strictly, without bash extensions like arrays, [ ] conditionals, or process substitution. The shell is primarily used for system scripts, package manager scripts, and situations where POSIX compliance and performance matter more than advanced interactive features.
参数
- -c _string_
- Read commands from string
- -s
- Read commands from stdin
- -i
- Interactive mode
- -l
- Login shell
- -f
- Disable filename expansion (noglob)
- -n
- Check syntax only (noexec)
- -u
- Error on undefined variables (nounset)
- -v
- Print input lines (verbose)
- -x
- Print commands before execution (xtrace)
- -e
- Exit on error (errexit)
- -I
- Ignore EOF in interactive mode
- --help
- Show help
- --version
- Show version
FAQ
What is the dash command used for?
dash is the Debian Almquist Shell, a POSIX-compliant /bin/sh implementation designed for efficiency and standards compliance. It is significantly faster and smaller than bash, making it ideal for running shell scripts and system initialization. The shell prioritizes script execution speed, startup time, and minimal memory footprint over interactive features. It's approximately 4x faster than bash for script execution, which is why Debian and Ubuntu use it as the default /bin/sh. dash is derived from NetBSD's ash (Almquist shell), which itself was created as a BSD-licensed replacement for the original Bourne shell. It implements the POSIX shell specification strictly, without bash extensions like arrays, [ ] conditionals, or process substitution. The shell is primarily used for system scripts, package manager scripts, and situations where POSIX compliance and performance matter more than advanced interactive features.
How do I run a basic dash example?
Run `dash [script.sh]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -c _string_ do in dash?
Read commands from string