Every command produces output. Normally it appears on the screen. But you can grab that output and pour it into a file instead, using the arrow signs.
Commands in this lesson
echo helloShow the word on screenhello
echo hello > hi.txtPour it into a file (creates or replaces)echo again >> hi.txtAdd another line to the same filecat hi.txtRead what you collectedhello again
💡 Think of it like this
The screen is a bucket you tip out. A file is a bucket you keep. > gets a fresh bucket, >> keeps the old one and adds more.
🐧 Tux tip
Notice that nothing appeared on screen when you used >. The words went into the file, just like water into a bucket.
🔬 The grown-up version
Every process has three streams: stdin (0), stdout (1) and stderr (2). > redirects stdout, 2> redirects errors, and 2>&1 sends both to the same place. That is why command > out.log 2>&1 is such a common line in scripts.
Now you try
This terminal is pretend, so you cannot break anything. Tap a chip or type a command yourself.
Quick check
What is the difference between > and >>?
You run echo hi > note.txt and see nothing. Why?
Finished this one?
Mark it done to collect 30 XP and keep your streak growing.