Display a line of text.
echo [SHORT-OPTION]... [STRING]... echo LONG-OPTION
-n do not output the trailing newline -e enable interpretation of backslash escapes -E disable interpretation of backslash escapes (default)
If -e is in effect, the following sequences are recognized: \\ backslash \a alert (BEL) \b backspace \c produce no further output \e escape \f form feed \n new line \r carriage return \t horizontal tab \v vertical tab \0NNN byte with octal value NNN (1 to 3 digits) \xHH byte with hexadecimal value HH (1 to 2 digits)
echo command can change font style, background color of fonts and font colors. Escape sequence \033 can be used to alter font properties. -e option has to be used in order to the escape sequence be in effect. Various escape codes are as follows:
Example: 1echo -e "\033[31mHello Visitor\033[0m" The above command would print "Hello Visitor" in red color.
Example: 2echo -e "\033[1m\033[41mHello Visitor\033[0m" The above command would print "Hello Visitor" in bold style and red background color.
[eleiss@eleiss ~]$ echo "Eleiss Linux Resources" Eleiss Linux Resources [eleiss@eleiss ~]$
Echo prints the string given as argument on standard output.
[eleiss@eleiss ~]$ echo -e "Eleiss\vLinux\vResources" Eleiss Linux Resources [eleiss@eleiss ~]$
Escape sequences can be used to format the output on standard output.
[eleiss@eleiss ~]$ os=Linux [eleiss@eleiss ~]$ echo "I use $os" I use Linux [eleiss@eleiss ~]$
A variable "OS" has been assigned value "Linux" which is accessed by preceding a "$" sign to the variable name.
[nicks@patroclus ~]$ echo "time pass" time pass [nicks@patroclus ~]$This is a time pass example. Do not forget to delete it.
You may write to email@example.com for any Linux related queries.