Bash Command Escape/Unescape
Online Bash command escape and unescape tool with single, double, and ANSI-C quoting styles for script argument handling and safer command execution.
Escape options
Quote style
Bash Escape Guide
This tool converts plain text into safe Bash string literals and supports reverse decoding. It is useful for command argument handling, script generation, deployment automation, and security debugging.
Common escaping rules
Sensitive special characters
- Dollar sign $, backtick `, and backslash \\
- Quote characters ' and "
- Pipe |, redirect > <, and semicolon ;
- Wildcards * ? [ ] and braces { }
Three quote styles
- Single quote: safest for literal text without expansions
- Double quote: practical when escaping $ and ` is needed
- ANSI-C: best for line breaks, tabs, and hex/unicode sequences
Unescape behavior
- Auto-detects $'...', '...', and "..." input
- Restores common control escapes like \n, \t, and \r
- Supports hex and Unicode escape sequence decoding
Use cases
- Build safe script arguments to reduce injection risk
- Handle file paths containing spaces, quotes, and symbols
- Generate command parameters for Docker and Kubernetes
- Debug escaping differences in Bash command execution
Tips
- Use single-quote style for most plain text arguments.
- Use ANSI-C style when line breaks or control chars are required.
- Before unescaping, ensure the input has complete quote wrappers.