Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I dump a string with hexdump like this 2031 3334 2e30 0a32 2032 3331 302e 000a. It is clear that 0x0a is new line character, however, when I try to echo this string out, I always got 1 430.2 2 13.0 -- the new line is replaced with a space, even I use the -e flag.

What may be the problem? Does the tailing \0 ruin the output? Is there any alternatives to print 0x0a a new line?

Thanks and Best regards.

share|improve this question
when I try to echo this string out How exactly do you do that? What is the exact command you use? –  Dennis Jul 2 '12 at 19:01
@Dennis I mean echo -e. Thanks, I find a solution. –  Summer_More_More_Tea Jul 3 '12 at 2:00

2 Answers 2

up vote 14 down vote accepted

The new line character with the echo command is "\n". Taking the following example:

echo -e "This is line 1\nThis is line 2"

Would result in the output

This is line 1
This is line 2

The "-e" parameter is important here.

share|improve this answer
Thanks. I find a solution. –  Summer_More_More_Tea Jul 3 '12 at 2:01

I finally properly format this string with printf "$string". Thank you all.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.