FreeKB - Linux Commands echo (print output)
Linux Commands - echo (print output)

The echo and printf commands are used to print text. In this example, the echo command is used to print Hello World.

echo "Hello World"


Escape back slashes

By default, the echo command will print back slashes.

~]# echo "Hello\tWorld"


The -e option can be used to escape back slashes. In this example, by escaping back slash, \t is properly interpreted as a tab.

~]# echo -e "Hello\tWorld"
Hello    World


In this example, \n is properly interpreted as a new line.

~]# echo -e "Hello\nWorld"


Do not print new line

The -n option can be used to not print a new line at the end of the output.

~]# echo -n "Hello World"


Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

Please enter 51e7f in the box below so that we can be sure you are a human.


Web design by yours truely - me, myself, and I   |   |