Write arguments to standard output (POSIX)
echo [string...]
The echo command is present both as a shell built-in and as a stand-alone executable which can operate without the availability of the system shell. Both versions behave in a similar manner.
The echo utility writes its arguments, followed by a newline character, to standard output. If there are no arguments, only the newline character is written.
The echo utility currently interprets backslash escape sequences within the string in a fashion similar to the SysV echo command. However, POSIX dictates that the echo utility must not interpret or modify the string in this manner. A future version of echo will not support the interpretation of backslash escape sequences and the use of this feature should be avoided.
The following backslash escape sequences are currently supported within string:
Sequence: | Meaning: |
---|---|
\a | Write an alert character (the bell). |
\b | Write a backspace character. |
\c | Suppress the newline character that otherwise follows the final argument in the output. All characters following the \c in the arguments are ignored. |
\f | Write a form-feed character. |
\n | Write a newline character. |
\r | Write a carriage-return character. |
\t | Write a tab character. |
\v | Write a vertical tab character. |
\\ | Write a backslash character. |
\0num | Write an 8-bit value that is the 1-, 2-, or 3-digit octal number num. |
Echo the string "Hello, Mother\nHello, Father" to the standard output:
echo 'Hello, Mother\nHello, Father'
Note that echo will append a final trailing newline to its output, e.g.:
$ echo 'Hello, Mother\nHello, Father' Hello, Mother Hello, Father $
The echo command writes a modified version of its command-line parameters to standard output. Standard input and standard error are not used.