1
00:00:00,750 --> 00:00:08,430
OK, so if we know how to find our way to the desired directory in terminal, but what if we need to

2
00:00:08,430 --> 00:00:13,560
create a file or a subfolder in another directory, how can we do that?

3
00:00:14,370 --> 00:00:16,400
Well, first, let's open up our terminal.

4
00:00:17,010 --> 00:00:21,210
And by the way, another way that you can open terminal instead of.

5
00:00:21,210 --> 00:00:21,450
Right.

6
00:00:21,450 --> 00:00:29,220
Clicking and going open terminal here, he's going up here to this icon which says terminal emulator

7
00:00:29,430 --> 00:00:31,140
and clicking on it.

8
00:00:32,590 --> 00:00:39,220
By default, this will be inside of your home directory, which we know to be designed, and if we type

9
00:00:39,240 --> 00:00:43,750
the public comment, we get slash home slash Mr. Hacker directory.

10
00:00:44,490 --> 00:00:47,800
We know that our desktop directorate is also inside of this directory.

11
00:00:47,920 --> 00:00:51,640
So let's go there, see the desktop press enter.

12
00:00:52,090 --> 00:00:54,400
And now we are in the desktop directory.

13
00:00:55,370 --> 00:01:03,380
Let's get back to the files to create a simple empty file, we can use a command called Touch if we

14
00:01:03,380 --> 00:01:07,940
simply just type touch file and let's call it file one.

15
00:01:09,140 --> 00:01:16,040
Press enter, this will create a file named file one, and it will have no contents inside of it.

16
00:01:17,170 --> 00:01:23,260
We can also see that file one has been created as it is right now on our desktop since we created it

17
00:01:23,260 --> 00:01:25,450
inside of this desktop directory.

18
00:01:26,320 --> 00:01:33,070
And if we also type, unless we can see that the file is in our desktop directory to make sure this

19
00:01:33,070 --> 00:01:36,970
file is indeed empty, we can use the command cat.

20
00:01:37,600 --> 00:01:44,720
And this command, once executed on the file, writes out all the contents that are inside of that file.

21
00:01:45,460 --> 00:01:50,260
Let's try it out so we specify CAT and then file one.

22
00:01:52,070 --> 00:01:58,970
Press enter, and this will give no results since, as we already mentioned, the touch command creates

23
00:01:58,970 --> 00:01:59,990
empty files.

24
00:02:00,950 --> 00:02:06,220
If we want to, for example, put something inside of that file, we can use a command echo.

25
00:02:06,830 --> 00:02:09,010
You simply just typed it like this echo.

26
00:02:09,470 --> 00:02:18,460
And to put something you specify after the echo, let's say today is a really good day.

27
00:02:18,830 --> 00:02:21,500
So we specified an entire sentence.

28
00:02:21,890 --> 00:02:27,920
And all we need to do is to put this sentence inside of this file is to specify this arrow to the right.

29
00:02:28,940 --> 00:02:35,930
And after it, specify the name of the file that we want to put this sentence in, so Echo today is

30
00:02:35,930 --> 00:02:37,930
a really good day into the file.

31
00:02:37,940 --> 00:02:44,480
One press enter and if we catch it once again with the cat comment.

32
00:02:45,380 --> 00:02:46,610
So Cat fight one.

33
00:02:48,360 --> 00:02:55,200
We will see that now it outputs exactly what we've written to that file using the Echo comment, OK,

34
00:02:55,210 --> 00:02:55,980
that's all good.

35
00:02:55,980 --> 00:02:59,850
But there is an easier way and more practical way to do all of this.

36
00:03:00,690 --> 00:03:07,170
We can use a text editor to write things inside of a file and an easy text editor that we can run from

37
00:03:07,170 --> 00:03:09,110
terminal is called Nannerl.

38
00:03:09,630 --> 00:03:12,990
So let's try to do the same thing we just did using Nano.

39
00:03:13,960 --> 00:03:20,650
If we type now and after nine 00 comes the name of the file that you want to edit, and since we want

