echo
Display a line of text
Overview
Displays a line of text or string that is passed as an argument. It is commonly used in shell scripts and batch files to output status text to the screen or a file, and for variable expansion.
Syntax
echo [SHORT-OPTION]... [STRING]...Common Options
-nDo not output the trailing newline character.
-eEnable interpretation of backslash escapes (behavior can vary between shell built-in and coreutils echo).
-EExplicitly disable interpretation of backslash escapes (often default).
Backslash Escapes (with -e)Common escapes: \ (backslash), a (alert), (backspace), c (suppress further output), e (escape char), (form feed), (new line), (carriage return), (horizontal tab), (vertical tab), \0NNN (octal byte e.g. \077), \xHH (hex byte e.g. \x3F).
Examples
Displays "Hello, World!" followed by a newline.
Displays "No newline" without a trailing newline.
Displays text on two lines with the second line indented (if -e is supported and interpreted).
Displays "Welcome, User!" by expanding the shell variable.
Writes the string "Saving data..." to the file `log.txt`, overwriting existing content.
Appends the string "Error encountered." to `error_log.txt`.
Redirects the message to standard error (stderr).
Displays "This is red text" in red color using ANSI escape codes (terminal dependent).