Syntax
Description
Theecho command writes its arguments to standard output, separated by spaces and followed by a newline. It’s one of the most fundamental commands for displaying text, debugging scripts, and creating simple output.
Unlike system shells, Nash’s echo runs entirely in-memory with no external process calls.
Options
Suppress the trailing newline. Output ends immediately after the last argument.
Enable interpretation of backslash escape sequences:
\n- newline\t- horizontal tab\r- carriage return\\- backslash
Examples
Basic output
Multiple arguments
Suppress trailing newline
Using escape sequences
Tab-separated values
Variable expansion
Pipeline Examples
Create content for grep
Generate test data
Write to file
Append to file
Practical Use Cases
Script debugging
Creating CSV data
Status messages
Environment inspection
Related Commands
Nash’s
echo automatically expands variables like $VAR and command substitutions like $(cmd). Use single quotes to prevent expansion: echo '$HOME' outputs the literal text $HOME.