Now you know that every process has three different data streams.
stdIn stdout and stderr.
And I have just shown you examples of two different processes lls and mkdir.
But now let me answer the question.
How we could distinguish that here is output from stdout data stream and here is output from std error
data stream.
Let me do following.
Let me redirect output from stdout.
Stream this output to the file.
For that you could use following command.
Let me clear terminal and type ls here will be greater than sign like so.
And next comes name of the file.
And let's suppose that I want to create file std out dot txt like so.
Let's now press enter and see what will happen.
Enter.
First.
We don't see any output here in the terminal and that means that output from Stdout data stream from
process was redirected to some other place and this place is actually file stdout dot txt.
Let me have a look at the contents of current folder and here i see new file stdout dot txt.
Let's read contents of this file.
For that we could use command cut type cut.
And next comes name of the file.
We want to read contents from stdout.
Actually I'm able to use step in order to autocomplete file name and let's press enter and see list
of files and folders.
And it is actually a result that was produced by stdout data stream of process.
You see here, Same list of folders as we saw here.
Of course, without any colors, because now we have simply written text rose into the text file.
But list of files and folders is the same as we saw here in this output.
And that's how we were able to redirect output of stdout data stream of specific process to the file.
All right, let me clear our terminal.
Let's list files again and let me remove this file.
Stdout dot txt rm stdout dot txt.
Now this file is absent.
Let's do following action with mkdir command.
Recap that if you don't supply any argument to this command it will produce an error.
And let's do following and let's do the same action as with command greater than sign stdout dot txt.
At the moment this file is absent and let's press enter.
And I see following result.
I see error still here in the terminal.
Let's have a look at contents of current folder and there is such file stdout dot txt.
But if read contents of this file stdout dot txt i see empty file.
And that proves that this text was not produced by stdout data stream of mkdir command.
And now question how we could redirect std error data stream that has actually produced this text and
it was shown here in the terminal to the file.
For that I could use following command.
Let me clear a terminal and type mkdir.
Next comes to next comes greater than sign without any spaces like so.
And then name of the file.
And let's name file std error like so dot txt.
Let's press enter.
And now I see nothing here and it's a good sign.
It means that output from std error data stream was redirected to the file.
Let's have a look at contents of current folder and here is our txt file.
Let's read it.
Cut std r dot txt.
And here is this error that we have seen before in the terminal.
Now it was redirected to std error dot txt file.
And now let me answer the question.
What is two here?
But let me do that in the next lecture.
Bye bye.