4.2.15. echo — display text or values of variables#

With the echo command, you can print text or the values of environment variables on the screen.

The basic format of the command is:

echo text_or_variable

Printing text#

To print text on the screen, use echo followed by the text you would like to display.

echo "Hello, This is echo!"


Hello, This is echo!

Printing values of environment variables#

You can also use echo to display values of your environment variables.

For example:

echo $PATH

The $ in PATH indicates, it is a variable.



PATH contains the list of paths (directories) that will be searched for locating programs or commands.

You can set or modify environment variables in your ~/.bashrc.