Linux Commands Reference - Complete Linux Command Guide

Comprehensive Linux command reference with 150+ commands. Search, filter by category, and view detailed usage examples.

Share
Back to commands

echo

Display text to stdout

Syntax

echo [OPTION]... [STRING]...

Common Options

-nNo trailing newline
-eEnable escape interpretation
-EDisable escape interpretation
\nNewline (with -e)
\tTab (with -e)
\aAlert/bell (with -e)
\cSuppress further output (with -e)
\033[...mANSI color codes (with -e)

Common Examples

echo "Hello World"

Print text

echo -n "no newline"

Print without newline

echo -e "Line1\nLine2"

Print multiline text

echo $PATH

Print environment variable

echo $?

Print last exit code

echo "text" > file.txt

Write to file (overwrite)

echo "text" >> file.txt

Append to file

echo -e "\033[31mRed\033[0m"

Print colored text

Related Commands

Related Tools

More Code & Dev Tools