1/11

Files & folders · Put words in a file

Print words: echo

echo prints whatever words you give it, back onto the screen.

Why: on its own it's for messages. In a moment you'll use it to write text into files, which is how you'll create files with something in them.

How to type it: echo followed by your words: echo Good morning.

Worked example

learner@shellstreak:~$ echo Good morning
Good morning

What the output means

  • Good morning: echo printed its arguments, the words Good and morning, with one space between them.

Common mistakes

  • Expecting echo to run the words as commands. echo ls just prints the word ls.
  • Expecting extra spaces to survive: echo a b prints a b, because each run of spaces only separates arguments. The next card fixes that.

Tap Run to make the terminal say good morning.

Try it:echo Good morning
learner@shellstreak: ~
Starting your practice shell…

You can also type in the terminal yourself. Try anything: you can't break it.

Go deeper: Basic terminal commands for beginners