O'Reilly logo

Ubuntu Unleashed 2014 Edition: Covering 13.10 and 14.04,Ninth Edition by Paul Hudson, Andrew Hudson, Matthew Helmke

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using echo

You can do many things with echo, especially with redirection (see below for more about redirecting output). In its simplest use, echo sends whatever you tell it to send to standard output. If you want to repeat text on the screen (useful in a shell script, for example), you would enter the text string in ' marks and see the output below it, like this:

matthew@seymour:~$ echo 'I have the power!'I have the power!

If you want to know the value of a system variable, say TERM, you can enter the variable name and the value will be output, like this:

matthew@seymour:~$ echo $TERMxterm

You can redirect the output of echo into a text file, such as if I wanted to add a new directory ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required