Module 3 · Lesson 1 of 26/11 in the course~21 min
Module lessons (1/2)
Output and redirects (echo, cat, >)
Lesson preview5 hands-on exercises readyLinux Terminal · Module 3 — Streams, Redirects, and Filters
Print messages, inspect files, and save output by overwriting (>) or appending (>>).
What you'll learn in this lesson
- Distinguish the three standard POSIX streams: stdin (0), stdout (1), and stderr (2).
- Write and concatenate text in files with
echo,cat,>(overwrite), and>>(append). - Avoid accidental file loss caused by early truncation of the
>operator.
Overview
Almost every Linux command reads incoming bytes from stdin, produces normal results on stdout, and reports errors on stderr. By default stdout and stderr both print to the terminal screen, but the shell lets you divert them to any file.
If greetings.txt does not exist it is created; if it already existed, it is emptied before echo even writes the first letter.
Sections covered in this lesson
- 1The three standard flows and redirect operators
- 2Progressive examples
- 3Practical exercises
- 4Quick check
Pro Lesson · Module 3 — Streams, Redirects, and Filters
Unlock "Output and redirects (echo, cat, >)" and the full Linux Terminal curriculum
Print messages, inspect files, and save output by overwriting (>) or appending (>>).
Unlock all 5 hands-on exercises in this lesson plus every advanced WebAssembly module with automated checks.
- Instant access to all advanced modules in Linux Terminal plus 17 more courses
- Hands-on browser exercises with automated test suites and solutions
- 14-day money-back guarantee processed via Paddle.com
14-day guarantee · Cancel anytimeModule 1, all 18 interactive games, and cheatsheets are always free.