WEBVTT - This file was automatically generated by VIMEO

0
00:00:14.300 --> 00:00:15.600
Hello and welcome.

1
00:00:16.500 --> 00:00:19.500
So in this lesson, we are going to learn about some of

2
00:00:19.500 --> 00:00:22.300
 the Linux file and directory commands.

3
00:00:22.300 --> 00:00:25.500
 Now. These are the most important ones

4
00:00:25.500 --> 00:00:28.500
 and you're going to use this very very

5
00:00:28.500 --> 00:00:29.200
 frequently.

6
00:00:30.100 --> 00:00:33.500
So let's quickly begin with the First Command, which is

7
00:00:33.500 --> 00:00:34.800
 the ls command.

8
00:00:35.300 --> 00:00:38.200
So LS stands for list. So let

9
00:00:38.200 --> 00:00:41.600
 us see if I type the command LS and hit enter. What

10
00:00:41.600 --> 00:00:43.200
 is the output that we get?

11
00:00:44.100 --> 00:00:47.500
You will be able to see whatever the content is there

12
00:00:47.500 --> 00:00:50.200
 into your computer. So basically all the

13
00:00:50.200 --> 00:00:53.500
 files and folders which are the directories

14
00:00:53.500 --> 00:00:56.300
 as you can see. These are all the files and folders that

15
00:00:56.300 --> 00:00:58.300
 are into my computer.

16
00:00:59.400 --> 00:01:02.400
Alright, so if you want to see all the files in

17
00:01:02.400 --> 00:01:05.900
 a long listing, which is basically also known

18
00:01:05.900 --> 00:01:08.500
 as in detailed format, so

19
00:01:08.500 --> 00:01:12.100
 we are going to type the command, which is LS space hyphen

20
00:01:11.100 --> 00:01:12.700
 all

21
00:01:14.300 --> 00:01:18.400
And you will be able to see this is the detailed listing

22
00:01:17.400 --> 00:01:20.500
 of a file in which you

23
00:01:20.500 --> 00:01:23.800
 are able to see more information about that file.

24
00:01:24.900 --> 00:01:27.700
For instance just to make a difference if

25
00:01:27.700 --> 00:01:29.600
 it is a file or a folder.

26
00:01:30.400 --> 00:01:33.100
By that I mean if it is a directory, you can

27
00:01:33.100 --> 00:01:36.500
 also see from here. For example, you can

28
00:01:36.500 --> 00:01:39.600
 see this file, which is you want. This is

29
00:01:39.600 --> 00:01:40.900
 a file. How do I know that?

30
00:01:42.300 --> 00:01:45.600
And this UFO net is a folder, which is

31
00:01:45.600 --> 00:01:48.200
 a directory. How do I know that you can see here?

32
00:01:48.200 --> 00:01:52.000
 It is written D. So the file permission.

33
00:01:51.800 --> 00:01:54.300
 These are the file permissions and

34
00:01:54.300 --> 00:01:57.400
 here you can see a d which denotes that

35
00:01:57.400 --> 00:02:01.100
 this is a directory, which means it is a folder

36
00:02:00.100 --> 00:02:03.300
 and you want is a

37
00:02:03.300 --> 00:02:06.100
 file because there is no D. So this is one of

38
00:02:06.100 --> 00:02:10.000
 the way to identify files and folders in

39
00:02:09.500 --> 00:02:12.600
 Linux. Obviously, you can obviously make

40
00:02:12.600 --> 00:02:15.400
 out through this color coding but this is not the

41
00:02:15.400 --> 00:02:18.800
 best way to identify if this are files

42
00:02:18.800 --> 00:02:19.500
 are folders.

43
00:02:20.300 --> 00:02:23.300
In the Linux operating system, so you can

44
00:02:23.300 --> 00:02:26.300
 type the command LS space hyphen a

45
00:02:26.300 --> 00:02:29.600
 l or hyphen a ll and you

46
00:02:29.600 --> 00:02:32.300
 will be able to see the detailed output of

47
00:02:32.300 --> 00:02:35.400
 that file from that you can make a difference if it

48
00:02:35.400 --> 00:02:38.900
 is a file or folder with a lot of more information as

49
00:02:38.900 --> 00:02:40.400
 well as you can see over here.

50
00:02:41.900 --> 00:02:44.400
Which also gives you the information of which is

51
00:02:44.400 --> 00:02:48.000
 the user which has created the group the

52
00:02:47.500 --> 00:02:50.500
 size as well as the date.

53
00:02:51.400 --> 00:02:53.600
When the file was successfully created.

54
00:02:54.500 --> 00:02:57.600
Perfect. Let's move ahead. The next command that

55
00:02:57.600 --> 00:03:01.100
 we are going to see is PWD. So PWD

56
00:03:00.100 --> 00:03:04.400
 stands for present working directory. Now,

