The echo is a built-in Linux command for printing text in the terminal. By default, this command adds a new line character. In some cases, it can be undesirable result. This tutorial shows how to print text using echo command without new line in Linux.
echo command supports
-n option that allows to print text in the terminal without new line.
echo -n 'Hello world'
In some Linux distributions, the
echo command has different implementation and
-n option doesn't work or prints text with new line. In such case,
printf command can be used. By default, command doesn't add the new line.
printf 'Hello world'