Skip to main content

Command referenceecho

echo command (Linux / bash / sh / zsh)

Linuxbashshzshtextbeginner

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 / optionMeaning
-nDo not append a newline.
-eInterpret backslash escapes in implementations that support it.
-EDisable 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.

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.