Linux and Unix echo command

Quick links

About echo
Syntax
Examples
Linux and Unix main page

About echo

Echo's to the screen what you type after echo. Echo is useful for producing diagnostics in command files, for sending known data into a pipe, and for displaying the contents of environment variables.

Syntax

echo [-n] text

-nOn BSD and some variants derived from BSD does not begin a new line after the echoed text.
textThe text that you want to echo to the screen.

Examples

echo Hello world

The above example would return "Hello world" to the console

echo * | wc

The above example would list a count of all the files and directories in the current directory.

Related commands

printf
tr