An ad-free and cookie-free website.
Learn to display text and variables at the Linux command line.
Videos can also be accessed from the Linux Essentials Playlist on YouTube.
Linux echo command summary with examples (4:16)
Our nineteenth word, or command to memorize is
echo from the category
echo allows you to display text and
||Print help screen|
||Disable backslash escape sequences (default)|
||Enable backslash escape sequences|
Recall from the last video (tutorial) we touched on the PATH variable, well here we'll use echo to display that variable.
Before we start, it helps to think about commands as mini programs and
most follow this structure:
command -option(s) argument(s).
echo command has
5 options and the argument is what you'd like to
Like most commands, find help using the double-dash
-E option, the default, disables
baskslash escape keys and
this feature on. I'll demonstrate shortly.
So why is
echo an important command?
Well, we saw how the
cat command in
video #10 prints files.
alternatively, prints text or variables you input.
And now you know how to do that.
Okay, the best way to embed this in your memory is by typing in your own terminal window.
Find this on your Mac using a program called Terminal. On Linux use Terminal or Konsole, and currently Microsoft is adding this functionality to Windows.
Here we go, type
Uh oh, this is a (shell) builtin quirk, so point to the program using
/bin/echo if you have this issue on
And then let's type
echo Paul likes echo.
Good. Next, let's type in double-quotes
echo "Paul likes echo".
echo 'Paul likes echo' like this.
Interesting. Now, let's use the
\n keys translate to
newline. There are a dozen escape sequences in help (above) area to
Then, a variable. Let's assign to the variable x, the word echo. Now, watch this, with a dollar sign, $, there we have that variable.
And then let's see why Paul likes
and quickly view the $PATH environment variable,
showing a colon-separated list of directories Linux searches for
commands. And here, you would type on your end
echo $PATH. And because
$PATH is complex, so I've used the
cat command here to show an example.
Okay now you know how to use
And you know the syntax for commands, options and arguments.
One last tip about the
It's important to learn those escape sequences, so check those out.
Okay, thanks for visiting today. I hope this was a fun introduction
For an overview of the 100 videos, the 8 quizzes, a cheat sheet, the categories and a Q&A section, visit:
Make sure to connect while you're here so you don't lose this valuable ad-free resource.
whichcommand, hit Back.
nano, click Next.
A newly-updated free resource. Connect and refer a friend today.