Little Girl's Mostly Linux Blog


Echo vs printf

This page was last updated on April 4, 2012.

This is an observation of the behavior of echo vs printf when used on the command line. This behavior may not cause any issues when used inside a script.

Echo does what you’d expect it to do:
user@computer:~$ echo HELLO
Printf lands inside my prompt:
user@computer:~$ printf HELLO
To get printf to do what echo does takes the addition of the \n code for a newline:
user@computer:~$ printf "HELLO\n"

Obligatory Happy Ending

And they all lived happily ever after. The end.

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI


Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at

%d bloggers like this: