1
00:00:04,210 --> 00:00:08,170
Now you know that every process has three different data streams.

2
00:00:08,380 --> 00:00:11,170
stdIn stdout and stderr.

3
00:00:11,290 --> 00:00:17,170
And I have just shown you examples of two different processes lls and mkdir.

4
00:00:17,440 --> 00:00:19,780
But now let me answer the question.

5
00:00:19,780 --> 00:00:28,210
How we could distinguish that here is output from stdout data stream and here is output from std error

6
00:00:28,210 --> 00:00:29,080
data stream.

7
00:00:29,350 --> 00:00:30,680
Let me do following.

8
00:00:30,700 --> 00:00:34,030
Let me redirect output from stdout.

9
00:00:34,030 --> 00:00:37,390
Stream this output to the file.

10
00:00:37,480 --> 00:00:39,720
For that you could use following command.

11
00:00:39,730 --> 00:00:45,460
Let me clear terminal and type ls here will be greater than sign like so.

12
00:00:45,460 --> 00:00:48,010
And next comes name of the file.

13
00:00:48,010 --> 00:00:55,240
And let's suppose that I want to create file std out dot txt like so.

14
00:00:55,810 --> 00:00:58,260
Let's now press enter and see what will happen.

15
00:00:58,270 --> 00:00:59,020
Enter.

16
00:00:59,820 --> 00:01:00,450
First.

17
00:01:00,570 --> 00:01:08,430
We don't see any output here in the terminal and that means that output from Stdout data stream from

18
00:01:08,760 --> 00:01:16,620
process was redirected to some other place and this place is actually file stdout dot txt.

19
00:01:17,510 --> 00:01:24,620
Let me have a look at the contents of current folder and here i see new file stdout dot txt.

20
00:01:25,340 --> 00:01:27,690
Let's read contents of this file.

21
00:01:27,710 --> 00:01:31,130
For that we could use command cut type cut.

22
00:01:31,130 --> 00:01:33,200
And next comes name of the file.

23
00:01:33,200 --> 00:01:35,940
We want to read contents from stdout.

24
00:01:35,960 --> 00:01:42,650
Actually I'm able to use step in order to autocomplete file name and let's press enter and see list

25
00:01:42,650 --> 00:01:44,240
of files and folders.

26
00:01:44,510 --> 00:01:52,520
And it is actually a result that was produced by stdout data stream of process.

27
00:01:53,410 --> 00:01:57,130
You see here, Same list of folders as we saw here.

28
00:01:57,160 --> 00:02:03,640
Of course, without any colors, because now we have simply written text rose into the text file.

29
00:02:03,760 --> 00:02:09,639
But list of files and folders is the same as we saw here in this output.

30
00:02:09,970 --> 00:02:18,250
And that's how we were able to redirect output of stdout data stream of specific process to the file.

31
00:02:18,550 --> 00:02:20,620
All right, let me clear our terminal.

32
00:02:20,650 --> 00:02:24,070
Let's list files again and let me remove this file.

33
00:02:24,130 --> 00:02:28,030
Stdout dot txt rm stdout dot txt.

34
00:02:28,390 --> 00:02:30,220
Now this file is absent.

35
00:02:30,550 --> 00:02:35,200
Let's do following action with mkdir command.

36
00:02:35,230 --> 00:02:40,690
Recap that if you don't supply any argument to this command it will produce an error.

37
00:02:41,520 --> 00:02:49,710
And let's do following and let's do the same action as with command greater than sign stdout dot txt.

38
00:02:50,100 --> 00:02:53,820
At the moment this file is absent and let's press enter.

39
00:02:54,840 --> 00:02:56,880
And I see following result.

40
00:02:57,270 --> 00:03:00,510
I see error still here in the terminal.

41
00:03:00,840 --> 00:03:06,930
Let's have a look at contents of current folder and there is such file stdout dot txt.

42
00:03:07,260 --> 00:03:13,020
But if read contents of this file stdout dot txt i see empty file.

43
00:03:13,910 --> 00:03:23,450
And that proves that this text was not produced by stdout data stream of mkdir command.

44
00:03:23,630 --> 00:03:31,760
And now question how we could redirect std error data stream that has actually produced this text and

45
00:03:31,760 --> 00:03:35,150
it was shown here in the terminal to the file.

46
00:03:35,450 --> 00:03:37,700
For that I could use following command.

47
00:03:37,730 --> 00:03:41,210
Let me clear a terminal and type mkdir.

48
00:03:41,390 --> 00:03:47,240
Next comes to next comes greater than sign without any spaces like so.

49
00:03:47,240 --> 00:03:49,220
And then name of the file.

50
00:03:49,220 --> 00:03:53,270
And let's name file std error like so dot txt.

51
00:03:53,810 --> 00:03:55,040
Let's press enter.

52
00:03:55,040 --> 00:03:58,040
And now I see nothing here and it's a good sign.

53
00:03:58,040 --> 00:04:03,110
It means that output from std error data stream was redirected to the file.

54
00:04:03,720 --> 00:04:08,760
Let's have a look at contents of current folder and here is our txt file.

55
00:04:08,760 --> 00:04:09,750
Let's read it.

56
00:04:09,790 --> 00:04:12,210
Cut std r dot txt.

57
00:04:12,540 --> 00:04:17,310
And here is this error that we have seen before in the terminal.

58
00:04:17,339 --> 00:04:21,420
Now it was redirected to std error dot txt file.

59
00:04:21,690 --> 00:04:23,610
And now let me answer the question.

60
00:04:23,610 --> 00:04:25,220
What is two here?

61
00:04:25,230 --> 00:04:26,900
But let me do that in the next lecture.

62
00:04:26,910 --> 00:04:27,540
Bye bye.

