echo(1)

echo1

Write arguments to the standard output

Usage

echo [-Een] [string ...]

Overview

The echo utility writes any specified operands, separated by single blank (‘ ’) characters and followed by a newline (‘\n’) character, to the standard output.

When no operands are given, only the newline is written. The -- operand, which generally denotes an end to option processing, is treated as part of string.

The options are as follows:

-E

Disable interpretation of backslash escape sequences (default).

-e

Enable interpretation of the following backslash escape sequences:

\\

A literal backslash.

\a

Alert (BEL).

\b

Backspace.

\c

Suppress further output, including the trailing newline character.

\e

Escape character.

\f

Form feed.

\n

Newline.

\r

Carriage return.

\t

Horizontal tab.

\v

Vertical tab.

\0nnn

The character whose octal value is nnn (zero to three octal digits).

\xhh

The character whose hexadecimal value is hh (one or two hexadecimal digits).

-n

Do not print the trailing newline character.

Exit status

The echo utility exits 0 on success, and >0 if an error occurs.

Releases

61 releases since OpenBSD 2.1; the text changed 14 times.

  1. 2.1–2.3
  2. 2.4
  3. 2.5
  4. 2.6
  5. 2.7–2.8
  6. 2.9–3.0
  7. 3.1–3.3
  8. 3.4–4.1
  9. 4.2–4.4
  10. 4.5–4.8
  11. 4.9–5.4
  12. 5.5–6.0
  13. 6.1–6.2
  14. 6.3–7.8
  15. 7.9–8.0

-E since OpenBSD 7.9; -e since OpenBSD 7.9.

Standards

The echo utility is compliant with the IEEE Std 1003.1-2008 (“POSIX.1”) specification.

The flags [-E], [-e], and [-n] conflict with the behaviour mandated by the X/Open System Interfaces option of the IEEE Std 1003.1-2008 (“POSIX.1”) specification, which says they should be treated as part of string.

echo also exists as a built-in to csh(1) and ksh(1), though with a different syntax.

Where portability is paramount, use printf(1).

History

An echo utility appeared in Version 2 AT&T UNIX.

From man 8.0-current-20261101 in OpenBSD 8.0-current (2026-11-01). Parsed by carta from the page's mdoc source.