What is the difference between echo and echo -e?

And which quotes ("" or '') should be used with the echo command? i.e: echo "Print statement" or echo 'Print statement'?

Also, what are the available options that can be used along with echo?


2 Answers 2


echo by itself displays a line of text. It will take any thing within the following "..." two quotation marks, literally, and just print out as it is. However with echo -e you're making echo to enable interpret backslash escapes. So with this in mind here are some examples

INPUT: echo "abc\n def \nghi" 
OUTPUT:abc\n def \nghi

INPUT: echo -e "abc\n def \nghi"

Note: \n is new line, ie a carriage return. If you want to know what other sequences are recognized by echo -e type in man echo to your terminal.

  • 9
    echo is built-in in most shells. man echo will like document the echo standalone command instead. Jul 24, 2016 at 14:01
  • 4
    You're describing the behaviour of GNU echo or the GNU shell's echo when not in Unix conformance mode. Elsewhere, the behaviour will typically be different. Jul 24, 2016 at 14:03
  • I'd like to encourage the community to upvote this answer with hopes that it will reopen the question. 88-)
    – 3kstc
    May 24, 2022 at 23:30

In most of the SHELL echo cant take escape sequence ( \n \t ). Where as echo -e can

echo -e " This is \n an \t example"

Single quote and double quote are mostly for handling the interpolation issues. You may find more details here, Why is echo ignoring my quote characters?

  • 7
    That's the other way round. In most shells (ksh88, ksh93, pdksh, mksh, Bourne, zsh, dash, bash, and the sh of all Unix compliant systems, some of them like ksh93 or bash only in some environments) echo does expand escape sequences. An echo implementation that accepts -e is not POSIX compliant. Jul 24, 2016 at 13:59

Not the answer you're looking for? Browse other questions tagged .