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 ...

Get Ubuntu Unleashed 2014 Edition: Covering 13.10 and 14.04,Ninth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.