40
00:03:20,650 --> 00:03:26,230
to edit our new file that we haven't created yet, we can simply just type name let's call it file two

41
00:03:26,620 --> 00:03:32,530
and press enter this will open this empty window where we can type anything we want.

42
00:03:33,190 --> 00:03:39,370
We can type file content here and it can be anything we can type, for example, text here, but we

43
00:03:39,370 --> 00:03:41,580
could also type code if we wanted to.

44
00:03:42,420 --> 00:03:43,870
Let's start with text first.

45
00:03:44,380 --> 00:03:48,520
Let's write just the World as a text.

46
00:03:49,610 --> 00:03:58,550
To save this, we press control OAP together, then enter to save under this name and then control X

47
00:03:59,000 --> 00:04:00,080
exit the NENO Ed.

48
00:04:01,120 --> 00:04:08,350
If we know type cat and then filed to and by the way, we can notice that file too has been created

49
00:04:08,890 --> 00:04:10,990
along file one on our desktop.

50
00:04:11,880 --> 00:04:13,380
But if we can file to.

51
00:04:15,100 --> 00:04:18,010
We can see the output of Hello World.

52
00:04:19,040 --> 00:04:24,800
So we managed to do it only using one tool, which is now, instead of using two tools which are touch

53
00:04:24,800 --> 00:04:29,360
and echo, but I also mentioned we can do the same thing with programs.

54
00:04:29,840 --> 00:04:34,560
For example, how can we create Python program using nano and terminal?

55
00:04:35,360 --> 00:04:42,520
First, we need to open a file, so let's type NENO and then file free dot vi.

56
00:04:43,160 --> 00:04:50,420
And in this case we add dot p y because that is an extension for Python programs.

57
00:04:51,740 --> 00:04:57,710
Then inside of it, after pressing enter, we're going to run a simple command, which is print.

58
00:04:58,790 --> 00:05:02,120
And then hello, world between the quote.

59
00:05:03,460 --> 00:05:10,960
And you will see that some stuff changes colors, this is because the Nano editor recognizes this as

60
00:05:10,960 --> 00:05:12,140
a Python program.

61
00:05:12,910 --> 00:05:18,040
What we did right here, in case you're not familiar with Python, is we just ran a simple function

62
00:05:18,220 --> 00:05:21,970
that will print out the string that is in between the quote.

63
00:05:22,570 --> 00:05:27,360
So this will just print out how world let's save it with control.

64
00:05:27,380 --> 00:05:30,670
OK, then press enter and then control exit.

65
00:05:31,330 --> 00:05:35,180
And luckily for us, Python is already installed in clinics.

66
00:05:35,680 --> 00:05:40,530
So all we need to do to run this program is to type python free.

67
00:05:40,780 --> 00:05:44,440
And then the name of the file file three dot by.

68
00:05:45,410 --> 00:05:50,040
Press enter and the program will execute here it printed out.

69
00:05:50,060 --> 00:05:52,150
Hello, world cool, right?

70
00:05:53,000 --> 00:05:57,540
You will also notice that the icon is different than these two icons.

71
00:05:58,490 --> 00:06:02,680
This is also, once again, because this is recognized as a python program.

72
00:06:03,380 --> 00:06:04,820
It even has the Python icon.

73
00:06:06,110 --> 00:06:12,980
Now that we know how to create false and execute Python programs, the next question would be how can

74
00:06:12,980 --> 00:06:14,240
we create the rectories?

75
00:06:15,200 --> 00:06:21,560
To create a directory, we can use the command mkdir, which stands for Make Directorate.

76
00:06:22,900 --> 00:06:27,520
To check it out, let us front and Kadir and name of the rectory folder.

77
00:06:28,600 --> 00:06:35,830
So press enter and if I type, yes, we will see that we got our files as well as a directory, which

78
00:06:35,830 --> 00:06:38,680
is a different color and it is called folder.

