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 morningWhat the output means
Good morning:echoprinted its arguments, the wordsGoodandmorning, with one space between them.
Common mistakes
- Expecting
echoto run the words as commands.echo lsjust prints the wordls. - Expecting extra spaces to survive:
echo a bprintsa 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 morninglearner@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