What Does echo Command Do In Unix?

The Unix operating system provides echo command in order to display some text or string in the terminal. The echo command is generally used to print variables into the terminal. Also, Linux distributions like Debian, Kali, RedHat, Fedora, Ubuntu, etc. support the echo command by default.

echo String In Unix

We can print some strings to the terminal or standard output. This can be useful to provide information while executing some bash scripts. In the following example, we print the information “Currently Installing”.

$ echo "Currently Installing"

echo Variable Value In Unix

Another powerful side of the echo command is the ability to print variable values. The variables are provided with the $ sign. In the following example, we print the variable $name to the terminal.

$ echo $name

Do Not Print Trailing New Line In Unix

By default the echo command prints new line after printing the text. This is very useful to make things more human-readable and tidy. But we can prevent and not print trailing new lines by using the -n option.

$ echo -n "Hello"

Leave a Comment