echo Linux Commands

Topic

What is Linux echo Command?

Explanation

echo COMMAND:

echo command prints the given input string to standard output.

SYNTAX:


The Syntax is
echo [options..] [string]

OPTIONS:


-n do not output the trailing newline
-e enable interpretation of the backslash-escaped characters listed below
-E disable interpretation of those sequences in STRINGs

Without -E, the following sequences are recognized and interpolated:
NNN the character whose ASCII code is NNN (octal)
a alert (BEL)
backslash
b backspace
c suppress trailing newline
f form feed
n new line
r carriage return
t horizontal tab
v vertical tab

EXAMPLE:


  1. echo command
    echo "hscripts Hiox India"

    The above command will print as hscripts Hiox India
  2. To use backspace:
    echo -e "hscripts bHiox bIndia"

    The above command will remove space and print as hscriptsHioxIndia
  3. To use tab space in echo command
    echo -e "hscriptstHioxtIndia"
    The above command will print as hscriptsHioxIndia