79
00:06:39,730 --> 00:06:46,540
Remember, we differentiate them by color and also if we try to change the rectory to the folder, it

80
00:06:46,540 --> 00:06:47,050
will work.

81
00:06:47,230 --> 00:06:50,700
It will even give us the path of slash desktop slash folder.

82
00:06:51,400 --> 00:06:52,970
Great in that folder.

83
00:06:52,990 --> 00:06:54,790
You can do pretty much anything you want.

84
00:06:55,120 --> 00:06:59,690
You can create sub folders or create files, whatever you want to do.

85
00:06:59,800 --> 00:07:06,880
You can to move, for example, our Python program from the desktop directory to our folder directory.

86
00:07:07,060 --> 00:07:10,350
We can use Command and V, which stands for both.

87
00:07:11,580 --> 00:07:13,880
We must first navigate back to that subdirectory.

88
00:07:13,990 --> 00:07:22,260
Let's do it using CD and then two dots to go one directory back and from it we run the command and we

89
00:07:22,830 --> 00:07:26,160
file three people into the folder.

90
00:07:26,430 --> 00:07:27,680
So we specify move.

91
00:07:28,230 --> 00:07:34,440
Then the second parameter is what we want to move, which in our case is file three, the P, and the

92
00:07:34,440 --> 00:07:37,480
last parameter is where we want to move it.

93
00:07:37,500 --> 00:07:44,330
We want to move it inside of our folder, suppress your enter and you will notice that the file tree,

94
00:07:44,340 --> 00:07:46,770
that pie disappeared from our.

95
00:07:46,860 --> 00:07:47,730
That's the directory.

96
00:07:48,720 --> 00:07:55,800
We can also check that Taiping else and notice that our Python program is no longer here, but if we

97
00:07:55,800 --> 00:08:01,320
go to the folder directory Antipolice here, we will see it here because we moved it.

98
00:08:01,530 --> 00:08:09,900
Here it is file three that by now this is a handy comment and you will use it a lot besides moving the

99
00:08:09,900 --> 00:08:10,290
file.

100
00:08:10,530 --> 00:08:15,900
We also want to see how we can copy a file and we can do it using this comment.

101
00:08:16,920 --> 00:08:22,530
This does the exact same thing as move command, but it doesn't move it from original directorate to

102
00:08:22,530 --> 00:08:24,920
desired directory, it just copies it.

103
00:08:25,530 --> 00:08:29,910
So let's try to copy file three that P y and call it file for that by.

104
00:08:30,910 --> 00:08:35,050
If I typed CP, which stands for copy file three would be.

105
00:08:36,660 --> 00:08:40,240
And I type file for that pie right after it.

106
00:08:41,010 --> 00:08:46,710
This will create an exact copy of our file in the same directory if I press enter.

107
00:08:48,410 --> 00:08:55,580
Type, here it is, we got filed three to three and filed for the pivo, if we want to change whether

108
00:08:55,580 --> 00:09:01,760
they are exactly the same, we can catch the content of file three to three and get the content of file

109
00:09:01,760 --> 00:09:02,450
for the copyright.

110
00:09:02,810 --> 00:09:05,780
And we can see they're both the same Python programs.

111
00:09:07,180 --> 00:09:12,350
And last comment that we want to cover regarding Falls is the command and.

112
00:09:13,380 --> 00:09:19,770
This command deletes files and directories and let's say we try to delete files for the FBI, that is

113
00:09:19,770 --> 00:09:21,700
our copy of our Python program.

114
00:09:22,620 --> 00:09:26,610
We can do it by typing our name and then file for that by.

115
00:09:27,520 --> 00:09:32,920
Now, be careful with this common sense, once you delete the file, there is no trash bin where you

116
00:09:32,920 --> 00:09:34,800
can retrieve it, it is gone.

117
00:09:35,870 --> 00:09:41,800
If I type enter antipolice, you will see our file for the P is no longer there.

118
00:09:42,880 --> 00:09:45,430
OK, but how do we delete a directory?

