Introduction
Imagine every Linux command as a machine. Data goes in one side, and the machine processes it. But unlike simple machines that have just one output, a Linux command has two separate chutes for sending things out:
- Standard Output (stdout): The "Good Chute". When the machine works correctly, the finished product comes out here.
- Standard Error (stderr): The "Bad Chute". If something goes wrong, error messages come out here.
By default, both chutes dump their contents onto your screen.
This "stream" model is one of the most important ideas in shell work. Linux commands do not just "print text"; they often produce structured flows of data. Once you understand those flows, redirection and pipelines start to feel logical rather than magical.
In this lab, you will run commands to see these two different streams in action.
Standard Output (stdout)
Let's see the "Good Chute" in action.
We will use ls, which lists files. When ls works, it sends the filenames to Standard Output.
Run this command:
ls -l
You should see a list of files.
What happened?
Because the command ran successfully, the ls program sent the list to the stdout stream. Your terminal watches this stream and displays it.
The key point is that the terminal is only the default destination. Standard output is not tied permanently to the screen, which is why you will soon be able to save or redirect it elsewhere.
Standard Error (stderr)
Now, let's look at the "Bad Chute". Standard Error (stderr) is reserved for errors.
We can force ls to complain by asking it to list a directory that does not exist.
Run this:
ls -l /nonexistent_directory
You will see an error message.
What happened?
The command failed. Instead of stdout, it sent a message to the stderr stream.
Your terminal watches both streams by default, so it prints the error just like normal text.
That is why beginners often assume success messages and error messages are "the same kind of output." They may look similar on screen, but internally they travel through different channels.
Mixed Output
Now, let's see what happens when a command produces both.
We will ask ls to do two things:
- List the current directory
.(works). - List
/fake(fails).
Run this:
ls -l . /fake
Look closely. You should see two parts:
- An error message for
/fake. - A successful list for
..
What happened?
The error came down the stderr pipe. The file list came down the stdout pipe. Your terminal collected both and dumped them onto your screen.
This distinction is crucial. In the next lab, you will learn how to capture stdout while ignoring stderr.
This separation is not just academic. In real automation, scripts often want to save normal results while still letting errors be visible, or capture errors into logs without mixing them with useful data.
Summary
In this lab, you explored "Data Streams" using the two-chute machine analogy:
- Standard Output: The channel for normal results.
- Standard Error: The channel for error messages.
By default, Linux mixes both streams on your screen. Next, you will learn to separate them.



