Saving your work
Output doesn't have to go to the screen:
cmd > FILEwrites the output into FILE, replacing whatever was there.cmd >> FILEappends to the end of FILE.
The redirect applies to the end of the whole pipeline:
grep alice guild.log > alice.txt
grep bob guild.log >> alice.txt
sort names.txt | uniq > roster.txt
cat roster.txt
Careful: > doesn't ask before it overwrites. sort names.txt > names.txt empties the file before sort even reads it. (Your lab is safe to break, and lab reset restores it.)
Real world: command > output.txt 2>&1 saves both normal output and errors, which is how cron jobs keep their logs.