57
00:03:03.400 --> 00:03:06.500
 this will show you in which the

58
00:03:06.500 --> 00:03:09.900
 current directory you are. So I'm

59
00:03:09.900 --> 00:03:12.300
 currently working into a directory which is

60
00:03:12.300 --> 00:03:15.300
 slash route. Perfect. So let's

61
00:03:15.300 --> 00:03:18.300
 quickly navigate into a directory for that. We use

62
00:03:18.300 --> 00:03:21.300
 the command which is CD which stands for

63
00:03:21.300 --> 00:03:22.800
 change directory.

64
00:03:23.500 --> 00:03:26.300
So let's change into a directory. And as we

65
00:03:26.300 --> 00:03:29.500
 saw UFO net is a directory because

66
00:03:29.500 --> 00:03:32.300
 we saw there was a D in front of that.

67
00:03:32.300 --> 00:03:35.300
 So let's go into this directory. And now

68
00:03:35.300 --> 00:03:39.100
 you can see we have successfully navigated into

69
00:03:38.100 --> 00:03:41.100
 this directory, which is UFO net.

70
00:03:41.900 --> 00:03:44.200
Also, you can verify that using the

71
00:03:44.200 --> 00:03:47.600
 command which is PWD and hit enter and

72
00:03:47.600 --> 00:03:50.400
 you can see the present working directory is

73
00:03:50.400 --> 00:03:53.800
 slash root slash UFO net.

74
00:03:55.100 --> 00:03:59.300
Perfect. So let's create a directory over here now to

75
00:03:58.300 --> 00:04:01.300
 create a new directory. You have to

76
00:04:01.300 --> 00:04:04.700
 type the command which is mkdir with

77
00:04:04.700 --> 00:04:07.400
 stands for make directory. So

78
00:04:07.400 --> 00:04:10.600
 let's quickly make a directory with the name as Rohit and

79
00:04:10.600 --> 00:04:11.200
 hit enter.

80
00:04:12.100 --> 00:04:12.700
and you can see

81
00:04:13.500 --> 00:04:16.300
there is no output which has displayed onto the

82
00:04:16.300 --> 00:04:16.600
 screen.

83
00:04:17.400 --> 00:04:20.700
But a directory has been successfully created. Let's verify

84
00:04:20.700 --> 00:04:23.200
 using the command LS and you can

85
00:04:23.200 --> 00:04:26.400
 see here the name which is Rohit.

86
00:04:27.600 --> 00:04:30.300
Okay, so far we have been doing

87
00:04:30.300 --> 00:04:33.200
 correct. So let's quickly go into that directory, which is

88
00:04:33.200 --> 00:04:36.400
 CD Rohit. And obviously we have

89
00:04:36.400 --> 00:04:40.000
 created the directory just now therefore the

90
00:04:39.400 --> 00:04:42.600
 directory is empty. Let's verify using

91
00:04:42.600 --> 00:04:45.200
 the command which is LS and you

92
00:04:45.200 --> 00:04:48.400
 can see no output over here. So let's quickly

93
00:04:48.400 --> 00:04:52.100
 create a file. So to create empty file

94
00:04:51.100 --> 00:04:54.200
 you can use the command which is touch.

95
00:04:55.200 --> 00:04:58.600
So basically you are touching a file and creating a

96
00:04:58.600 --> 00:05:01.900
 empty file. So let's say touch one and

97
00:05:01.900 --> 00:05:02.600
 hit enter.

98
00:05:03.400 --> 00:05:06.600
Now let's verify if we have created a

99
00:05:06.600 --> 00:05:10.200
 file. So let's type the command LS and

100
00:05:09.200 --> 00:05:12.500
 you can see there is a file which is

101
00:05:12.500 --> 00:05:15.500
 one but this file is currently

102
00:05:15.500 --> 00:05:18.500
 empty. So let's write some content

103
00:05:18.500 --> 00:05:21.900
 into this file. So for that there are different ways

104
00:05:21.900 --> 00:05:24.300
 to write content into a fight and different

105
00:05:24.300 --> 00:05:27.500
 editors which you can use so I'm going to use a

106
00:05:27.500 --> 00:05:30.300
 editor which is nano. So I'm just going to type the

107
00:05:30.300 --> 00:05:33.900
 command which is nano space the file name in

108
00:05:33.900 --> 00:05:37.600
 which you want to make changes. So Nano

109
00:05:36.600 --> 00:05:39.900
 space one and hit enter and this

110
00:05:39.900 --> 00:05:42.900
 is how it looks like so just remember

111
00:05:42.900 --> 00:05:46.100
 this is like your simple notepad editor

112
00:05:45.100 --> 00:05:49.100
 in which you can write something. So let's

113
00:05:48.100 --> 00:05:52.000
 quickly write. This is my

