echo command (Linux / bash / sh / zsh)
What it does
Write arguments and shell-expanded values to standard output. When people search for the echo command linux shell, they usually want echo's everyday flags, safe examples, and how it differs from related tools. Below you'll find syntax, options, and copyable examples for Bash/sh/zsh.
Write arguments and shell-expanded values to standard output.
Syntax
echo [OPTION]... [STRING]...
Common options
| Flag / option | Meaning |
|---|---|
| -n | Do not append a newline. |
| -e | Interpret backslash escapes in implementations that support it. |
| -E | Disable escape interpretation. |
| -- | Mark the end of options where supported. |
Practical examples
Print text
echo 'Build complete'
Writes a line to standard output.
Show variable
echo "$HOME"
Prints the expanded home path safely.
Append line
echo 'enabled=true' >> app.conf
Adds a line to a file.
Linux ↔ Windows equivalent
Closest match: echo (Windows / CMD). Display text or control command echoing in a batch script.
Common mistakes
- Using echo for portable escape handling; printf is more predictable.
- Leaving variable expansions unquoted and triggering word splitting or globbing.
Related commands
- teeCopy standard input to standard output and one or more files.
- exportMark shell variables for inheritance by child processes.
- echoDisplay text or control command echoing in a batch script.
- grepSearch text for lines matching a pattern.
- Where-ObjectFilter pipeline objects by property values or a script block predicate.
- catConcatenate files and write their contents to standard output.
- Get-ContentRead file content or provider data as a stream of objects.
- tailPrint the end of input and optionally follow appended data.
FAQ
What does echo do in Linux?
Write arguments and shell-expanded values to standard output.
How do I use echo from the terminal?
Start with `echo [OPTION]... [STRING]...`, then choose only the options needed for the task.
What is a practical echo example?
Try `echo 'Build complete'` — Writes a line to standard output.
Can I use echo in a shell script?
Yes. echo works in Bash, sh, and Zsh, but scripts should handle quoting, errors, and command output explicitly.
Browse the full Linux and Windows command reference to search more bash, CMD, PowerShell, Conda, and GitHub CLI commands.