When working in the Bash shell, special characters aren’t just punctuation, they’re control mechanisms.
A single symbol can redirect output, launch a background process, evaluate a condition, expand a filename pattern, or even execute an entire block of commands. Understanding what these characters do is essential for both interactive command-line work and writing reliable shell scripts. The following table summarizes the most important special characters used in Bash and explains how each one influences command behavior.
| Character | Meaning |
| ; | Separates multiple commands |
| : | Shell command that does nothing |
| . | Starts the shell program without a separate subshell (.file, corresponds to source file) |
| # | Introduces a comment |
| #!/bin/sh | Identifies the desired shell for the shell program |
| & | Runs the command in the background (com&) |
| && | Conditionally executes the command (com1 && com2) |
| &> | Redirects standard output and errors (corresponds to >&) |
| | | Creates pipes (com1 | com2) |
| | | | Conditionally executes the command (com1 | | com2) |
| * | Wildcard character for file names (any number of characters) |
| ? | Wildcard character for file names (any character) |
| [abc] | Wildcard character for file names (one character from abc) |
| [ expression ] | Short notation for test expression |
| [[expr]] | Extended test syntax, bash-specific |
| (...) | Executes commands in the same shell ((com1; com2)) |
| {...} | Groups commands |
| { , , } | Assembles strings (a{1,2,3} → a1 a2 a3) |
| {a..b} | Assembles strings (b{4..6} → b4 b5 b6) |
| ~ | Abbreviation for the home directory |
| > | Redirects output to a file (com > file) |
| >> | Redirects output to append existing file |
| >& | Redirects standard output and errors (corresponds to >&) |
| 2> | Redirects standard error output |
| < | Redirects input from a file (com<file) |
| << end | Redirects input from active file to end |
| $ | Marks variables (echo $var) |
| $! | PID of the last started background process |
| $$ | PID of the current shell |
| $0 | File name of the currently executed shell script |
| $1 to $9 | The first nine parameters passed to the command |
| $# | The number of parameters passed to the shell program |
| $* or $@ | The totality of all transferred parameters |
| $? | Return the value of the last command (0 = OK or error number) |
| $(...) | Command substitution (echo $(1s)) |
| $((...)) | Arithmetic analysis (echo $((2+3))) |
| ${...} | Various special functions for editing strings |
| "..." | Prevents analysis of most special characters |
| '...' | Prevents analysis of all special characters |
| `...` | Command substitution (echo `1s` , corresponds to echo $(1s)) |
| \character | Cancels the effect of the special character |
Mastering Bash special characters dramatically expands what you can accomplish from the command line. What looks like a small symbol often controls process flow, input and output streams, parameter handling, or command execution. By understanding how these characters work (and when to use them) you gain more precise control over your shell environment and write scripts that are cleaner, more efficient, and easier to debug. Keep this reference handy as you build confidence and deepen your Bash scripting skills.
Editor’s note: This post has been adapted from a section of the book Linux Command Reference: Shell Commands from A to Z by Michael Kofler. Dr. Kofler is a programmer and Linux administrator. He studied electrical engineering/telematics at Graz University of Technology. He has been one of the most successful and versatile computing authors in the German-speaking world for many years. His current topics include Linux, Docker, Git, hacking and security, Raspberry Pi, and the programming languages Swift, Java, Python, and Kotlin. Dr. Kofler also teaches at the Joanneum University of Applied Sciences in Kapfenberg, Austria.
This post was originally published 2/2026.