114
00:05:53.000 --> 00:05:53.400
first

115
00:05:57.200 --> 00:06:00.300
file and let's save this for that you

116
00:06:00.300 --> 00:06:03.000
 can simply type control s and you can

117
00:06:03.100 --> 00:06:06.800
 see it says root one line, press control X.

118
00:06:07.100 --> 00:06:10.400
To come out of that file again. Let's go

119
00:06:10.400 --> 00:06:13.500
 inside that file, press Ctrl s to

120
00:06:13.500 --> 00:06:16.400
 save control X to come out of

121
00:06:16.400 --> 00:06:17.100
 that file.

122
00:06:17.900 --> 00:06:20.300
Now as we have created a file.

123
00:06:21.700 --> 00:06:24.300
Empty file and then we have written content into

124
00:06:24.300 --> 00:06:28.000
 that file. Let's try to verify if we have

125
00:06:27.400 --> 00:06:30.900
 written something into that or no.

126
00:06:30.900 --> 00:06:33.400
 So for that we are going to use the command which is

127
00:06:33.400 --> 00:06:35.300
 cat and hit enter.

128
00:06:35.900 --> 00:06:38.800
And you can see the output of the command

129
00:06:38.800 --> 00:06:41.600
 cat is this is my first

130
00:06:41.600 --> 00:06:44.300
 file and this is what we wrote into

131
00:06:44.300 --> 00:06:45.300
 that file, correct?

132
00:06:46.500 --> 00:06:50.500
Perfect. Now let me clear the screen for you and here

133
00:06:49.500 --> 00:06:52.800
 you can see we have one file. So

134
00:06:52.800 --> 00:06:55.500
 let's make a copy of this file. So

135
00:06:55.500 --> 00:06:58.400
 for that we have to type the command, which is CP.

136
00:06:58.900 --> 00:07:01.800
And the file that you want to copy, so

137
00:07:01.800 --> 00:07:04.900
 we want to copy the file, which is one perfect.

138
00:07:04.900 --> 00:07:07.500
 Now if I hit enter

139
00:07:07.500 --> 00:07:10.900
 you can see we get a error it says missing

140
00:07:10.900 --> 00:07:13.200
 destination because we have

141
00:07:13.200 --> 00:07:16.500
 not specified where we want to paste the file.

142
00:07:16.500 --> 00:07:18.900
 We have just specified the source.

143
00:07:19.700 --> 00:07:19.900
so

144
00:07:20.600 --> 00:07:24.800
where do we need to paste the file? Let's make

145
00:07:23.800 --> 00:07:27.800
 a folder so mkdir

146
00:07:26.800 --> 00:07:29.500
 and let's make a folder named

147
00:07:29.500 --> 00:07:32.700
 as shifa and hit enter and you

148
00:07:32.700 --> 00:07:35.200
 can see here. We have a directory which is

149
00:07:35.200 --> 00:07:38.200
 shifa and we have a file which is one.

150
00:07:39.100 --> 00:07:42.700
Let's make one more directory called as Sabah and

151
00:07:42.700 --> 00:07:45.400
 hit enter now we have a

152
00:07:45.400 --> 00:07:46.400
 file which is one.

153
00:07:47.200 --> 00:07:50.400
Which has the content. This is my first file

154
00:07:50.400 --> 00:07:53.900
 and we have to empty directories. So

155
00:07:53.900 --> 00:07:57.400
 let's quickly copy the file one into shifa

156
00:07:56.400 --> 00:07:59.200
 and hit enter.

157
00:08:00.200 --> 00:08:03.500
And you can see here is the file and there should

158
00:08:03.500 --> 00:08:06.600
 be a file inside the directory, which is she far.

159
00:08:06.600 --> 00:08:09.200
 So, let's quickly go into the directory by the

160
00:08:09.200 --> 00:08:10.400
 command CD.

161
00:08:11.300 --> 00:08:14.300
space the directory in which I want to

162
00:08:14.300 --> 00:08:16.900
 navigate and hit enter and

163
00:08:18.300 --> 00:08:21.100
Let's check the present working directory. Yes, we are

164
00:08:21.100 --> 00:08:24.200
 into the directory, which is shifa. Let's verify if there

165
00:08:24.200 --> 00:08:27.700
 is a file and yes, there is a file. Let's verify

166
00:08:27.700 --> 00:08:30.500
 the content. It should be the same that we have created

167
00:08:30.500 --> 00:08:33.400
 and you can see it is exactly the

168
00:08:33.400 --> 00:08:36.400
 same content with says this is my

169
00:08:36.400 --> 00:08:37.400
 first file.

170
00:08:38.300 --> 00:08:38.700
awesome

171
00:08:39.800 --> 00:08:40.500
So let's go back.

172
00:08:42.200 --> 00:08:45.400
By the command which is CD dot dot. So when you