119
00:09:46,710 --> 00:09:55,080
Let's first create a directory inside of our folder directory, and to do that we type mkdir and let's

120
00:09:55,080 --> 00:10:00,480
call it folder to folder to is a subdirectory of our folder if I type.

121
00:10:01,020 --> 00:10:01,740
Here it is.

122
00:10:02,660 --> 00:10:09,770
And let's say we did create this directory by mistake and we want to delete it, can we use our M folder

123
00:10:09,770 --> 00:10:10,130
to.

124
00:10:11,190 --> 00:10:12,600
Well, we can try it.

125
00:10:14,460 --> 00:10:20,880
Hmm, cannot remove all or two, and it will tell us that it is a directory, so how do we delete it?

126
00:10:21,480 --> 00:10:25,440
Well, we'll remove it in the same way we remove files.

127
00:10:25,650 --> 00:10:28,070
We just add an option at the end of the comment.

128
00:10:28,470 --> 00:10:36,060
So type our M folder, too, and then at the end, add space and then dash part.

129
00:10:37,310 --> 00:10:44,360
Press enter and this will delete our directory also double check what you're deleting with this common

130
00:10:44,360 --> 00:10:44,750
sense.

131
00:10:44,750 --> 00:10:50,990
If you go to our directory, which is directory containing all folders and files in system, and if

132
00:10:50,990 --> 00:10:59,180
we were to type, for example, in that directory, ah, and then the stop sign and then there are this

133
00:10:59,180 --> 00:11:03,640
command for delete in park Linux machine with all of its files.

134
00:11:04,460 --> 00:11:05,930
So always pay attention.

135
00:11:06,140 --> 00:11:09,800
What exactly are you deleting in Linux and from which the rectory.

136
00:11:09,830 --> 00:11:12,980
Are you deleting sins inside of the Linux.

137
00:11:12,980 --> 00:11:15,650
You will not be stopped in deleting anything you want.

138
00:11:16,160 --> 00:11:21,900
You can easily delete a crucial file for the operating system and make your clinic's machine unworkable.

139
00:11:22,400 --> 00:11:25,610
That is also a reason why we are practicing with virtual machine.

140
00:11:26,830 --> 00:11:32,240
So let's whoops, I actually ran this and you will notice that the results of this comment, if I type

141
00:11:32,240 --> 00:11:35,140
ls now over folder is completely empty.

142
00:11:35,770 --> 00:11:38,170
So I actually ran this by mistake.

143
00:11:38,170 --> 00:11:43,930
And keep in mind, if I actually ran this from this directory, which is our route directly, I would

144
00:11:43,930 --> 00:11:46,630
delete entire clinic system for now.

145
00:11:46,780 --> 00:11:50,410
It is good since I only deleted our Python program, so it is not a big deal.

146
00:11:51,250 --> 00:11:51,970
OK, great.

147
00:11:52,430 --> 00:11:54,480
We learned a bunch of the commands in this lecture.

148
00:11:54,940 --> 00:12:01,150
Now I got the practice test for you that you can try to do for the next lecture inside of our folder

149
00:12:01,150 --> 00:12:03,610
directory since I deleted my Python program.

150
00:12:04,000 --> 00:12:06,850
I want you to create the file trade API once again.

151
00:12:07,570 --> 00:12:09,750
You can type anything you want inside of it.

152
00:12:09,760 --> 00:12:12,580
You can use the print hello world statement that we used.

153
00:12:12,910 --> 00:12:19,690
And what I want you to do using the commands you learned in this video is to copy that file in the desktop

154
00:12:19,690 --> 00:12:22,090
directory from our folder directory.

155
00:12:22,420 --> 00:12:28,180
So you created inside this directory and I want you to copy it back to the desktop directory.

156
00:12:29,090 --> 00:12:35,310
A hint is that it can be a little tricky once you copy files from some directory to directory anyways,

157
00:12:35,330 --> 00:12:39,170
just try it and we're going to see the solution in the next video.