173
00:08:45.400 --> 00:08:48.200
 type the command CD dot dot we are going to go

174
00:08:48.200 --> 00:08:51.900
 one step back. So currently we are into this directory shifa

175
00:08:51.900 --> 00:08:54.500
 and when we hit enter

176
00:08:54.500 --> 00:08:58.000
 we should be able to navigate one step

177
00:08:57.100 --> 00:09:00.600
 back into this directory, which is Rohit.

178
00:09:01.500 --> 00:09:05.200
So let me hit enter and you can see now. I'm

179
00:09:04.200 --> 00:09:07.800
 into this directory which is Rohit.

180
00:09:10.700 --> 00:09:13.500
Okay, perfect. So now we have created

181
00:09:13.500 --> 00:09:16.500
 a file inside the directory which

182
00:09:16.500 --> 00:09:19.200
 is shifa. So basically we have copied it.

183
00:09:19.200 --> 00:09:22.500
 Now. Let's try to delete this file, which

184
00:09:22.500 --> 00:09:25.800
 is one. So for that the command is RM which

185
00:09:25.800 --> 00:09:28.900
 stands for remove. So remove one

186
00:09:28.900 --> 00:09:29.900
 hit enter.

187
00:09:30.700 --> 00:09:33.900
And you can see the file has been successfully removed.

188
00:09:34.300 --> 00:09:37.200
Let's quickly remove a directory as well. So

189
00:09:37.200 --> 00:09:40.400
 let's say we remove the directory which is Sabah. So

190
00:09:40.400 --> 00:09:42.400
 RM space Sabah and hit enter.

191
00:09:43.400 --> 00:09:46.700
And you can see it gave an error. It

192
00:09:46.700 --> 00:09:49.300
 says it's a directory. Okay, so we

193
00:09:49.300 --> 00:09:52.900
 cannot remove a directory by simply typing the

194
00:09:52.900 --> 00:09:55.400
 command RM. So let's remove the

195
00:09:55.400 --> 00:09:59.600
 directory with the command, which is RM dir.

196
00:09:58.600 --> 00:10:01.400
 So RM to

197
00:10:01.400 --> 00:10:04.600
 delete a file RM dir to remove

198
00:10:04.600 --> 00:10:07.600
 a directory and let's hit enter and you

199
00:10:07.600 --> 00:10:11.500
 can see we got no error and we have successfully deleted

200
00:10:10.500 --> 00:10:12.600
 the directory.

201
00:10:13.400 --> 00:10:16.500
And you can see there is no one there is no

202
00:10:16.500 --> 00:10:20.200
 subah so let's delete the shifa

203
00:10:19.200 --> 00:10:22.400
 directory as well. So we have used

204
00:10:22.400 --> 00:10:25.600
 the command which is rmdir and let's

205
00:10:25.600 --> 00:10:27.800
 type the name shifa and hit enter.

206
00:10:28.500 --> 00:10:31.600
Now this time we got a different error. It says

207
00:10:31.600 --> 00:10:34.900
 the directory, not empty. Perfect. So

208
00:10:34.900 --> 00:10:37.900
 now we came to know that we cannot delete

209
00:10:37.900 --> 00:10:41.200
 a directory which has something inside

210
00:10:40.200 --> 00:10:46.100
 it with the command rmdir rmdir

211
00:10:44.100 --> 00:10:47.700
 is only used to

212
00:10:47.700 --> 00:10:50.300
 delete empty directories. Perfect.

213
00:10:51.600 --> 00:10:54.600
So, how do we actually delete this now? It's

214
00:10:54.600 --> 00:10:57.700
 very simple RM space hyphen r

215
00:10:57.700 --> 00:11:00.100
 f and we want

216
00:11:00.100 --> 00:11:03.500
 to delete the directory which is shifa. So remove

217
00:11:03.500 --> 00:11:06.900
 recursively forcefully whatever you

218
00:11:06.900 --> 00:11:09.600
 want to remove you can remove a file you can

219
00:11:09.600 --> 00:11:12.600
 remove empty directory or you can delete a

220
00:11:12.600 --> 00:11:15.600
 directory which has content inside it using

221
00:11:15.600 --> 00:11:19.100
 this command which is RM space hyphen RF.

222
00:11:18.100 --> 00:11:21.100
 Let's hit enter and you can

223
00:11:21.100 --> 00:11:24.300
 see it's gone. Everything is deleted from here.

224
00:11:25.200 --> 00:11:28.300
So I hope you guys understood how you can use

225
00:11:28.300 --> 00:11:29.100
 this command.

226
00:11:30.100 --> 00:11:33.500
Alright, so this is it for this video. Let's go ahead and

227
00:11:33.500 --> 00:11:35.700
 see you into the next lesson. Thank you.
