All language subtitles for Linux Full Course - 10 Hours [2025] Linux Tutorial For Beginners Linux Training Edureka Live [English (auto-generated)] [DownloadYoutubeSubtitles.com]
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:09,760 --> 00:00:14,480
Hello everyone and welcome to the Linux
2
00:00:12,000 --> 00:00:16,640
full course. In this course, you will
3
00:00:14,480 --> 00:00:18,320
start with the fundamentals of Linux
4
00:00:16,640 --> 00:00:20,080
exploring the different shells and
5
00:00:18,320 --> 00:00:22,480
learning how to set up Linux using
6
00:00:20,080 --> 00:00:24,640
virtual box. We will then move into
7
00:00:22,480 --> 00:00:27,039
hands-on commands on Ubuntu and
8
00:00:24,640 --> 00:00:29,599
understand how Linux is used in DevOps
9
00:00:27,039 --> 00:00:32,000
workflows. We will cover the Linux file
10
00:00:29,599 --> 00:00:34,160
system, package management, and even
11
00:00:32,000 --> 00:00:37,040
dive into administration tasks like
12
00:00:34,160 --> 00:00:39,520
configuring a DNS server. You will also
13
00:00:37,040 --> 00:00:42,320
learn shell scripting and discover tools
14
00:00:39,520 --> 00:00:44,399
like shell GPT to enhance productivity.
15
00:00:42,320 --> 00:00:46,320
So before wrapping up, we will cover
16
00:00:44,399 --> 00:00:47,760
Linux interview question and answers to
17
00:00:46,320 --> 00:00:50,079
help you prepare for real world
18
00:00:47,760 --> 00:00:51,600
opportunities. So before we begin,
19
00:00:50,079 --> 00:00:53,760
please like, share and subscribe to
20
00:00:51,600 --> 00:00:56,000
Edureka's YouTube channel and hit the
21
00:00:53,760 --> 00:00:58,719
bell icon to stay updated on the latest
22
00:00:56,000 --> 00:01:00,960
content from Edureka. Also do check out
23
00:00:58,719 --> 00:01:03,199
Edureka's DevOps certification training
24
00:01:00,960 --> 00:01:05,439
course with Genai designed to equip
25
00:01:03,199 --> 00:01:07,920
learners with the skills to master AI
26
00:01:05,439 --> 00:01:09,840
integrated DevOps across the entire
27
00:01:07,920 --> 00:01:11,680
software delivery life cycle. And
28
00:01:09,840 --> 00:01:13,600
through hands-on learning, you will gain
29
00:01:11,680 --> 00:01:16,720
expertise in building intelligent,
30
00:01:13,600 --> 00:01:18,400
automated, and secure CI/CD pipelines.
31
00:01:16,720 --> 00:01:20,880
This comprehensive course covers
32
00:01:18,400 --> 00:01:24,159
essential tools like Git, Genkins,
33
00:01:20,880 --> 00:01:26,320
Terraform, Enible, Docker, Kubernetes
34
00:01:24,159 --> 00:01:29,119
and monitoring frameworks while also
35
00:01:26,320 --> 00:01:32,000
integrating AIdriven solutions for code
36
00:01:29,119 --> 00:01:33,600
generation, testing and analytics. So do
37
00:01:32,000 --> 00:01:36,479
check out the course link given in the
38
00:01:33,600 --> 00:01:38,640
description box below. And now let us
39
00:01:36,479 --> 00:01:41,360
get started with our first topic that is
40
00:01:38,640 --> 00:01:43,920
fundamentals of Linux.
41
00:01:41,360 --> 00:01:45,920
>> Why did Linux become popular? Well uh
42
00:01:43,920 --> 00:01:47,280
before I talk about uh you know why they
43
00:01:45,920 --> 00:01:49,759
became popular let's look at the birth
44
00:01:47,280 --> 00:01:51,920
of Linux how things started off okay so
45
00:01:49,759 --> 00:01:53,280
back in 1969 there was this person
46
00:01:51,920 --> 00:01:55,439
called uh you know in fact there were
47
00:01:53,280 --> 00:01:57,520
two people Dennis and Ken Thompson right
48
00:01:55,439 --> 00:01:59,439
so they were working in the AT&T Bell
49
00:01:57,520 --> 00:02:01,520
Labs and what they did was they created
50
00:01:59,439 --> 00:02:03,520
this C programming right so we're all
51
00:02:01,520 --> 00:02:04,799
aware of programming right so we're all
52
00:02:03,520 --> 00:02:06,799
aware of these basic programming
53
00:02:04,799 --> 00:02:08,720
languages right so C is one of the most
54
00:02:06,799 --> 00:02:10,160
basic and one of the most effective and
55
00:02:08,720 --> 00:02:12,640
the root of all the other programming
56
00:02:10,160 --> 00:02:14,800
languages so that was C and it was them
57
00:02:12,640 --> 00:02:16,640
that developed C and the Unix operating
58
00:02:14,800 --> 00:02:19,440
system. So that was what happened in
59
00:02:16,640 --> 00:02:20,720
1969. Okay. And then in the decade that
60
00:02:19,440 --> 00:02:23,280
followed. Okay. So basically in the
61
00:02:20,720 --> 00:02:24,879
1970s people started developing or
62
00:02:23,280 --> 00:02:26,640
contributing to the development of these
63
00:02:24,879 --> 00:02:28,160
two things. Okay. So they started
64
00:02:26,640 --> 00:02:29,599
contributing to the development of the C
65
00:02:28,160 --> 00:02:31,520
programming language and the Unix
66
00:02:29,599 --> 00:02:33,280
operating system. So in our session
67
00:02:31,520 --> 00:02:35,120
we'll discuss more on Unix operating
68
00:02:33,280 --> 00:02:36,720
system and uh since it's about Linux,
69
00:02:35,120 --> 00:02:39,040
right? So Unix is basically the mother
70
00:02:36,720 --> 00:02:41,120
of Linux because uh Linux is based on
71
00:02:39,040 --> 00:02:43,040
the Unix operating system. Okay, I'll
72
00:02:41,120 --> 00:02:44,319
tell you how that's the case uh in some
73
00:02:43,040 --> 00:02:45,920
more time but that's why we are starting
74
00:02:44,319 --> 00:02:47,840
off with Unix operating system. Okay, so
75
00:02:45,920 --> 00:02:50,160
I'm not going to cover about uh C and
76
00:02:47,840 --> 00:02:52,000
getting back to our slides. So it says
77
00:02:50,160 --> 00:02:53,840
growth of Unix because of open-source
78
00:02:52,000 --> 00:02:55,920
collaboration and there was commercial
79
00:02:53,840 --> 00:02:57,840
sale of Unix. Now what this meant is
80
00:02:55,920 --> 00:02:59,760
that you know the product that Dennis
81
00:02:57,840 --> 00:03:01,760
Richie and Ken Thompson created right
82
00:02:59,760 --> 00:03:03,280
that those were you know something
83
00:03:01,760 --> 00:03:04,800
really attractive there were some
84
00:03:03,280 --> 00:03:07,040
amazing software and operating systems
85
00:03:04,800 --> 00:03:09,360
that would you know power machines and
86
00:03:07,040 --> 00:03:10,800
computers. Now what this meant was uh
87
00:03:09,360 --> 00:03:12,959
you know they had to be developed to
88
00:03:10,800 --> 00:03:15,120
become even better right. So they made
89
00:03:12,959 --> 00:03:16,720
it open source. It was uh when we say
90
00:03:15,120 --> 00:03:19,120
open source it means that it was freely
91
00:03:16,720 --> 00:03:21,360
available to use uh by anyone. So
92
00:03:19,120 --> 00:03:23,360
anybody any person any scientist or uh
93
00:03:21,360 --> 00:03:24,720
any engineer or anybody could just get
94
00:03:23,360 --> 00:03:27,280
access to the source code and start
95
00:03:24,720 --> 00:03:28,319
improving that source code and if they
96
00:03:27,280 --> 00:03:29,840
feel that they have improved the
97
00:03:28,319 --> 00:03:32,159
software in any way then they can just
98
00:03:29,840 --> 00:03:34,239
uh you know give that code back to uh
99
00:03:32,159 --> 00:03:36,400
the developers. So basically it was all
100
00:03:34,239 --> 00:03:37,840
about collaborated development. So
101
00:03:36,400 --> 00:03:40,480
that's what happened with Unix operating
102
00:03:37,840 --> 00:03:41,840
systems in the 70s. Many hippies,
103
00:03:40,480 --> 00:03:43,920
scientists, they all collaborated
104
00:03:41,840 --> 00:03:45,760
together, wrote their own code, their
105
00:03:43,920 --> 00:03:47,680
own version of Unix operating system and
106
00:03:45,760 --> 00:03:50,080
contributed to the development of Unix
107
00:03:47,680 --> 00:03:52,879
operating system. And uh since AT&T,
108
00:03:50,080 --> 00:03:54,080
they were the uh ones who built Unix or
109
00:03:52,879 --> 00:03:55,840
the ones that were responsible for
110
00:03:54,080 --> 00:03:57,439
founding Unix. They were the ones that
111
00:03:55,840 --> 00:03:58,959
gained a lot of benefit. They got help
112
00:03:57,439 --> 00:04:00,640
from other people for uh you know
113
00:03:58,959 --> 00:04:02,560
developing the operating system. And
114
00:04:00,640 --> 00:04:04,080
what they did in turn was they made it a
115
00:04:02,560 --> 00:04:05,519
business, right? So they made money out
116
00:04:04,080 --> 00:04:07,439
of that by you know starting commercial
117
00:04:05,519 --> 00:04:09,280
sale of Unix and uh this was something
118
00:04:07,439 --> 00:04:11,120
that did not go down well with many
119
00:04:09,280 --> 00:04:12,720
people and this did not go down well
120
00:04:11,120 --> 00:04:14,640
with the other developers and scientists
121
00:04:12,720 --> 00:04:16,639
because uh it was their effort which
122
00:04:14,640 --> 00:04:17,919
contributed to the growth of Unix but
123
00:04:16,639 --> 00:04:19,840
however they are not getting any
124
00:04:17,919 --> 00:04:21,040
benefits of you know Unix because AD&T
125
00:04:19,840 --> 00:04:22,720
that was making money out of somebody
126
00:04:21,040 --> 00:04:26,240
else's work so that's what happened in
127
00:04:22,720 --> 00:04:28,400
the 1970s okay and then came the 1980s
128
00:04:26,240 --> 00:04:30,560
which was a little more different so
129
00:04:28,400 --> 00:04:33,280
instead of you know buying you know Unix
130
00:04:30,560 --> 00:04:34,880
from AT&T and uh you know having two
131
00:04:33,280 --> 00:04:36,639
different versions of Unix. One was a
132
00:04:34,880 --> 00:04:38,479
free BSD and the other one was the paid
133
00:04:36,639 --> 00:04:40,160
AT&T version of Unix. So instead of
134
00:04:38,479 --> 00:04:42,880
going to go for them, companies started
135
00:04:40,160 --> 00:04:45,040
developing their own Unix. So IBM came
136
00:04:42,880 --> 00:04:47,360
up with their own uh Unix version called
137
00:04:45,040 --> 00:04:49,600
the AIX. Solaris came up with their own
138
00:04:47,360 --> 00:04:51,360
version called the Sun operating system
139
00:04:49,600 --> 00:04:53,680
and HP came up with their own version of
140
00:04:51,360 --> 00:04:56,160
Unix called HPUX. So there are other
141
00:04:53,680 --> 00:04:57,680
versions also like POSX and all these
142
00:04:56,160 --> 00:04:59,840
things. Now since there were many
143
00:04:57,680 --> 00:05:01,600
versions right many flavors and many
144
00:04:59,840 --> 00:05:03,759
dialects of the same Unix operating
145
00:05:01,600 --> 00:05:05,440
system it was becoming a little
146
00:05:03,759 --> 00:05:07,039
problematic because each of the dialects
147
00:05:05,440 --> 00:05:09,120
would be a little different. So the
148
00:05:07,039 --> 00:05:11,039
IBM's Unix would be different from HP's
149
00:05:09,120 --> 00:05:12,880
Unix and Solaris's Unix or it would be
150
00:05:11,039 --> 00:05:14,320
different from POSIX. Okay. So each of
151
00:05:12,880 --> 00:05:15,919
them would be different but however
152
00:05:14,320 --> 00:05:18,000
they're all based on the same thing. So
153
00:05:15,919 --> 00:05:20,000
it was unnecessary you know confusion
154
00:05:18,000 --> 00:05:21,680
there with so many versions of Unix. So
155
00:05:20,000 --> 00:05:23,039
that is when this person called Richard
156
00:05:21,680 --> 00:05:26,000
Stallman came up with something called
157
00:05:23,039 --> 00:05:27,840
as the GNU project. Okay. So I told you
158
00:05:26,000 --> 00:05:30,000
earlier that uh Linux is just a kernel
159
00:05:27,840 --> 00:05:32,320
and not an operating system on its own.
160
00:05:30,000 --> 00:05:33,440
So what this person did was you know he
161
00:05:32,320 --> 00:05:35,199
came up with something called as a free
162
00:05:33,440 --> 00:05:36,720
software movement. So he wanted
163
00:05:35,199 --> 00:05:38,479
something like you know back in the 70s
164
00:05:36,720 --> 00:05:40,479
when everyone could collaborate and work
165
00:05:38,479 --> 00:05:42,639
on the same one single operating system
166
00:05:40,479 --> 00:05:45,039
like that. He tried to bring back that
167
00:05:42,639 --> 00:05:47,680
era and this free software movement of
168
00:05:45,039 --> 00:05:50,160
his idea led to the GNU project. So the
169
00:05:47,680 --> 00:05:52,000
GNU project was all about people being
170
00:05:50,160 --> 00:05:54,000
able to access an operating system for
171
00:05:52,000 --> 00:05:56,320
free and you know developing that
172
00:05:54,000 --> 00:05:58,639
operating system. So that's what uh this
173
00:05:56,320 --> 00:06:00,479
led to and uh that's what we call even
174
00:05:58,639 --> 00:06:02,720
today right so GNU is basically the
175
00:06:00,479 --> 00:06:04,639
operating system and the uh Linux is the
176
00:06:02,720 --> 00:06:06,720
kernel that powers the operating system.
177
00:06:04,639 --> 00:06:08,240
So a combination of these two is what
178
00:06:06,720 --> 00:06:10,240
results in one of the distributions of
179
00:06:08,240 --> 00:06:14,160
Linux. So we have multiple distributions
180
00:06:10,240 --> 00:06:15,759
like Ubuntu CentOS Redat Debian Fedora
181
00:06:14,160 --> 00:06:17,919
all these things. So all these things
182
00:06:15,759 --> 00:06:20,160
are a flavors a combination of one of
183
00:06:17,919 --> 00:06:22,800
the operating systems and the uh you
184
00:06:20,160 --> 00:06:24,560
know Linux kernel. Okay. So that's what
185
00:06:22,800 --> 00:06:26,960
they are. So this is what happened in
186
00:06:24,560 --> 00:06:29,120
the 1980s and then you know mid to late
187
00:06:26,960 --> 00:06:30,639
1980s was when Richard Stallman came
188
00:06:29,120 --> 00:06:32,639
into the picture and he came up with the
189
00:06:30,639 --> 00:06:34,400
GU project where people could develop uh
190
00:06:32,639 --> 00:06:36,000
you know and use free operating system.
191
00:06:34,400 --> 00:06:37,759
So that's what happened here and the
192
00:06:36,000 --> 00:06:40,639
event that happened after this is what
193
00:06:37,759 --> 00:06:43,919
is a result of today's world. Okay. So
194
00:06:40,639 --> 00:06:46,560
after that then in the 1990s so probably
195
00:06:43,919 --> 00:06:48,479
1991 or 1992 that was when this person
196
00:06:46,560 --> 00:06:50,400
called Lenn Star Tarz who was still back
197
00:06:48,479 --> 00:06:52,800
in college at that time he put the Linux
198
00:06:50,400 --> 00:06:54,639
kernel source code online so he was
199
00:06:52,800 --> 00:06:57,039
trying to use the postix version with
200
00:06:54,639 --> 00:06:58,720
one hardware called 386 and he thought
201
00:06:57,039 --> 00:07:00,479
that it's compatible only with that
202
00:06:58,720 --> 00:07:02,960
hardware and so he put the source code
203
00:07:00,479 --> 00:07:04,639
online for anyone to use and later they
204
00:07:02,960 --> 00:07:06,880
found out that it could be used with the
205
00:07:04,639 --> 00:07:09,680
GNU and that's when the whole uh thing
206
00:07:06,880 --> 00:07:10,639
gained popularity so that's when we uh
207
00:07:09,680 --> 00:07:13,039
you know came up with something called
208
00:07:10,639 --> 00:07:14,639
as the Linux plus GNU this whole term of
209
00:07:13,039 --> 00:07:15,840
having a kernel plus this operating
210
00:07:14,639 --> 00:07:18,160
system and getting them to work
211
00:07:15,840 --> 00:07:21,120
together. So that's what happened here.
212
00:07:18,160 --> 00:07:23,680
All right. So guys uh that's how Linux
213
00:07:21,120 --> 00:07:25,440
was born. Okay. Now without wasting any
214
00:07:23,680 --> 00:07:27,120
more time let me go to the next slide
215
00:07:25,440 --> 00:07:29,199
and talk about the various distributions
216
00:07:27,120 --> 00:07:31,199
of Linux. So I told you that there are
217
00:07:29,199 --> 00:07:34,080
many versions like Ubuntu CentOS and
218
00:07:31,199 --> 00:07:35,599
all. So let's talk about those. And uh
219
00:07:34,080 --> 00:07:37,759
when we talk about distributions, the
220
00:07:35,599 --> 00:07:40,000
most important and the most famous ones
221
00:07:37,759 --> 00:07:42,000
are those of Red Hat Enterprise, Linux,
222
00:07:40,000 --> 00:07:43,919
Fedora and Debian. Okay. So these three
223
00:07:42,000 --> 00:07:46,000
are primarily different companies and
224
00:07:43,919 --> 00:07:48,560
enterprises. Well, Debian is basically
225
00:07:46,000 --> 00:07:50,319
not one company. It's kind of you know,
226
00:07:48,560 --> 00:07:52,880
let's say a group of developers
227
00:07:50,319 --> 00:07:54,319
developing this uh version of Linux.
228
00:07:52,880 --> 00:07:56,800
Okay, this version of Linux and the
229
00:07:54,319 --> 00:07:58,639
Ubuntu version. So that is what Debian
230
00:07:56,800 --> 00:08:00,560
is. And the Red Hat is basically an
231
00:07:58,639 --> 00:08:02,000
enterprise. It's a company that is
232
00:08:00,560 --> 00:08:03,680
commercially selling the Linux
233
00:08:02,000 --> 00:08:05,840
distribution. Okay. And it's probably
234
00:08:03,680 --> 00:08:08,240
the most used and the most popular of
235
00:08:05,840 --> 00:08:10,160
them all. Uh why? Because they are very
236
00:08:08,240 --> 00:08:11,360
stable. They are very reliable. And as
237
00:08:10,160 --> 00:08:13,039
it's written here, servers and
238
00:08:11,360 --> 00:08:14,960
workstations, right? So it's the
239
00:08:13,039 --> 00:08:17,120
preferred Linux distribution for servers
240
00:08:14,960 --> 00:08:19,039
and workstations. The Red Hat Enterprise
241
00:08:17,120 --> 00:08:21,360
Linux. So they have a free version. So
242
00:08:19,039 --> 00:08:22,879
that's called the uh CentOS. And uh
243
00:08:21,360 --> 00:08:25,759
today's demonstration, I'll be showing
244
00:08:22,879 --> 00:08:27,680
it to you on CentOS only. Okay. So they
245
00:08:25,759 --> 00:08:29,680
have that and they have various other
246
00:08:27,680 --> 00:08:30,800
distributions. In fact, even Fedora,
247
00:08:29,680 --> 00:08:32,560
right, that which we are going to talk
248
00:08:30,800 --> 00:08:35,279
about next. Even Fedora is a company
249
00:08:32,560 --> 00:08:37,440
that's funded by Red Hat itself. So it's
250
00:08:35,279 --> 00:08:39,360
again one of the variations of Red Hat
251
00:08:37,440 --> 00:08:41,599
and Fedora has its own set of you know
252
00:08:39,360 --> 00:08:43,760
distributions under it and that's about
253
00:08:41,599 --> 00:08:45,600
the Federa distribution. Then comes the
254
00:08:43,760 --> 00:08:47,839
Debian. So this again I spoke about
255
00:08:45,600 --> 00:08:49,680
Debian. So Debian is you know the Linux
256
00:08:47,839 --> 00:08:52,080
distribution that is developed with the
257
00:08:49,680 --> 00:08:53,920
help of many developers. So this is not
258
00:08:52,080 --> 00:08:55,680
developed for commercial purpose. It's
259
00:08:53,920 --> 00:08:57,839
basically free and open source software
260
00:08:55,680 --> 00:09:00,480
and anybody with the skills can start
261
00:08:57,839 --> 00:09:02,560
contributing to this software. And you
262
00:09:00,480 --> 00:09:04,720
have many other distributions. Okay. So
263
00:09:02,560 --> 00:09:06,800
these are among the important and the
264
00:09:04,720 --> 00:09:08,240
commercial ones. And if you're talking
265
00:09:06,800 --> 00:09:10,240
about some of the free distributions
266
00:09:08,240 --> 00:09:14,959
which people can use then they are
267
00:09:10,240 --> 00:09:17,440
Ubuntu, Linux Mint, CentOS, OpenS Gen 2
268
00:09:14,959 --> 00:09:19,839
and many more. Okay. So there are almost
269
00:09:17,440 --> 00:09:21,360
100 Linux distributions today and you
270
00:09:19,839 --> 00:09:23,040
can use any of them. you know if you're
271
00:09:21,360 --> 00:09:24,320
getting started with Linux then I would
272
00:09:23,040 --> 00:09:27,279
suggest you to either start off with
273
00:09:24,320 --> 00:09:28,320
Ubuntu or CentOS because uh CentOS is
274
00:09:27,279 --> 00:09:30,240
you know something that's really
275
00:09:28,320 --> 00:09:32,080
reliable and that's really fast okay and
276
00:09:30,240 --> 00:09:33,760
Ubuntu is the most popular Linux
277
00:09:32,080 --> 00:09:35,519
distribution out there okay so I read
278
00:09:33,760 --> 00:09:37,600
somewhere that Ubuntu is the third most
279
00:09:35,519 --> 00:09:39,600
used operating system okay so that's
280
00:09:37,600 --> 00:09:42,080
what Ubuntu is all about of course it's
281
00:09:39,600 --> 00:09:43,920
not as fast as CentOS but still Ubuntu
282
00:09:42,080 --> 00:09:47,120
is you know a very popular and very
283
00:09:43,920 --> 00:09:48,720
handy tool and Linux Mint is the other
284
00:09:47,120 --> 00:09:50,959
distribution which can be used for
285
00:09:48,720 --> 00:09:52,959
playing movies and listening to music
286
00:09:50,959 --> 00:09:54,880
because this gives you more of a windows
287
00:09:52,959 --> 00:09:56,880
like interface. So that's what Linux
288
00:09:54,880 --> 00:09:59,120
Mint is. So we have various
289
00:09:56,880 --> 00:10:00,640
distributions like this. You can start
290
00:09:59,120 --> 00:10:02,080
off with one of these distributions
291
00:10:00,640 --> 00:10:03,839
mentioned here. You can either go for
292
00:10:02,080 --> 00:10:06,480
the Red Hat Enterprise Linux or the
293
00:10:03,839 --> 00:10:08,160
Fedora or the Debian or the other
294
00:10:06,480 --> 00:10:10,800
operating systems which are based on
295
00:10:08,160 --> 00:10:13,200
them. Okay. So the CentOS here it is
296
00:10:10,800 --> 00:10:15,600
based on Red Hat Enterprise Linux. Okay.
297
00:10:13,200 --> 00:10:17,440
So uh the RE right we call them RE. So
298
00:10:15,600 --> 00:10:19,839
they have the free version that you know
299
00:10:17,440 --> 00:10:22,959
they provide for enterprise users are is
300
00:10:19,839 --> 00:10:24,640
that of CentOS and Fedora again for that
301
00:10:22,959 --> 00:10:26,240
matter of fact you know they have
302
00:10:24,640 --> 00:10:28,399
multiple distributions under them under
303
00:10:26,240 --> 00:10:30,880
their name and Debian are the people who
304
00:10:28,399 --> 00:10:32,720
are the founders of Ubuntu. Okay so
305
00:10:30,880 --> 00:10:36,160
Ubuntu is a distribution that is based
306
00:10:32,720 --> 00:10:37,519
on Debian and since Ubuntu is so popular
307
00:10:36,160 --> 00:10:38,880
there are different versions of Ubuntu
308
00:10:37,519 --> 00:10:41,519
itself right there are other
309
00:10:38,880 --> 00:10:43,279
distributions like X Ubuntu or Ed Ubuntu
310
00:10:41,519 --> 00:10:46,000
all these things and they are the other
311
00:10:43,279 --> 00:10:47,839
you know versions of Ubuntu. So that's
312
00:10:46,000 --> 00:10:50,160
about the uh different Linux
313
00:10:47,839 --> 00:10:51,519
distributions and you guys can probably
314
00:10:50,160 --> 00:10:52,399
you know if you're newcomers then I
315
00:10:51,519 --> 00:10:54,480
would suggest you to go for either
316
00:10:52,399 --> 00:10:55,920
Ubuntu or CentOS like I said earlier.
317
00:10:54,480 --> 00:10:58,959
All right great. So let me go to the
318
00:10:55,920 --> 00:11:00,640
next slide then. Okay so now we are in
319
00:10:58,959 --> 00:11:03,279
this slide and uh let's talk about the
320
00:11:00,640 --> 00:11:04,880
features of Linux here. So the Linux
321
00:11:03,279 --> 00:11:06,800
features you know when we say features
322
00:11:04,880 --> 00:11:08,880
it's basically those compared to the
323
00:11:06,800 --> 00:11:11,120
other operating systems compared to
324
00:11:08,880 --> 00:11:12,480
Windows and compared to Mac. Okay. Okay,
325
00:11:11,120 --> 00:11:13,920
so compared to them how does Linux
326
00:11:12,480 --> 00:11:16,480
perform and you know what are the
327
00:11:13,920 --> 00:11:18,640
benefits with Linux and uh first of all
328
00:11:16,480 --> 00:11:20,480
we have uh this feature of uh you know
329
00:11:18,640 --> 00:11:22,480
the updates being very easy to be
330
00:11:20,480 --> 00:11:24,079
performed. If you have any software in
331
00:11:22,480 --> 00:11:25,360
your operating system or if it's the
332
00:11:24,079 --> 00:11:27,120
operating system itself which you want
333
00:11:25,360 --> 00:11:29,040
to update then it's really easy with
334
00:11:27,120 --> 00:11:30,800
Linux it's uh just going to be one
335
00:11:29,040 --> 00:11:32,160
command that you need to run and you
336
00:11:30,800 --> 00:11:34,480
know you can run that command from the
337
00:11:32,160 --> 00:11:36,399
terminal. Okay, for those guys who don't
338
00:11:34,480 --> 00:11:37,839
know what a terminal is. So let me just
339
00:11:36,399 --> 00:11:40,880
open my uh Linux version and show you
340
00:11:37,839 --> 00:11:43,600
what a terminal is. Okay. So this is my
341
00:11:40,880 --> 00:11:44,800
uh CentOS version of Linux. All right.
342
00:11:43,600 --> 00:11:46,560
And then you have different options
343
00:11:44,800 --> 00:11:47,839
here. Right. So the terminal that you
344
00:11:46,560 --> 00:11:50,320
see here, this is what I was talking
345
00:11:47,839 --> 00:11:52,000
about. So when you open the terminal,
346
00:11:50,320 --> 00:11:54,240
there's another window that opens. Okay.
347
00:11:52,000 --> 00:11:56,480
Now this is the command line interface.
348
00:11:54,240 --> 00:11:58,240
So when I say command line interface,
349
00:11:56,480 --> 00:12:00,480
this is where I can uh put in my
350
00:11:58,240 --> 00:12:02,399
commands and I can get my uh you know
351
00:12:00,480 --> 00:12:04,000
software or my kernel to listen to those
352
00:12:02,399 --> 00:12:07,040
commands and perform actions by creating
353
00:12:04,000 --> 00:12:09,600
a process for uh those commands. So the
354
00:12:07,040 --> 00:12:11,600
whole benefit of Linux is this CLI
355
00:12:09,600 --> 00:12:13,040
because the CLI is really helpful. If
356
00:12:11,600 --> 00:12:15,040
you're going for Windows or something,
357
00:12:13,040 --> 00:12:17,519
you have a very good GUI. All right. So
358
00:12:15,040 --> 00:12:19,519
even in Linux, you have a GUI. So let me
359
00:12:17,519 --> 00:12:21,279
show you the GUI aspect. So similar to
360
00:12:19,519 --> 00:12:23,279
Windows, you can just go to the computer
361
00:12:21,279 --> 00:12:24,959
and you can go to file system. You can
362
00:12:23,279 --> 00:12:26,560
open various other folders and
363
00:12:24,959 --> 00:12:28,639
directories. So you have multiple
364
00:12:26,560 --> 00:12:29,920
directories and folders here, right? So
365
00:12:28,639 --> 00:12:31,519
I mean directories are basically
366
00:12:29,920 --> 00:12:32,639
folders. Folders is what you call in
367
00:12:31,519 --> 00:12:34,639
Windows and here you call them
368
00:12:32,639 --> 00:12:36,880
directories. So I can go into any of
369
00:12:34,639 --> 00:12:38,880
these uh you know directories and I can
370
00:12:36,880 --> 00:12:40,880
close them like this. I can access any
371
00:12:38,880 --> 00:12:42,399
of these directories. I can access any
372
00:12:40,880 --> 00:12:44,720
software or anything that's installed
373
00:12:42,399 --> 00:12:48,399
anywhere. So Linux basically provides a
374
00:12:44,720 --> 00:12:51,040
GUI too. Okay. But the thing with Linux
375
00:12:48,399 --> 00:12:52,480
is that you also have a terminal right.
376
00:12:51,040 --> 00:12:54,000
This terminal is basically a command
377
00:12:52,480 --> 00:12:55,920
line interface where you can you know
378
00:12:54,000 --> 00:12:57,519
put in your uh commands and you can get
379
00:12:55,920 --> 00:12:59,279
the software to behave the way you want
380
00:12:57,519 --> 00:13:01,120
to. you can run certain commands, you
381
00:12:59,279 --> 00:13:03,839
can install software, you can run uh
382
00:13:01,120 --> 00:13:06,639
programs, you can run codes. So that's
383
00:13:03,839 --> 00:13:08,560
what the advantage with the uh CLI is
384
00:13:06,639 --> 00:13:10,639
and this is basically the reason why uh
385
00:13:08,560 --> 00:13:12,880
it's very popular among all these
386
00:13:10,639 --> 00:13:14,560
software developers. Okay, so I told you
387
00:13:12,880 --> 00:13:16,399
earlier that software developers
388
00:13:14,560 --> 00:13:18,480
favorite tool, right? Linux. So that's
389
00:13:16,399 --> 00:13:20,880
because Linux is the free version of
390
00:13:18,480 --> 00:13:23,040
Unix and it's also you know possible to
391
00:13:20,880 --> 00:13:24,720
develop and create so many programs. So
392
00:13:23,040 --> 00:13:26,560
that's the thing with Linux. So that's
393
00:13:24,720 --> 00:13:28,240
why it's so popular. So back in the
394
00:13:26,560 --> 00:13:30,160
slides I told you that it was very easy
395
00:13:28,240 --> 00:13:32,000
to perform updates right. So those
396
00:13:30,160 --> 00:13:33,600
updates can be you know easily performed
397
00:13:32,000 --> 00:13:35,440
by just running a few commands here. You
398
00:13:33,600 --> 00:13:37,040
know by uh writing one single command I
399
00:13:35,440 --> 00:13:39,040
can update a particular software.
400
00:13:37,040 --> 00:13:40,720
Supposing I have Java installed in my uh
401
00:13:39,040 --> 00:13:43,360
system then I can just write a command
402
00:13:40,720 --> 00:13:45,200
for updating that. I can just say sudo
403
00:13:43,360 --> 00:13:47,519
yum
404
00:13:45,200 --> 00:13:49,200
update and the uh package name. If it's
405
00:13:47,519 --> 00:13:51,360
Java I can just put the Java version. if
406
00:13:49,200 --> 00:13:53,040
it's uh any other language or if it's
407
00:13:51,360 --> 00:13:54,880
any other software then I can put that
408
00:13:53,040 --> 00:13:57,279
software name over here and update the
409
00:13:54,880 --> 00:13:59,279
uh application. So that's how simple and
410
00:13:57,279 --> 00:14:01,760
that's how easy uh you know it is to
411
00:13:59,279 --> 00:14:03,839
update softwares over here. So I was
412
00:14:01,760 --> 00:14:05,519
talking about uh this aspect. So let me
413
00:14:03,839 --> 00:14:07,440
go back to the slides and talk about the
414
00:14:05,519 --> 00:14:09,360
other features. Okay. So that was how
415
00:14:07,440 --> 00:14:10,800
updates can be easily performed. And
416
00:14:09,360 --> 00:14:12,399
then another feature is that the
417
00:14:10,800 --> 00:14:14,800
software is free. You don't have to pay
418
00:14:12,399 --> 00:14:16,079
for uh Linux. So because Windows of
419
00:14:14,800 --> 00:14:17,440
course you all know that Windows is
420
00:14:16,079 --> 00:14:18,880
paid. you can't, you know, have a
421
00:14:17,440 --> 00:14:20,959
pirated version. If you're caught having
422
00:14:18,880 --> 00:14:23,120
a pirated version, you'll be fined. Of
423
00:14:20,959 --> 00:14:24,800
course, home, you know, desktop users
424
00:14:23,120 --> 00:14:26,240
and home users don't really have that
425
00:14:24,800 --> 00:14:28,560
problem because there are no routine
426
00:14:26,240 --> 00:14:30,560
checks. But companies cannot use uh the
427
00:14:28,560 --> 00:14:32,320
pirated version of Windows because if
428
00:14:30,560 --> 00:14:34,720
there are audits, they can come and
429
00:14:32,320 --> 00:14:36,959
seize the computers and put a heavy fine
430
00:14:34,720 --> 00:14:38,320
on the company. So that's what we say
431
00:14:36,959 --> 00:14:40,480
when the free software licensing is
432
00:14:38,320 --> 00:14:42,399
there in Linux because you don't have to
433
00:14:40,480 --> 00:14:43,760
have any license. You can just uh you
434
00:14:42,399 --> 00:14:46,000
know get all the folks in your company
435
00:14:43,760 --> 00:14:48,240
to work on Linux for free. So that's the
436
00:14:46,000 --> 00:14:50,560
free software licensing aspect and then
437
00:14:48,240 --> 00:14:52,800
you have the access to source code right
438
00:14:50,560 --> 00:14:54,399
so when we say access to source code I
439
00:14:52,800 --> 00:14:55,839
told you that back in the 700s people
440
00:14:54,399 --> 00:14:57,680
could just collaborate together and
441
00:14:55,839 --> 00:14:59,440
develop the operating system so that is
442
00:14:57,680 --> 00:15:01,440
what I'm talking about here so the
443
00:14:59,440 --> 00:15:04,240
entire the source code for uh running
444
00:15:01,440 --> 00:15:06,320
this OS the basically the Ubuntu or the
445
00:15:04,240 --> 00:15:08,560
CentOS source code is available to you
446
00:15:06,320 --> 00:15:10,480
and you can customize it and you can uh
447
00:15:08,560 --> 00:15:12,639
you know change it the way you want you
448
00:15:10,480 --> 00:15:14,480
can make it behave the way you want to
449
00:15:12,639 --> 00:15:16,160
and uh if it's a really good visual that
450
00:15:14,480 --> 00:15:18,399
you've added Then you can also share
451
00:15:16,160 --> 00:15:20,079
your discoveries and your uh you know
452
00:15:18,399 --> 00:15:21,600
features with other people with other
453
00:15:20,079 --> 00:15:24,079
fellow developers. You can do all these
454
00:15:21,600 --> 00:15:25,519
things. So you have complete uh you know
455
00:15:24,079 --> 00:15:27,680
access to the source code and you have
456
00:15:25,519 --> 00:15:29,440
complete freedom with what your OS can
457
00:15:27,680 --> 00:15:31,600
do and how it behaves. But the same
458
00:15:29,440 --> 00:15:33,360
thing cannot be set for Windows right.
459
00:15:31,600 --> 00:15:34,560
So Windows you cannot change it
460
00:15:33,360 --> 00:15:36,079
completely. you don't get access to the
461
00:15:34,560 --> 00:15:37,600
source code at all and you can't change
462
00:15:36,079 --> 00:15:39,760
all the features the way you want to
463
00:15:37,600 --> 00:15:41,920
because that's proprietary tool and it's
464
00:15:39,760 --> 00:15:44,000
programmed to behave in one way and if
465
00:15:41,920 --> 00:15:46,959
you try changing too many things then
466
00:15:44,000 --> 00:15:49,279
your uh you know windows will uh report
467
00:15:46,959 --> 00:15:51,360
so that's what is going to happen so
468
00:15:49,279 --> 00:15:53,360
that's about the uh access to source
469
00:15:51,360 --> 00:15:55,519
code feature and then we have another
470
00:15:53,360 --> 00:15:57,199
feature that is multiple distributions
471
00:15:55,519 --> 00:15:58,880
so I spoke about the different
472
00:15:57,199 --> 00:16:00,800
distributions in the previous slide so
473
00:15:58,880 --> 00:16:04,720
the basic distributions are those of Red
474
00:16:00,800 --> 00:16:06,399
Hat Debian or Fedora Right. So you have
475
00:16:04,720 --> 00:16:08,079
various versions of them itself. You
476
00:16:06,399 --> 00:16:09,759
have different flavors in the Red Hat
477
00:16:08,079 --> 00:16:11,759
and you have different ones in the
478
00:16:09,759 --> 00:16:13,680
Debian and again Federra has a lot of
479
00:16:11,759 --> 00:16:16,320
other distributions further. Many
480
00:16:13,680 --> 00:16:17,920
distributions are based on them. So you
481
00:16:16,320 --> 00:16:19,519
have so many options and if you don't
482
00:16:17,920 --> 00:16:21,199
like one of the distributions then you
483
00:16:19,519 --> 00:16:22,800
can work on another distribution right.
484
00:16:21,199 --> 00:16:24,079
So if you don't like CentOS is because
485
00:16:22,800 --> 00:16:25,920
uh you know you don't get support for
486
00:16:24,079 --> 00:16:28,079
everything then you can use Ubuntu.
487
00:16:25,920 --> 00:16:30,320
Okay. It is the most popular operating
488
00:16:28,079 --> 00:16:32,320
system and it has support for almost
489
00:16:30,320 --> 00:16:34,399
every application and every software. So
490
00:16:32,320 --> 00:16:36,079
you can use that but if you're unhappy
491
00:16:34,399 --> 00:16:38,399
with the speed of Ubuntu then you can
492
00:16:36,079 --> 00:16:40,480
probably switch to CentOS. So you have
493
00:16:38,399 --> 00:16:42,880
all that flexibility and all this
494
00:16:40,480 --> 00:16:45,759
flexibility without any cost. Okay. Uh
495
00:16:42,880 --> 00:16:47,279
no cost with respect to uh energy or
496
00:16:45,759 --> 00:16:48,639
having to learn something new because
497
00:16:47,279 --> 00:16:50,480
all these are Linux. At the end of the
498
00:16:48,639 --> 00:16:52,399
day the commands will be the same almost
499
00:16:50,480 --> 00:16:54,079
98% of commands will be the same. There
500
00:16:52,399 --> 00:16:55,920
are just going to be minor differences
501
00:16:54,079 --> 00:16:57,519
in the commands that will be executed in
502
00:16:55,920 --> 00:16:59,519
uh the different uh distributions. But
503
00:16:57,519 --> 00:17:02,079
yeah 98% of them would be the same. You
504
00:16:59,519 --> 00:17:03,839
won't have a tough transition time also.
505
00:17:02,079 --> 00:17:06,079
you'll have uh you know you can gain so
506
00:17:03,839 --> 00:17:08,319
many benefits by using Linux and the
507
00:17:06,079 --> 00:17:10,480
last but not the least right so this
508
00:17:08,319 --> 00:17:12,559
feature is probably the highlight of
509
00:17:10,480 --> 00:17:14,640
Linux so it says better malware
510
00:17:12,559 --> 00:17:16,799
protection so when we say better malware
511
00:17:14,640 --> 00:17:19,760
protection we say that it's the ultimate
512
00:17:16,799 --> 00:17:21,679
okay in Windows if you people would have
513
00:17:19,760 --> 00:17:24,480
noticed that you need an antivirus
514
00:17:21,679 --> 00:17:27,120
because uh it's prone to viruses and
515
00:17:24,480 --> 00:17:28,880
attacks and bugs and all these things so
516
00:17:27,120 --> 00:17:30,720
people can easily hack into your system
517
00:17:28,880 --> 00:17:32,799
right so the same thing cannot uh you
518
00:17:30,720 --> 00:17:34,960
know happen With Linux, you don't need
519
00:17:32,799 --> 00:17:37,039
an antivirus at all. Linux is completely
520
00:17:34,960 --> 00:17:38,799
antivirus free. Okay, 100% you don't
521
00:17:37,039 --> 00:17:40,799
need an antivirus. And in fact, you
522
00:17:38,799 --> 00:17:42,320
don't even have an antivirus. But of
523
00:17:40,799 --> 00:17:44,240
course, it doesn't mean that, you know,
524
00:17:42,320 --> 00:17:45,679
it's completely secure. Also, uh
525
00:17:44,240 --> 00:17:46,960
security is something that's really
526
00:17:45,679 --> 00:17:48,960
good, but it's still developing in
527
00:17:46,960 --> 00:17:51,520
Linux, but it's definitely better than
528
00:17:48,960 --> 00:17:53,280
Windows, right? So, you can be sure that
529
00:17:51,520 --> 00:17:55,440
no one's going to hack your system so
530
00:17:53,280 --> 00:17:57,919
easily. So, that's what uh Linux is all
531
00:17:55,440 --> 00:18:00,160
about. So, guys, that brings us to the
532
00:17:57,919 --> 00:18:02,160
end of this slide of Linux features,
533
00:18:00,160 --> 00:18:04,640
okay? And if you guys have uh you know
534
00:18:02,160 --> 00:18:06,640
any doubts even now about Linux and how
535
00:18:04,640 --> 00:18:09,200
good Linux is then um that should have
536
00:18:06,640 --> 00:18:12,640
been clarified and put to rest by now.
537
00:18:09,200 --> 00:18:14,720
Okay. So moving on. So uh enough with
538
00:18:12,640 --> 00:18:17,120
the theory now let's straight away get
539
00:18:14,720 --> 00:18:19,120
started with our hands-on. Okay. So I'm
540
00:18:17,120 --> 00:18:21,039
going to show you how to run commands
541
00:18:19,120 --> 00:18:23,760
and how to do various other things with
542
00:18:21,039 --> 00:18:25,840
the CentOS operating system. Okay. So
543
00:18:23,760 --> 00:18:27,280
the first of all the first part of this
544
00:18:25,840 --> 00:18:28,880
hands-on session is going to be about
545
00:18:27,280 --> 00:18:30,320
you know an introduction to the terminal
546
00:18:28,880 --> 00:18:32,480
and the various commands and the basic
547
00:18:30,320 --> 00:18:34,640
commands and how to browse through the
548
00:18:32,480 --> 00:18:37,440
uh different uh directories. Okay. So we
549
00:18:34,640 --> 00:18:39,440
use commands like pwd clear ls and cd
550
00:18:37,440 --> 00:18:42,080
commands. Okay. Now let me go to my
551
00:18:39,440 --> 00:18:44,000
cents. Okay. In case I uh forgot to
552
00:18:42,080 --> 00:18:46,400
mention it earlier then guys I'm using a
553
00:18:44,000 --> 00:18:48,559
VM here. Okay. So I'm running my Windows
554
00:18:46,400 --> 00:18:50,080
operating system on my uh laptop and I
555
00:18:48,559 --> 00:18:52,080
have a virtual box installed and in the
556
00:18:50,080 --> 00:18:54,480
virtual box I've instantiated my uh
557
00:18:52,080 --> 00:18:56,640
Linux virtual machine. Okay. So my Linux
558
00:18:54,480 --> 00:18:58,080
distribution here is CentOS. Let me just
559
00:18:56,640 --> 00:18:59,280
show you another thing. Okay. So this is
560
00:18:58,080 --> 00:19:00,960
the virtual box that I was talking
561
00:18:59,280 --> 00:19:03,039
about. This is what I'm running in my
562
00:19:00,960 --> 00:19:05,039
Windows and I have uh you know multiple
563
00:19:03,039 --> 00:19:06,799
options. So I can choose any VM that I
564
00:19:05,039 --> 00:19:09,039
want to. So this is the virtual box and
565
00:19:06,799 --> 00:19:11,280
all these are the different VMs that we
566
00:19:09,039 --> 00:19:13,760
have in my virtual box. So currently I'm
567
00:19:11,280 --> 00:19:15,919
running this VM called master. Okay. And
568
00:19:13,760 --> 00:19:17,840
later on I'll be turning on even this VM
569
00:19:15,919 --> 00:19:20,559
called slave. Now I'll be doing these
570
00:19:17,840 --> 00:19:22,720
two for uh showing you how SSH works. So
571
00:19:20,559 --> 00:19:24,559
I told you in the agenda slide that I'll
572
00:19:22,720 --> 00:19:26,000
you know get two remote machines to
573
00:19:24,559 --> 00:19:28,080
access each other right. So for that
574
00:19:26,000 --> 00:19:30,640
purpose I need these two VMs and of
575
00:19:28,080 --> 00:19:32,240
course both are CentOS and uh yeah as
576
00:19:30,640 --> 00:19:35,440
you can see the information it says that
577
00:19:32,240 --> 00:19:37,440
32-bit system I've called it or named it
578
00:19:35,440 --> 00:19:40,559
master and this one is named it as
579
00:19:37,440 --> 00:19:43,280
slave. So similarly I have the Ubuntu
580
00:19:40,559 --> 00:19:45,120
also. So the Ubuntu 64-bit is uh this.
581
00:19:43,280 --> 00:19:47,840
So let me just uh turn on the Ubuntu and
582
00:19:45,120 --> 00:19:51,720
show you how Ubuntu looks like. Okay. So
583
00:19:47,840 --> 00:19:51,720
let's just wait for some time.
584
00:19:53,440 --> 00:19:58,840
Okay. So let me just enter the password
585
00:19:55,440 --> 00:19:58,840
for the user.
586
00:19:59,120 --> 00:20:04,160
And here we are. This is my Ubuntu uh
587
00:20:01,919 --> 00:20:07,200
OS, right? So even this is being hosted
588
00:20:04,160 --> 00:20:08,559
on the same virtual box. So I am kind of
589
00:20:07,200 --> 00:20:10,720
running two different virtual machines
590
00:20:08,559 --> 00:20:13,280
at the same time. Okay. So we have
591
00:20:10,720 --> 00:20:14,880
options uh to browse the internet and I
592
00:20:13,280 --> 00:20:16,720
can open the terminal here. The terminal
593
00:20:14,880 --> 00:20:19,679
option is right here in my Ubuntu
594
00:20:16,720 --> 00:20:21,520
operating system. Okay. So I just want
595
00:20:19,679 --> 00:20:23,919
to show you the uh Ubuntu operating
596
00:20:21,520 --> 00:20:26,559
system. So let me just quickly turn it
597
00:20:23,919 --> 00:20:28,640
off and uh go back to my uh CentOS and
598
00:20:26,559 --> 00:20:31,280
start running a couple of commands.
599
00:20:28,640 --> 00:20:35,679
Okay. So I was uh showing you the uh
600
00:20:31,280 --> 00:20:38,320
CentOS, right? So login. Okay. So this
601
00:20:35,679 --> 00:20:39,919
is my uh terminal and uh first of all
602
00:20:38,320 --> 00:20:42,080
the main difference that you people need
603
00:20:39,919 --> 00:20:44,240
to understand between Windows and Linux
604
00:20:42,080 --> 00:20:46,799
is that in Windows it was you know the
605
00:20:44,240 --> 00:20:49,360
storing uh files or folders it was all
606
00:20:46,799 --> 00:20:51,360
in drives. Okay. So we had a C drive, we
607
00:20:49,360 --> 00:20:52,799
had a D drive, we had uh many more
608
00:20:51,360 --> 00:20:55,440
drives like that and we could store
609
00:20:52,799 --> 00:20:57,360
ouruh documents all in those folders.
610
00:20:55,440 --> 00:20:59,440
Okay. But in Linux it's a little
611
00:20:57,360 --> 00:21:01,200
different from how uh Windows works. In
612
00:20:59,440 --> 00:21:04,240
Linux we have something called as the
613
00:21:01,200 --> 00:21:06,480
root directory. Okay. So we have file
614
00:21:04,240 --> 00:21:08,480
system here right. So basically whatever
615
00:21:06,480 --> 00:21:09,919
folders or documents or directories you
616
00:21:08,480 --> 00:21:11,919
have everything can be accessed from the
617
00:21:09,919 --> 00:21:13,440
file system. When I clicked on file
618
00:21:11,919 --> 00:21:15,280
system then you would have noticed that
619
00:21:13,440 --> 00:21:17,760
I got a forward slasher. Okay so this
620
00:21:15,280 --> 00:21:19,919
forward slash basically means root. Okay
621
00:21:17,760 --> 00:21:22,080
this means I'm in the root directory and
622
00:21:19,919 --> 00:21:24,240
in the root directory every document and
623
00:21:22,080 --> 00:21:26,720
every folder is present in this root
624
00:21:24,240 --> 00:21:28,640
directory. Okay. Now whether it is uh me
625
00:21:26,720 --> 00:21:31,760
storing some kind of uh you know
626
00:21:28,640 --> 00:21:33,440
important files or uh MP3s or videos
627
00:21:31,760 --> 00:21:35,840
then everything can be accessed from the
628
00:21:33,440 --> 00:21:38,080
root. So you can think of this something
629
00:21:35,840 --> 00:21:40,000
like a tree hierarchal structure. Okay.
630
00:21:38,080 --> 00:21:42,240
So you have one root and all the other
631
00:21:40,000 --> 00:21:44,080
branches and all the uh leaves and all
632
00:21:42,240 --> 00:21:46,480
those things you can consider them to be
633
00:21:44,080 --> 00:21:48,480
the different directories and the files
634
00:21:46,480 --> 00:21:51,200
inside. So they can all be accessed from
635
00:21:48,480 --> 00:21:54,640
the root. And if you want me to show you
636
00:21:51,200 --> 00:21:56,320
where uh one minute. Okay. So now this
637
00:21:54,640 --> 00:21:57,679
is your desktop right? So you have the
638
00:21:56,320 --> 00:21:59,840
different icons here and each of these
639
00:21:57,679 --> 00:22:02,080
icons are for different operation. So
640
00:21:59,840 --> 00:22:04,240
you have home and then you have a
641
00:22:02,080 --> 00:22:06,480
terminal and you have an LMS. So this is
642
00:22:04,240 --> 00:22:08,720
a folder and this is a document. Okay.
643
00:22:06,480 --> 00:22:10,320
So read me is a document. So uh what I'm
644
00:22:08,720 --> 00:22:12,799
going to do is I'm going to browse to
645
00:22:10,320 --> 00:22:14,480
the desktop folder. So from uh root
646
00:22:12,799 --> 00:22:16,080
directory if you go to this folder
647
00:22:14,480 --> 00:22:17,919
called home right. So under home
648
00:22:16,080 --> 00:22:20,400
directory you have other option. You
649
00:22:17,919 --> 00:22:22,640
have Edrica and Uzi. Okay. So now if I
650
00:22:20,400 --> 00:22:24,880
go to the edurea directory then you have
651
00:22:22,640 --> 00:22:27,039
other options of desktop documents
652
00:22:24,880 --> 00:22:29,200
downloads uh music and all these things.
653
00:22:27,039 --> 00:22:31,280
So if I go to desktop then in this
654
00:22:29,200 --> 00:22:32,640
directory you have the files and the
655
00:22:31,280 --> 00:22:34,559
different things that are present on my
656
00:22:32,640 --> 00:22:36,799
desktop. So LMS was a folder that was
657
00:22:34,559 --> 00:22:38,320
present readme this was a file that was
658
00:22:36,799 --> 00:22:39,919
present the terminal was present on my
659
00:22:38,320 --> 00:22:42,320
desktop so that is available here. So
660
00:22:39,919 --> 00:22:44,320
Eclipse IDE is present here. So all this
661
00:22:42,320 --> 00:22:46,159
was present on my desktop. So I get the
662
00:22:44,320 --> 00:22:47,120
same thing accessed from here. And
663
00:22:46,159 --> 00:22:48,240
similarly if you're downloading
664
00:22:47,120 --> 00:22:50,240
something from the internet then that
665
00:22:48,240 --> 00:22:52,159
will get downloaded to uh this folder
666
00:22:50,240 --> 00:22:53,440
the downloads folder right so you have a
667
00:22:52,159 --> 00:22:56,000
documents folder similarly you have a
668
00:22:53,440 --> 00:22:57,840
videos folder music folder so all these
669
00:22:56,000 --> 00:23:00,000
files or folders will be stored in some
670
00:22:57,840 --> 00:23:02,400
place right so they will be stored in
671
00:23:00,000 --> 00:23:04,480
your uh /home/reka
672
00:23:02,400 --> 00:23:05,840
okay if you're downloading them and uh
673
00:23:04,480 --> 00:23:06,880
you know if not if it's going to be
674
00:23:05,840 --> 00:23:08,640
softares which you're going to install
675
00:23:06,880 --> 00:23:10,320
then you can install them in any other
676
00:23:08,640 --> 00:23:11,840
uh directory here in fact most of the
677
00:23:10,320 --> 00:23:13,520
softwares that you install they'll be by
678
00:23:11,840 --> 00:23:15,600
default they'll get installed in this
679
00:23:13,520 --> 00:23:17,520
directory in the bin directory right so
680
00:23:15,600 --> 00:23:19,280
You have the bin directory. You have the
681
00:23:17,520 --> 00:23:21,840
lib directory which will have a list of
682
00:23:19,280 --> 00:23:24,159
all the different libraries that the OS
683
00:23:21,840 --> 00:23:26,080
would use. And then you have the sbin.
684
00:23:24,159 --> 00:23:28,320
You have all these things, right? So
685
00:23:26,080 --> 00:23:30,080
they can all be accessed from here. And
686
00:23:28,320 --> 00:23:31,840
uh that's about accessing them from the
687
00:23:30,080 --> 00:23:34,720
GUI aspect. Okay. And the same thing can
688
00:23:31,840 --> 00:23:36,640
be done through the terminal. Okay. Now
689
00:23:34,720 --> 00:23:40,000
uh let me go to my terminal and show you
690
00:23:36,640 --> 00:23:42,559
how that is done.
691
00:23:40,000 --> 00:23:44,400
So this is my uh terminal. Okay. This is
692
00:23:42,559 --> 00:23:46,640
the command line interface where I can
693
00:23:44,400 --> 00:23:49,600
uh put in my commands and when those
694
00:23:46,640 --> 00:23:52,480
commands are executed by the uh kernel
695
00:23:49,600 --> 00:23:54,720
or by the shell then uh program will get
696
00:23:52,480 --> 00:23:57,600
activated and some kind of uh features
697
00:23:54,720 --> 00:23:58,960
will run. All right. Okay guys uh so
698
00:23:57,600 --> 00:24:00,159
before I get started let me go back to
699
00:23:58,960 --> 00:24:01,919
my slides and show you what are the
700
00:24:00,159 --> 00:24:04,480
different basic commands that I want to
701
00:24:01,919 --> 00:24:06,799
run first of all. Okay. So as you can
702
00:24:04,480 --> 00:24:08,720
see it says L provides a CLA to
703
00:24:06,799 --> 00:24:10,240
communicate with the operating system.
704
00:24:08,720 --> 00:24:11,919
Right. So that was a terminal that I
705
00:24:10,240 --> 00:24:14,240
showed you. The CLI is called the
706
00:24:11,919 --> 00:24:15,760
terminal and the CLI is basically it's
707
00:24:14,240 --> 00:24:18,559
better for tasks which cannot be
708
00:24:15,760 --> 00:24:20,320
performed with the GUI. You know uh I
709
00:24:18,559 --> 00:24:21,760
showed you the concept of going to
710
00:24:20,320 --> 00:24:23,440
different directories and different
711
00:24:21,760 --> 00:24:24,880
folders, right? So it was a little
712
00:24:23,440 --> 00:24:27,120
tough. I had to go to go through
713
00:24:24,880 --> 00:24:29,039
multiple directories. So through the GUI
714
00:24:27,120 --> 00:24:30,559
that's one kind of you know drawback.
715
00:24:29,039 --> 00:24:33,679
You'll have to spend a lot of time
716
00:24:30,559 --> 00:24:35,279
navigating. But with the uh CLI it's
717
00:24:33,679 --> 00:24:36,720
easier. It's just one command and you
718
00:24:35,279 --> 00:24:39,279
can access the directory that you want
719
00:24:36,720 --> 00:24:41,520
to. That's the advantage with the CLI.
720
00:24:39,279 --> 00:24:43,279
Okay. And this is just one basic example
721
00:24:41,520 --> 00:24:45,679
that I'm giving you. There are many more
722
00:24:43,279 --> 00:24:46,880
advanced concepts and topics which is
723
00:24:45,679 --> 00:24:49,039
not very easy to perform with the help
724
00:24:46,880 --> 00:24:51,200
of a GUI. So in those places you can
725
00:24:49,039 --> 00:24:53,440
just use the CLI to perform those tasks.
726
00:24:51,200 --> 00:24:55,600
And the CLA is also much faster in quite
727
00:24:53,440 --> 00:24:57,520
a few ways. Okay. So that's the
728
00:24:55,600 --> 00:24:59,200
advantage with the CLI and running the
729
00:24:57,520 --> 00:25:01,600
commands. Basically the first and
730
00:24:59,200 --> 00:25:03,760
foremost you have the pwd. Okay. Now
731
00:25:01,600 --> 00:25:06,159
this stands for print working directory.
732
00:25:03,760 --> 00:25:07,679
Okay. And what it does is it displays
733
00:25:06,159 --> 00:25:09,679
the current working directory of the
734
00:25:07,679 --> 00:25:11,679
terminal. Okay. Then there's this
735
00:25:09,679 --> 00:25:13,520
forward slash and I told you that the
736
00:25:11,679 --> 00:25:16,000
forward slash represents the root
737
00:25:13,520 --> 00:25:18,080
directory. Okay. Now let me go to the
738
00:25:16,000 --> 00:25:20,240
terminal and show you these two things.
739
00:25:18,080 --> 00:25:22,880
So uh right now we are in the home
740
00:25:20,240 --> 00:25:25,279
directory. Okay. Now let me just type it
741
00:25:22,880 --> 00:25:27,440
down. Let me just put pwd. And when I
742
00:25:25,279 --> 00:25:29,600
put pwd it prints the current working
743
00:25:27,440 --> 00:25:33,039
directory. Okay. The presently working
744
00:25:29,600 --> 00:25:36,480
directory. So that is home/reka.
745
00:25:33,039 --> 00:25:40,080
Now uh if I go to the uh computer and
746
00:25:36,480 --> 00:25:41,840
file system and home and inside this eda
747
00:25:40,080 --> 00:25:43,360
then what you see here right so this is
748
00:25:41,840 --> 00:25:45,360
the folder that I'm accessing through my
749
00:25:43,360 --> 00:25:48,640
terminal because the present working
750
00:25:45,360 --> 00:25:50,240
directory is set to this folder okay now
751
00:25:48,640 --> 00:25:51,679
if I want to you know say I want to
752
00:25:50,240 --> 00:25:53,440
change the directory it means I want to
753
00:25:51,679 --> 00:25:54,880
change from this particular folder to a
754
00:25:53,440 --> 00:25:56,320
different folder so there are other
755
00:25:54,880 --> 00:25:57,919
options like desktop folder and
756
00:25:56,320 --> 00:25:59,919
documents folder right if I want to move
757
00:25:57,919 --> 00:26:01,919
to one of these folders then how will I
758
00:25:59,919 --> 00:26:04,159
do it using the terminal so I'm just
759
00:26:01,919 --> 00:26:06,159
going to show you how That is done. I
760
00:26:04,159 --> 00:26:08,240
just want to minimize this a little bit.
761
00:26:06,159 --> 00:26:09,760
Yeah, the command for that is cd space
762
00:26:08,240 --> 00:26:11,279
the name of the folder. Supposing I want
763
00:26:09,760 --> 00:26:13,440
to go to the desktop folder. Then I can
764
00:26:11,279 --> 00:26:15,919
just put dsk
765
00:26:13,440 --> 00:26:18,240
t o p. All right. And when I put enter,
766
00:26:15,919 --> 00:26:19,760
then I'm inside this folder. So earlier
767
00:26:18,240 --> 00:26:21,360
you had you saw this option, right? So
768
00:26:19,760 --> 00:26:22,799
this represents the directory I'm in.
769
00:26:21,360 --> 00:26:24,240
Okay, I was in fact in the home
770
00:26:22,799 --> 00:26:26,799
directory and right now I'm in the
771
00:26:24,240 --> 00:26:29,039
desktop directory. So desktop is uh the
772
00:26:26,799 --> 00:26:31,200
directory inside. And if I want to you
773
00:26:29,039 --> 00:26:33,360
know list down the contents in the uh
774
00:26:31,200 --> 00:26:35,919
desktop then I can run the ls command.
775
00:26:33,360 --> 00:26:38,000
Okay. So when I put ls it basically
776
00:26:35,919 --> 00:26:39,600
lists down the different folders and the
777
00:26:38,000 --> 00:26:42,320
different files that are present in that
778
00:26:39,600 --> 00:26:44,000
directory. Okay. So we have the eclipse
779
00:26:42,320 --> 00:26:46,080
we have lms which is a folder. We have
780
00:26:44,000 --> 00:26:49,279
readme which is another file. We have
781
00:26:46,080 --> 00:26:51,360
all these things. Okay. So let me just
782
00:26:49,279 --> 00:26:53,840
go to the desktop folder and show you
783
00:26:51,360 --> 00:26:55,760
the same. Okay. We have the terminal. We
784
00:26:53,840 --> 00:26:57,279
have the lms which is a folder. And
785
00:26:55,760 --> 00:26:59,919
similarly going back to the terminal if
786
00:26:57,279 --> 00:27:02,799
I want to enter this Linux folder then I
787
00:26:59,919 --> 00:27:05,120
can again uh you know just say cd and
788
00:27:02,799 --> 00:27:07,840
space lms. Okay when I do this I'm
789
00:27:05,120 --> 00:27:09,600
inside this folder. Okay now if I put ls
790
00:27:07,840 --> 00:27:12,159
then I have the list of the folders or
791
00:27:09,600 --> 00:27:15,279
documents are present in this lms
792
00:27:12,159 --> 00:27:16,960
folder. Okay so uh ls is basically the
793
00:27:15,279 --> 00:27:19,520
command to list down the folders or
794
00:27:16,960 --> 00:27:21,600
files in that directory and yeah cd
795
00:27:19,520 --> 00:27:23,600
space the file name or the directory
796
00:27:21,600 --> 00:27:25,440
name would move you to that particular
797
00:27:23,600 --> 00:27:27,600
directory. Now that is the same thing
798
00:27:25,440 --> 00:27:30,240
that I've discussed in uh this slide
799
00:27:27,600 --> 00:27:31,919
here also. Okay. So I spoke about the
800
00:27:30,240 --> 00:27:33,919
present working directory which displays
801
00:27:31,919 --> 00:27:35,840
the current uh directory that your
802
00:27:33,919 --> 00:27:37,840
terminal is uh in and then you have the
803
00:27:35,840 --> 00:27:40,080
root directory from where all your
804
00:27:37,840 --> 00:27:41,520
directories or folders are marked right.
805
00:27:40,080 --> 00:27:43,279
So everything can be accessed from the
806
00:27:41,520 --> 00:27:44,640
root directory. So that is this and then
807
00:27:43,279 --> 00:27:47,120
you have something called as the echo
808
00:27:44,640 --> 00:27:49,279
command. You have the su and the pseudo
809
00:27:47,120 --> 00:27:51,360
commands. Okay. Uh these are something a
810
00:27:49,279 --> 00:27:53,840
little advanced. So before I show this
811
00:27:51,360 --> 00:27:55,840
let me show you the uh clear command.
812
00:27:53,840 --> 00:27:58,320
Let me explain the clear command. Okay.
813
00:27:55,840 --> 00:28:01,279
Now getting back to my u terminal. When
814
00:27:58,320 --> 00:28:02,880
I type clear, the whole uh CLI is
815
00:28:01,279 --> 00:28:04,960
cleared, right? My terminal is cleared.
816
00:28:02,880 --> 00:28:07,279
So whatever commands I ran previously,
817
00:28:04,960 --> 00:28:08,640
those are not present anymore. But what
818
00:28:07,279 --> 00:28:10,320
happens is those commands, they don't
819
00:28:08,640 --> 00:28:12,480
get deleted or something. They are just
820
00:28:10,320 --> 00:28:14,399
scrolled down. So as you can see, they
821
00:28:12,480 --> 00:28:16,559
are still present here. So when I scroll
822
00:28:14,399 --> 00:28:18,159
down, what happens is, you know, it just
823
00:28:16,559 --> 00:28:19,520
makes sure that the other documents or
824
00:28:18,159 --> 00:28:22,080
the other commands that I specified
825
00:28:19,520 --> 00:28:24,080
earlier, those are all hidden and I'm
826
00:28:22,080 --> 00:28:27,679
showed something new. So that's what
827
00:28:24,080 --> 00:28:29,440
happens here. Okay. So that is this. Now
828
00:28:27,679 --> 00:28:30,640
I told you that you know by giving CD
829
00:28:29,440 --> 00:28:31,760
you can go to the directory or the
830
00:28:30,640 --> 00:28:34,000
folder that's in the present working
831
00:28:31,760 --> 00:28:35,520
directory. Right. But how about going
832
00:28:34,000 --> 00:28:37,279
back to the previous directory. So
833
00:28:35,520 --> 00:28:39,279
basically from EDA folder to go to
834
00:28:37,279 --> 00:28:41,200
desktop we clicked on this and then we
835
00:28:39,279 --> 00:28:43,760
entered this folder. Right? So from this
836
00:28:41,200 --> 00:28:45,600
directory by clicking on LMS you go to a
837
00:28:43,760 --> 00:28:47,760
different directory. Right? So you go in
838
00:28:45,600 --> 00:28:49,520
here but using the GUI you can just
839
00:28:47,760 --> 00:28:51,120
click on the uh cross mark here and you
840
00:28:49,520 --> 00:28:52,320
can exit that directory. But how about
841
00:28:51,120 --> 00:28:54,240
you're doing that with the help of the
842
00:28:52,320 --> 00:28:56,720
terminal. How will you do it here? So to
843
00:28:54,240 --> 00:28:59,039
do that we have the option called CD
844
00:28:56,720 --> 00:29:00,720
space two period marks period marks or
845
00:28:59,039 --> 00:29:03,760
full stop. So that's what we call right
846
00:29:00,720 --> 00:29:05,279
dot. So if you have two dots after CD
847
00:29:03,760 --> 00:29:07,120
this means you want to navigate to the
848
00:29:05,279 --> 00:29:09,200
previous directory. So we are currently
849
00:29:07,120 --> 00:29:11,360
in the LMS and when I give enter I'm
850
00:29:09,200 --> 00:29:13,760
back to the desktop folder right the
851
00:29:11,360 --> 00:29:15,919
desktop directory. Now again if I uh
852
00:29:13,760 --> 00:29:18,320
give the same command again then from
853
00:29:15,919 --> 00:29:21,120
desktop I need to go back to this edurea
854
00:29:18,320 --> 00:29:23,120
directory. Correct? So there we go. Till
855
00:29:21,120 --> 00:29:26,080
day symbol here it represents that we
856
00:29:23,120 --> 00:29:28,080
are in the home directory. Okay. So the
857
00:29:26,080 --> 00:29:29,840
home directory is basically I can also
858
00:29:28,080 --> 00:29:32,960
access the home directory by just giving
859
00:29:29,840 --> 00:29:34,960
cd and enter. Okay that I can do it from
860
00:29:32,960 --> 00:29:36,720
any other directory. So let's say I am
861
00:29:34,960 --> 00:29:40,080
just doing an ls and I'm changing
862
00:29:36,720 --> 00:29:42,720
directory to downloads. Okay. D O w n l
863
00:29:40,080 --> 00:29:45,760
o a ds. Okay. So just you got to
864
00:29:42,720 --> 00:29:47,200
remember to give the exact name of the
865
00:29:45,760 --> 00:29:48,399
folder or the directory that you want to
866
00:29:47,200 --> 00:29:50,480
travel to. So only then it'll work.
867
00:29:48,399 --> 00:29:52,720
Otherwise, if you just give d, it won't
868
00:29:50,480 --> 00:29:54,080
really work. Okay. So, after this uh if
869
00:29:52,720 --> 00:29:56,480
you give enter, then you go to the
870
00:29:54,080 --> 00:29:58,720
downloads uh folder. And uh do we have
871
00:29:56,480 --> 00:30:00,720
anything inside downloads? No, we don't
872
00:29:58,720 --> 00:30:03,120
have any other folder or directory under
873
00:30:00,720 --> 00:30:04,640
download. So, now let's try going to the
874
00:30:03,120 --> 00:30:06,799
uh home directory from here straight
875
00:30:04,640 --> 00:30:09,360
away. Okay. So, I initially told you
876
00:30:06,799 --> 00:30:11,039
that by having two period marks after uh
877
00:30:09,360 --> 00:30:13,360
you know CD, you go to the previous
878
00:30:11,039 --> 00:30:16,480
directory in that path, right? So
879
00:30:13,360 --> 00:30:17,840
instead of that if I uh just give a cd
880
00:30:16,480 --> 00:30:19,200
okay and if I give enter then I'll
881
00:30:17,840 --> 00:30:21,120
straight away go to the home directory
882
00:30:19,200 --> 00:30:22,559
and this is with respect to uh any
883
00:30:21,120 --> 00:30:24,799
directory no matter in uh which
884
00:30:22,559 --> 00:30:27,360
directory I am in so if I just give cd
885
00:30:24,799 --> 00:30:30,000
then it'll go to the home directory okay
886
00:30:27,360 --> 00:30:32,080
so that's what the benefit with the cd
887
00:30:30,000 --> 00:30:34,080
command is you can give cd to move to
888
00:30:32,080 --> 00:30:36,799
any directory okay so I have a question
889
00:30:34,080 --> 00:30:39,600
here from uh shashiant and shashikant is
890
00:30:36,799 --> 00:30:41,039
asking me uh should we have to do cd and
891
00:30:39,600 --> 00:30:43,120
ls every time it seems a little
892
00:30:41,039 --> 00:30:45,360
complicated so shashikant You don't need
893
00:30:43,120 --> 00:30:47,200
to really do that because uh I was just
894
00:30:45,360 --> 00:30:48,720
about to get to that point. Okay, if you
895
00:30:47,200 --> 00:30:50,159
want to go to a different directory or a
896
00:30:48,720 --> 00:30:52,559
different folder, you don't need to give
897
00:30:50,159 --> 00:30:55,200
cd and ls every time. Okay, so ls is
898
00:30:52,559 --> 00:30:56,159
basically only for you to figure out or
899
00:30:55,200 --> 00:30:57,520
understand what are the different
900
00:30:56,159 --> 00:30:59,919
directories inside a particular
901
00:30:57,520 --> 00:31:01,440
directory. Okay, if I know the path then
902
00:30:59,919 --> 00:31:03,760
I can just feed it right away in one
903
00:31:01,440 --> 00:31:05,919
command and enter that directory. Now
904
00:31:03,760 --> 00:31:08,080
let's say I am currently in the CD
905
00:31:05,919 --> 00:31:09,760
directory. So this is uh CD. So this is
906
00:31:08,080 --> 00:31:11,919
my home directory. Okay. Okay. Now if I
907
00:31:09,760 --> 00:31:13,440
click on desktop and if I click on LMS
908
00:31:11,919 --> 00:31:15,360
and then you have another folder here.
909
00:31:13,440 --> 00:31:17,919
Okay. You have hedge base. Okay. Now
910
00:31:15,360 --> 00:31:20,240
supposing I want to go to any of these
911
00:31:17,919 --> 00:31:21,760
uh directories from my terminal then I
912
00:31:20,240 --> 00:31:24,240
don't have to you know put CD three
913
00:31:21,760 --> 00:31:25,840
different times and uh followed by ls
914
00:31:24,240 --> 00:31:27,760
and then go to those directories. I can
915
00:31:25,840 --> 00:31:29,679
just uh specify this thing in just one
916
00:31:27,760 --> 00:31:32,559
command. So what I'm going to do is I'm
917
00:31:29,679 --> 00:31:34,399
going to say cd space or since right now
918
00:31:32,559 --> 00:31:38,559
we are in the uh home directory I need
919
00:31:34,399 --> 00:31:40,640
to give uh desktop. Okay. Now one more
920
00:31:38,559 --> 00:31:42,320
thing which I want to show you people is
921
00:31:40,640 --> 00:31:44,240
there is this option of tab on your
922
00:31:42,320 --> 00:31:46,399
keyboard right when you give tab then
923
00:31:44,240 --> 00:31:48,880
the command here will be autofilled
924
00:31:46,399 --> 00:31:51,919
right the option will be autofilled so
925
00:31:48,880 --> 00:31:53,840
uh let me explain that again so I'm just
926
00:31:51,919 --> 00:31:55,600
going to go back so in the home
927
00:31:53,840 --> 00:31:57,760
directory right so you have different
928
00:31:55,600 --> 00:31:59,600
options you have desktop and documents
929
00:31:57,760 --> 00:32:02,559
so what I'm going to show you is by
930
00:31:59,600 --> 00:32:05,039
clicking on uh cd and space and then if
931
00:32:02,559 --> 00:32:07,600
I just type three or four characters of
932
00:32:05,039 --> 00:32:10,559
desk okay I want to go to this directory
933
00:32:07,600 --> 00:32:13,120
But I've just typed dsk. Okay. Now if I
934
00:32:10,559 --> 00:32:14,720
click on tab then the remaining uh
935
00:32:13,120 --> 00:32:16,240
characters of that particular option is
936
00:32:14,720 --> 00:32:18,159
already filled. Okay. It gets
937
00:32:16,240 --> 00:32:19,440
autofilled. So that is what the tab
938
00:32:18,159 --> 00:32:21,919
would do. By clicking on tab it will get
939
00:32:19,440 --> 00:32:23,840
autofilled. So similarly under desktop
940
00:32:21,919 --> 00:32:26,000
you have the option of LMS. Right? So
941
00:32:23,840 --> 00:32:28,080
I'll just put L and if I press tab the
942
00:32:26,000 --> 00:32:30,000
remaining will get autofilled. Correct?
943
00:32:28,080 --> 00:32:31,679
And inside LMS you have different
944
00:32:30,000 --> 00:32:33,200
directories. We saw that we have
945
00:32:31,679 --> 00:32:36,320
hedgebas we have hive and all these
946
00:32:33,200 --> 00:32:37,840
things. So let me go there and show you
947
00:32:36,320 --> 00:32:40,320
what are the different directories that
948
00:32:37,840 --> 00:32:43,440
are there. So we have hbase, hive, map
949
00:32:40,320 --> 00:32:45,440
reduce and uzi. Okay. Now uh let's go to
950
00:32:43,440 --> 00:32:48,240
the terminal again. Supposing I want to
951
00:32:45,440 --> 00:32:50,320
go to uzi directory. Okay. Now when I
952
00:32:48,240 --> 00:32:53,360
just click on capital and if I click on
953
00:32:50,320 --> 00:32:55,760
tab then uh it kind of autofills the
954
00:32:53,360 --> 00:32:58,000
directory. Okay. But in case let's take
955
00:32:55,760 --> 00:32:59,919
the example of h or hb over here. Okay.
956
00:32:58,000 --> 00:33:02,159
Now since both start with h I'm going to
957
00:32:59,919 --> 00:33:03,919
type h and if I click on tab that
958
00:33:02,159 --> 00:33:06,000
doesn't work. Okay. It gives me further
959
00:33:03,919 --> 00:33:08,320
options of HB and hive. So that is
960
00:33:06,000 --> 00:33:10,159
because there are more than one options
961
00:33:08,320 --> 00:33:11,840
for uh you know starting with H right?
962
00:33:10,159 --> 00:33:13,279
There are more than one folders or
963
00:33:11,840 --> 00:33:14,480
directories that start with H. So that's
964
00:33:13,279 --> 00:33:16,480
why you're getting further options.
965
00:33:14,480 --> 00:33:18,320
That's why it's not autofill length. But
966
00:33:16,480 --> 00:33:20,799
if you see the second character here is
967
00:33:18,320 --> 00:33:23,039
B and the second character here is I. So
968
00:33:20,799 --> 00:33:24,960
if you either give B and now if you
969
00:33:23,039 --> 00:33:28,159
press tab then HB is what is going to be
970
00:33:24,960 --> 00:33:30,799
picked up. Okay. Because uh after H and
971
00:33:28,159 --> 00:33:33,440
B there's only the only option is uh of
972
00:33:30,799 --> 00:33:36,480
HB. There's no other folder that has HB
973
00:33:33,440 --> 00:33:38,880
as the first letters of the name. So
974
00:33:36,480 --> 00:33:40,559
similarly, if I just type IV and if I do
975
00:33:38,880 --> 00:33:42,880
tab, then hive gets autofilled. So
976
00:33:40,559 --> 00:33:45,039
things like that. So uh since our
977
00:33:42,880 --> 00:33:47,679
mission was to go to the HB uh
978
00:33:45,039 --> 00:33:50,640
directory, I'm just going to say HB.
979
00:33:47,679 --> 00:33:52,880
Okay. Now inside HBase, I wanted to go
980
00:33:50,640 --> 00:33:55,440
to one of the directories in here. So
981
00:33:52,880 --> 00:33:56,960
let's say we go to advanced Hedgebase
982
00:33:55,440 --> 00:33:58,320
practicals. Okay. Now for that, if you
983
00:33:56,960 --> 00:34:00,880
want to go there, then you just got to
984
00:33:58,320 --> 00:34:02,720
give this. Okay. So this is your
985
00:34:00,880 --> 00:34:05,039
complete path to access that particular
986
00:34:02,720 --> 00:34:07,519
folder and when I give enter then I am
987
00:34:05,039 --> 00:34:10,079
in uh the advanced hedgebased practicals
988
00:34:07,519 --> 00:34:11,919
module 9. Okay. So I'm in this
989
00:34:10,079 --> 00:34:14,079
particular folder or this particular
990
00:34:11,919 --> 00:34:15,839
directory. So that is what you can do
991
00:34:14,079 --> 00:34:18,320
with the help of feeding a path after
992
00:34:15,839 --> 00:34:19,919
CD. So now if I want to go back to my
993
00:34:18,320 --> 00:34:25,200
home directory I'm just going to click
994
00:34:19,919 --> 00:34:27,760
on cd and put enter. Okay. So uh that is
995
00:34:25,200 --> 00:34:30,000
this. Now let me go back to my slides.
996
00:34:27,760 --> 00:34:33,119
I'm just going to close all these uh
997
00:34:30,000 --> 00:34:35,119
folders. Okay. Now, going back to my
998
00:34:33,119 --> 00:34:36,480
slides, I showed you the print working
999
00:34:35,119 --> 00:34:38,560
directory command and I showed you the
1000
00:34:36,480 --> 00:34:41,520
root directory and uh I showed you the
1001
00:34:38,560 --> 00:34:42,800
clear. Okay. So, the echo and the pseudo
1002
00:34:41,520 --> 00:34:45,839
commands are something that I did not
1003
00:34:42,800 --> 00:34:49,200
show you. But I also spoke about the ls
1004
00:34:45,839 --> 00:34:51,200
and the cd commands. Right? So, what I'm
1005
00:34:49,200 --> 00:34:53,440
going to do is uh before I go into
1006
00:34:51,200 --> 00:34:54,960
details of cd and ls, right? I'm going
1007
00:34:53,440 --> 00:34:57,520
to just show you the echo command and
1008
00:34:54,960 --> 00:35:00,720
the uh pseudo user. Okay? Now going back
1009
00:34:57,520 --> 00:35:04,160
to my terminal, the echo command, right?
1010
00:35:00,720 --> 00:35:05,839
So what is uh the echo command? So uh
1011
00:35:04,160 --> 00:35:07,920
what is the echo command? Echo command
1012
00:35:05,839 --> 00:35:09,599
is something that writes its arguments
1013
00:35:07,920 --> 00:35:11,920
to standard output. So when we say
1014
00:35:09,599 --> 00:35:14,480
arguments, it means whatever we type
1015
00:35:11,920 --> 00:35:16,320
after uh echo, we'll type echo space and
1016
00:35:14,480 --> 00:35:17,839
followed by that whatever we write so
1017
00:35:16,320 --> 00:35:19,839
that will be specified to standard
1018
00:35:17,839 --> 00:35:21,119
output. And when we say standard output,
1019
00:35:19,839 --> 00:35:23,599
uh it is the output that will be
1020
00:35:21,119 --> 00:35:24,800
displayed by the u CLI. So in your
1021
00:35:23,599 --> 00:35:26,320
terminal whatever output you get so
1022
00:35:24,800 --> 00:35:27,760
you'll get specified to that particular
1023
00:35:26,320 --> 00:35:30,160
standard output. Okay. Now let me show
1024
00:35:27,760 --> 00:35:33,200
you a practical example only then you'll
1025
00:35:30,160 --> 00:35:35,520
be able to understand that. So let just
1026
00:35:33,200 --> 00:35:38,079
clear the screen. So another shortcut to
1027
00:35:35,520 --> 00:35:39,920
clear the screen is ctr L. Okay. If not
1028
00:35:38,079 --> 00:35:41,680
you can just give the clear command like
1029
00:35:39,920 --> 00:35:43,839
this. Okay. This will clear your screen.
1030
00:35:41,680 --> 00:35:45,359
Otherwise you can just give control + L
1031
00:35:43,839 --> 00:35:47,040
which will again uh you know just clear
1032
00:35:45,359 --> 00:35:49,520
the screen. It's a keyboard shortcut.
1033
00:35:47,040 --> 00:35:51,680
Okay. So I told you that I was talking
1034
00:35:49,520 --> 00:35:54,320
about the echo command. So when I say
1035
00:35:51,680 --> 00:35:56,880
echo and if I give enter then there is
1036
00:35:54,320 --> 00:36:00,880
nothing that is displayed. But if I uh
1037
00:35:56,880 --> 00:36:03,040
say echo and say hi see what the output
1038
00:36:00,880 --> 00:36:04,480
came. So when we executed this command
1039
00:36:03,040 --> 00:36:08,640
this was the output that came back. It
1040
00:36:04,480 --> 00:36:11,280
says hi and uh if I say echo hi my name
1041
00:36:08,640 --> 00:36:15,040
is uh
1042
00:36:11,280 --> 00:36:16,800
vdan. When I say this then whatever uh
1043
00:36:15,040 --> 00:36:18,000
was specified as arguments right? So
1044
00:36:16,800 --> 00:36:19,760
this was basically specified as
1045
00:36:18,000 --> 00:36:22,000
arguments to this command. So the
1046
00:36:19,760 --> 00:36:22,880
argument is specified as uh the output.
1047
00:36:22,000 --> 00:36:24,320
This is the takeaway from the
1048
00:36:22,880 --> 00:36:25,920
definition. So the definition was
1049
00:36:24,320 --> 00:36:27,599
basically that whatever the argument is
1050
00:36:25,920 --> 00:36:29,359
that is specified to standard output. So
1051
00:36:27,599 --> 00:36:31,760
that's what it happens. So that's what
1052
00:36:29,359 --> 00:36:33,680
comes here. So this is one thing and in
1053
00:36:31,760 --> 00:36:35,920
fact there's another uh functionality
1054
00:36:33,680 --> 00:36:37,760
also. Now uh you were all aware of the
1055
00:36:35,920 --> 00:36:39,680
concept of variables, right? So we can
1056
00:36:37,760 --> 00:36:41,280
assign some kind of value to a variable
1057
00:36:39,680 --> 00:36:44,480
and we can also print that with the help
1058
00:36:41,280 --> 00:36:47,359
of the echo command. Now u let's say
1059
00:36:44,480 --> 00:36:51,359
that we have a variable x okay and let's
1060
00:36:47,359 --> 00:36:55,280
give it a value 100 okay so now if I uh
1061
00:36:51,359 --> 00:36:57,200
just say echo dollar x then the value
1062
00:36:55,280 --> 00:36:59,680
that is stored in this variable right
1063
00:36:57,200 --> 00:37:01,280
that be printed uh because echo is
1064
00:36:59,680 --> 00:37:03,680
something that's just going to print the
1065
00:37:01,280 --> 00:37:05,440
uh argument to standard output okay
1066
00:37:03,680 --> 00:37:07,839
it'll display the value that is present
1067
00:37:05,440 --> 00:37:09,359
over here so if it's just a string then
1068
00:37:07,839 --> 00:37:11,599
that will be printed and if it's a
1069
00:37:09,359 --> 00:37:13,359
variable that I'm specifying then even
1070
00:37:11,599 --> 00:37:15,839
that will be printed So the difference
1071
00:37:13,359 --> 00:37:18,720
between uh the variable and string is
1072
00:37:15,839 --> 00:37:21,440
this dollar. Okay. Now if I just give
1073
00:37:18,720 --> 00:37:23,760
echo dollar x then I've set the 100
1074
00:37:21,440 --> 00:37:26,240
value to x. Right? So that 100 will be
1075
00:37:23,760 --> 00:37:29,119
printed here. So like I told you 100 is
1076
00:37:26,240 --> 00:37:31,119
printed. But uh the same thing if I give
1077
00:37:29,119 --> 00:37:32,880
echo x without the dollar then see
1078
00:37:31,119 --> 00:37:34,320
what's printed. It is x which is
1079
00:37:32,880 --> 00:37:37,359
printed. So that is the difference
1080
00:37:34,320 --> 00:37:39,440
between the string and a variable. Okay.
1081
00:37:37,359 --> 00:37:41,520
So you can you know have again a
1082
00:37:39,440 --> 00:37:43,599
variable uh called name or you can have
1083
00:37:41,520 --> 00:37:45,280
a variable called van and you can store
1084
00:37:43,599 --> 00:37:46,720
the value of 10. Okay. But if you want
1085
00:37:45,280 --> 00:37:48,640
the value to be displayed then you got
1086
00:37:46,720 --> 00:37:50,720
to append dollar before the variable
1087
00:37:48,640 --> 00:37:53,280
name. Okay. So that is about the echo
1088
00:37:50,720 --> 00:37:55,440
command and uh in fact there are lot of
1089
00:37:53,280 --> 00:37:57,040
advantages with this command and I will
1090
00:37:55,440 --> 00:37:58,720
talk about the other features and the
1091
00:37:57,040 --> 00:38:00,480
other places where this is used later
1092
00:37:58,720 --> 00:38:02,240
during the session but uh till then this
1093
00:38:00,480 --> 00:38:05,119
kind of an introduction is enough for
1094
00:38:02,240 --> 00:38:08,079
now. Okay. So going back to the uh
1095
00:38:05,119 --> 00:38:12,000
slides what else do I have? Uh okay so
1096
00:38:08,079 --> 00:38:14,160
we have the su command correct so as it
1097
00:38:12,000 --> 00:38:17,040
says su is used to switch to the root
1098
00:38:14,160 --> 00:38:18,960
user okay uh so that use super user
1099
00:38:17,040 --> 00:38:21,760
permissions can be used to execute
1100
00:38:18,960 --> 00:38:23,839
commands all right and then you have su
1101
00:38:21,760 --> 00:38:26,079
username used to switch to a different
1102
00:38:23,839 --> 00:38:27,599
user and then you have pseudo command
1103
00:38:26,079 --> 00:38:29,200
which executes only that particular
1104
00:38:27,599 --> 00:38:31,119
command with the root or super user
1105
00:38:29,200 --> 00:38:32,880
privileges now what these three what
1106
00:38:31,119 --> 00:38:35,440
they essentially mean is that you get
1107
00:38:32,880 --> 00:38:37,599
more permissions so if I go back to my
1108
00:38:35,440 --> 00:38:40,640
terminal so if If you guys remember then
1109
00:38:37,599 --> 00:38:43,200
I logged into CentOS with the Edka user
1110
00:38:40,640 --> 00:38:46,960
right so that is uh displayed here also.
1111
00:38:43,200 --> 00:38:49,359
So uh it says EDA at localhost right. So
1112
00:38:46,960 --> 00:38:50,880
uh this is the username of this account
1113
00:38:49,359 --> 00:38:53,680
and uh similarly you have something
1114
00:38:50,880 --> 00:38:55,440
called as the root user okay this is my
1115
00:38:53,680 --> 00:38:58,000
user and then you have the root user and
1116
00:38:55,440 --> 00:38:59,599
what the root user is is the root user
1117
00:38:58,000 --> 00:39:01,680
gives you a lot of permissions. So
1118
00:38:59,599 --> 00:39:03,920
that's like the ultimate uh super user
1119
00:39:01,680 --> 00:39:05,760
of this particular system. So basically
1120
00:39:03,920 --> 00:39:08,880
if there is any folder that cannot be
1121
00:39:05,760 --> 00:39:11,599
accessed uh by my user okay my user name
1122
00:39:08,880 --> 00:39:13,440
is uh and if I do not have the
1123
00:39:11,599 --> 00:39:15,839
permissions to access that particular uh
1124
00:39:13,440 --> 00:39:18,079
directory or that particular folder then
1125
00:39:15,839 --> 00:39:19,760
we can use the root user because root
1126
00:39:18,079 --> 00:39:21,599
has the ultimate privileges so any
1127
00:39:19,760 --> 00:39:24,320
command that is executed with the root
1128
00:39:21,599 --> 00:39:26,079
user then that will be executed okay so
1129
00:39:24,320 --> 00:39:28,000
because root has all the privileges it
1130
00:39:26,079 --> 00:39:30,400
has all the permissions so that's what
1131
00:39:28,000 --> 00:39:32,160
uh the root user is and uh you know
1132
00:39:30,400 --> 00:39:34,640
there are certain uh functionalities
1133
00:39:32,160 --> 00:39:36,480
which need the SU user or the root
1134
00:39:34,640 --> 00:39:38,000
user's uh permission. And I will show
1135
00:39:36,480 --> 00:39:39,760
you all those things later. But for now,
1136
00:39:38,000 --> 00:39:42,240
what you need to understand is by just
1137
00:39:39,760 --> 00:39:44,640
giving SU then you can switch to the
1138
00:39:42,240 --> 00:39:46,079
root user. Okay. And it asks for the
1139
00:39:44,640 --> 00:39:47,839
password. Of course, you got to know
1140
00:39:46,079 --> 00:39:49,280
what is the password for your root user.
1141
00:39:47,839 --> 00:39:50,880
And when you give the password, you will
1142
00:39:49,280 --> 00:39:53,200
be logged in as a root user. So you're
1143
00:39:50,880 --> 00:39:55,680
not eda anymore. Okay. And as you can
1144
00:39:53,200 --> 00:39:57,760
see here, you are root at rate local. So
1145
00:39:55,680 --> 00:40:00,160
this is the host name and this is my uh
1146
00:39:57,760 --> 00:40:01,200
username. Okay. Root. So earlier you
1147
00:40:00,160 --> 00:40:03,359
might have noticed that there was a
1148
00:40:01,200 --> 00:40:05,680
dollar symbol. Okay. But now it is a
1149
00:40:03,359 --> 00:40:07,440
hash. So this basically this hashtag
1150
00:40:05,680 --> 00:40:09,040
represents that we are inside the root
1151
00:40:07,440 --> 00:40:11,119
user and we are accessing the you know
1152
00:40:09,040 --> 00:40:12,720
executing commands as a root user. So
1153
00:40:11,119 --> 00:40:14,720
that's what it means. And if you want to
1154
00:40:12,720 --> 00:40:17,040
get out or exit the root user then you
1155
00:40:14,720 --> 00:40:18,640
can just type exit and give enter. So
1156
00:40:17,040 --> 00:40:20,400
now you're back as yourself. Now you're
1157
00:40:18,640 --> 00:40:22,720
going to be executing commands as eda
1158
00:40:20,400 --> 00:40:24,320
user. Okay. And uh another thing that
1159
00:40:22,720 --> 00:40:25,680
you can do is if you have multiple users
1160
00:40:24,320 --> 00:40:27,839
okay and if you want to switch to one of
1161
00:40:25,680 --> 00:40:30,480
the other users then you can also give
1162
00:40:27,839 --> 00:40:33,200
the su command and go to switch to the
1163
00:40:30,480 --> 00:40:35,520
user. uh supposing the username is uh
1164
00:40:33,200 --> 00:40:38,640
let's say ABC is the username then I can
1165
00:40:35,520 --> 00:40:41,040
just give su space ABC okay now since I
1166
00:40:38,640 --> 00:40:43,040
don't have any user uh uh you know a
1167
00:40:41,040 --> 00:40:44,640
user account called ABC it will probably
1168
00:40:43,040 --> 00:40:46,720
throw me an error or tell me that it
1169
00:40:44,640 --> 00:40:48,400
does not exist okay but the point that
1170
00:40:46,720 --> 00:40:50,240
you need to note is that if you have any
1171
00:40:48,400 --> 00:40:52,720
user then you can just switch to that
1172
00:40:50,240 --> 00:40:55,680
user from the terminal by using the su
1173
00:40:52,720 --> 00:40:58,400
command okay su space the name of the
1174
00:40:55,680 --> 00:41:00,079
user account so again uh later during
1175
00:40:58,400 --> 00:41:02,160
the session there's a topic about uh
1176
00:41:00,079 --> 00:41:03,920
creating and deleting user. So at that
1177
00:41:02,160 --> 00:41:05,920
time I will show you how you can switch
1178
00:41:03,920 --> 00:41:07,839
to another user uh from the terminal.
1179
00:41:05,920 --> 00:41:09,839
Okay. So let's park it for for later
1180
00:41:07,839 --> 00:41:12,720
because it's a little complicated if I
1181
00:41:09,839 --> 00:41:14,800
tell you that right now. So u I think
1182
00:41:12,720 --> 00:41:17,680
I've covered pretty much uh everything
1183
00:41:14,800 --> 00:41:20,960
about su and there's one other command
1184
00:41:17,680 --> 00:41:23,520
called pseudo. Okay. So sudo basically
1185
00:41:20,960 --> 00:41:26,640
lets you execute a particular command as
1186
00:41:23,520 --> 00:41:29,280
a root user. So when I give uh sudo and
1187
00:41:26,640 --> 00:41:30,960
ls then what happens is uh this
1188
00:41:29,280 --> 00:41:32,720
particular command ls command which will
1189
00:41:30,960 --> 00:41:35,119
list down all the other directories or
1190
00:41:32,720 --> 00:41:37,200
folders in the current working directory
1191
00:41:35,119 --> 00:41:41,040
right so this will be executed as a root
1192
00:41:37,200 --> 00:41:43,040
user okay so uh similarly so earlier I
1193
00:41:41,040 --> 00:41:44,640
executed the su command and I gave a
1194
00:41:43,040 --> 00:41:47,119
password for that the difference between
1195
00:41:44,640 --> 00:41:48,720
the two is that with the help of p sudo
1196
00:41:47,119 --> 00:41:50,800
then only that particular command will
1197
00:41:48,720 --> 00:41:52,640
be executed as a root user but whereas
1198
00:41:50,800 --> 00:41:54,800
with su then the entire set of commands
1199
00:41:52,640 --> 00:41:57,280
after that will be executed as the root
1200
00:41:54,800 --> 00:41:59,280
user as you will be logged in as a root
1201
00:41:57,280 --> 00:42:01,200
user itself. So let me just show it to
1202
00:41:59,280 --> 00:42:03,359
you again. So this was the ls command
1203
00:42:01,200 --> 00:42:06,160
which I executed as a pseudo user. Okay,
1204
00:42:03,359 --> 00:42:09,119
as a pseudo user or as a root user. But
1205
00:42:06,160 --> 00:42:11,680
if I just give su and if I give the
1206
00:42:09,119 --> 00:42:13,760
password then I enter and I can uh enter
1207
00:42:11,680 --> 00:42:16,560
the same details. Okay, I can put the
1208
00:42:13,760 --> 00:42:18,720
same command ls as a root user. So
1209
00:42:16,560 --> 00:42:20,319
basically the kind of results I get will
1210
00:42:18,720 --> 00:42:22,400
be the same. Okay, but it's just the
1211
00:42:20,319 --> 00:42:24,640
difference is that the uh user that will
1212
00:42:22,400 --> 00:42:27,440
be executing that particular command. So
1213
00:42:24,640 --> 00:42:30,160
I hope uh this clears your doubt. Okay,
1214
00:42:27,440 --> 00:42:32,160
so I'm just going to say exit and clear
1215
00:42:30,160 --> 00:42:33,760
the screen. And if I go back to my
1216
00:42:32,160 --> 00:42:35,839
slides, I'll just read out the
1217
00:42:33,760 --> 00:42:37,599
definition. So sudo basically executes
1218
00:42:35,839 --> 00:42:40,160
only that particular command with the
1219
00:42:37,599 --> 00:42:41,839
root or the super user privileges. Okay.
1220
00:42:40,160 --> 00:42:43,680
And uh when you give pseudo username,
1221
00:42:41,839 --> 00:42:45,520
you can switch to a different user and
1222
00:42:43,680 --> 00:42:47,760
when you give SEO, you can switch to the
1223
00:42:45,520 --> 00:42:49,440
root user. So that's what uh I showed
1224
00:42:47,760 --> 00:42:51,280
you the differences between the three.
1225
00:42:49,440 --> 00:42:52,960
You first give SEO and then it'll ask
1226
00:42:51,280 --> 00:42:54,640
you for the password. You specify the
1227
00:42:52,960 --> 00:42:56,560
password and then you'll be logged in as
1228
00:42:54,640 --> 00:42:58,160
a root user and then you can execute
1229
00:42:56,560 --> 00:42:59,680
your uh commands. You can execute any
1230
00:42:58,160 --> 00:43:02,160
number of commands you want to and then
1231
00:42:59,680 --> 00:43:03,680
you can exit that particular root access
1232
00:43:02,160 --> 00:43:05,760
and then come come out of it. And if you
1233
00:43:03,680 --> 00:43:08,000
want to execute another command with the
1234
00:43:05,760 --> 00:43:09,440
uh root permission okay and if it's just
1235
00:43:08,000 --> 00:43:11,599
one command which you want to execute
1236
00:43:09,440 --> 00:43:13,760
then you can just give pseudo and then
1237
00:43:11,599 --> 00:43:16,160
you can put your command there. Right?
1238
00:43:13,760 --> 00:43:18,400
So I will uh you know talk about these
1239
00:43:16,160 --> 00:43:20,000
things later but uh for now what you
1240
00:43:18,400 --> 00:43:22,720
need to understand is the basics and
1241
00:43:20,000 --> 00:43:24,640
these are the basics okay the pwd the
1242
00:43:22,720 --> 00:43:26,560
echo the su commands because all these
1243
00:43:24,640 --> 00:43:29,200
things come in handy when you go to the
1244
00:43:26,560 --> 00:43:32,240
advanced uh concepts. So going on to the
1245
00:43:29,200 --> 00:43:35,200
next slide we have the ls commands here.
1246
00:43:32,240 --> 00:43:36,880
Okay I showed you one command that is
1247
00:43:35,200 --> 00:43:38,640
what happens when you just put the ls
1248
00:43:36,880 --> 00:43:40,800
command. So now there are different
1249
00:43:38,640 --> 00:43:44,640
options that you can use along with the
1250
00:43:40,800 --> 00:43:46,240
ls right. So basically ls stands for
1251
00:43:44,640 --> 00:43:49,119
listing all the contents in the current
1252
00:43:46,240 --> 00:43:51,359
working directory. Okay. And uh if I go
1253
00:43:49,119 --> 00:43:53,599
back to my slides right now we are in
1254
00:43:51,359 --> 00:43:56,319
the uh home directory. And if I give ls
1255
00:43:53,599 --> 00:43:58,400
here it'll list down all the directories
1256
00:43:56,319 --> 00:44:00,560
that are uh present in my home
1257
00:43:58,400 --> 00:44:02,560
directory. Okay. So let me just clear
1258
00:44:00,560 --> 00:44:04,560
the screen and execute that again. ls.
1259
00:44:02,560 --> 00:44:06,319
So uh right now we have desktop
1260
00:44:04,560 --> 00:44:07,839
downloads and music. So these three are
1261
00:44:06,319 --> 00:44:09,200
some folders. We have documents which is
1262
00:44:07,839 --> 00:44:12,319
another folder. All these things are
1263
00:44:09,200 --> 00:44:14,640
folders and these are documents. Okay,
1264
00:44:12,319 --> 00:44:16,079
documents and files. So these are the uh
1265
00:44:14,640 --> 00:44:18,319
directories or folders. These are the
1266
00:44:16,079 --> 00:44:20,800
documents or files. So this is what you
1267
00:44:18,319 --> 00:44:22,880
get when you execute the ls command. Now
1268
00:44:20,800 --> 00:44:24,640
if you go to the slides then you will
1269
00:44:22,880 --> 00:44:27,119
notice that you have certain options
1270
00:44:24,640 --> 00:44:30,079
that you can type along with the ls. So
1271
00:44:27,119 --> 00:44:31,680
when you say ls path then you can uh you
1272
00:44:30,079 --> 00:44:33,200
know probably list down the list of
1273
00:44:31,680 --> 00:44:36,079
contents that is there in that
1274
00:44:33,200 --> 00:44:39,839
particular path. Okay. Uh let me go back
1275
00:44:36,079 --> 00:44:41,680
to the uh terminal. If I say ls and if I
1276
00:44:39,839 --> 00:44:43,520
say the path where I want to list down
1277
00:44:41,680 --> 00:44:45,520
the contents. Okay, right now I might be
1278
00:44:43,520 --> 00:44:47,280
in the home directory. Okay, but what if
1279
00:44:45,520 --> 00:44:49,839
I want to list down the contents that
1280
00:44:47,280 --> 00:44:53,280
are present in the uh desktop directory?
1281
00:44:49,839 --> 00:44:55,680
Then at that time I can use ls path. So
1282
00:44:53,280 --> 00:44:58,960
what I'll do is uh I can just put
1283
00:44:55,680 --> 00:45:00,319
desktop. Okay. And inside desktop there
1284
00:44:58,960 --> 00:45:02,240
are many other folders. If you remember
1285
00:45:00,319 --> 00:45:05,680
there was one folder called LMS. So if I
1286
00:45:02,240 --> 00:45:08,000
put LMS okay this is the path right? So
1287
00:45:05,680 --> 00:45:11,200
I have given ls followed by the path
1288
00:45:08,000 --> 00:45:13,440
desktop/ lms. Now if I give enter then
1289
00:45:11,200 --> 00:45:15,920
the uh folders or the directories that
1290
00:45:13,440 --> 00:45:17,599
will be present in this uh particular
1291
00:45:15,920 --> 00:45:19,839
directory or this folder will be
1292
00:45:17,599 --> 00:45:22,560
displayed to me that is hbase hive map
1293
00:45:19,839 --> 00:45:24,640
reduce uzi and ping. So that is what ls
1294
00:45:22,560 --> 00:45:26,720
and path does. Now if you go to the
1295
00:45:24,640 --> 00:45:28,400
slides there are other options right. So
1296
00:45:26,720 --> 00:45:31,280
these options they can be also referred
1297
00:45:28,400 --> 00:45:33,599
to as flags. So uh there is a hyphen
1298
00:45:31,280 --> 00:45:35,440
followed by one letter character. Okay,
1299
00:45:33,599 --> 00:45:37,119
there's one character here that is L.
1300
00:45:35,440 --> 00:45:39,119
There is a character called A. There's
1301
00:45:37,119 --> 00:45:40,720
another set of characters here author.
1302
00:45:39,119 --> 00:45:42,079
So all these are called options or
1303
00:45:40,720 --> 00:45:44,720
they're also called as flag. We refer to
1304
00:45:42,079 --> 00:45:46,800
them as L flag or A flag or author flag
1305
00:45:44,720 --> 00:45:48,800
all these things. Okay. Now if you give
1306
00:45:46,800 --> 00:45:51,359
the L flag, what happens is it lists
1307
00:45:48,800 --> 00:45:53,599
down all the contents similar to just
1308
00:45:51,359 --> 00:45:55,599
giving LS but along with its owner
1309
00:45:53,599 --> 00:45:57,440
settings, its uh permissions and the
1310
00:45:55,599 --> 00:45:58,880
time stamp. So when we say owner
1311
00:45:57,440 --> 00:46:00,880
settings, permissions and time stamp it
1312
00:45:58,880 --> 00:46:03,599
is with respect to uh the particular
1313
00:46:00,880 --> 00:46:05,839
folder inside that directory. So let me
1314
00:46:03,599 --> 00:46:08,079
show you an example of that. So by uh
1315
00:46:05,839 --> 00:46:10,560
giving ls you have all the different
1316
00:46:08,079 --> 00:46:14,000
folders that are present in this root
1317
00:46:10,560 --> 00:46:15,680
directory. Okay. Now if I give ls-l
1318
00:46:14,000 --> 00:46:17,680
so the same directories or same
1319
00:46:15,680 --> 00:46:20,000
documents are listed down here but we
1320
00:46:17,680 --> 00:46:21,839
have additional uh options here, right?
1321
00:46:20,000 --> 00:46:23,599
So we have additional information. So
1322
00:46:21,839 --> 00:46:25,520
these are the set of permissions that a
1323
00:46:23,599 --> 00:46:27,040
particular user has. we have uh
1324
00:46:25,520 --> 00:46:29,119
different we have username and we have
1325
00:46:27,040 --> 00:46:31,599
the host name we have the memory size we
1326
00:46:29,119 --> 00:46:33,359
have the date the time stamp and all
1327
00:46:31,599 --> 00:46:35,760
these things followed by the name of the
1328
00:46:33,359 --> 00:46:37,839
file so if you see desktop desktop is
1329
00:46:35,760 --> 00:46:40,319
something uh it was created on this day
1330
00:46:37,839 --> 00:46:42,319
and this is the size of it and all these
1331
00:46:40,319 --> 00:46:44,880
things okay so this is called the long
1332
00:46:42,319 --> 00:46:46,560
format I will explain each of these
1333
00:46:44,880 --> 00:46:49,599
permissions and what each of these
1334
00:46:46,560 --> 00:46:52,400
stands for what one stands for what isa
1335
00:46:49,599 --> 00:46:54,240
here and what isa here I'll explain the
1336
00:46:52,400 --> 00:46:55,599
all these things in some more time
1337
00:46:54,240 --> 00:46:56,640
Because before I explain those things,
1338
00:46:55,599 --> 00:46:59,359
there are other commands which I want to
1339
00:46:56,640 --> 00:47:02,000
show with respect to ls. Right? So in ls
1340
00:46:59,359 --> 00:47:05,440
other than ls minus l, you have ls minus
1341
00:47:02,000 --> 00:47:07,440
a you have ls author. Okay. So let's see
1342
00:47:05,440 --> 00:47:09,280
what happens when we give the a flag. It
1343
00:47:07,440 --> 00:47:10,720
should ideally show you the list of all
1344
00:47:09,280 --> 00:47:12,800
the hidden contents in the specified
1345
00:47:10,720 --> 00:47:14,480
directory. Okay. And then if it's uh if
1346
00:47:12,800 --> 00:47:16,000
you're using the author flag, then it
1347
00:47:14,480 --> 00:47:18,480
list down all the contents in that
1348
00:47:16,000 --> 00:47:21,359
directory along with its owner. Correct?
1349
00:47:18,480 --> 00:47:23,680
So let's try executing lsy
1350
00:47:21,359 --> 00:47:25,520
a first. So when we give a all the
1351
00:47:23,680 --> 00:47:27,839
hidden directories also should be
1352
00:47:25,520 --> 00:47:30,160
displayed. So as you can see these were
1353
00:47:27,839 --> 00:47:32,400
the other uh folders which were not
1354
00:47:30,160 --> 00:47:34,800
visible when I gave just ls because ls
1355
00:47:32,400 --> 00:47:37,680
just shows the list of contents that are
1356
00:47:34,800 --> 00:47:41,119
available in the GUI right. So in the
1357
00:47:37,680 --> 00:47:42,800
GUI if you go to u if go to desktop from
1358
00:47:41,119 --> 00:47:44,640
the GUI aspect you only get to see
1359
00:47:42,800 --> 00:47:46,160
these. Okay. So these are the regular
1360
00:47:44,640 --> 00:47:47,280
files which are not hidden. But of
1361
00:47:46,160 --> 00:47:49,520
course there are going to be many hidden
1362
00:47:47,280 --> 00:47:51,760
and those can be accessed by uh the
1363
00:47:49,520 --> 00:47:55,280
terminal by giving the ls minus a
1364
00:47:51,760 --> 00:47:57,920
command. Okay. So that is what this uh
1365
00:47:55,280 --> 00:48:00,640
helped in doing. Now if I give ls and if
1366
00:47:57,920 --> 00:48:02,960
I use the author flag now see what
1367
00:48:00,640 --> 00:48:05,040
happens. You have the author also. So
1368
00:48:02,960 --> 00:48:07,359
instead of having the username and the
1369
00:48:05,040 --> 00:48:09,760
host name here you have the author of
1370
00:48:07,359 --> 00:48:12,240
that particular uh document. So if this
1371
00:48:09,760 --> 00:48:13,920
is the particular uh folder or file or a
1372
00:48:12,240 --> 00:48:16,240
document then who is the author for
1373
00:48:13,920 --> 00:48:18,079
that? It is eda because I'm the user
1374
00:48:16,240 --> 00:48:19,599
right. So the author name will be
1375
00:48:18,079 --> 00:48:21,839
present over here followed by the size
1376
00:48:19,599 --> 00:48:23,839
and the time stamp it was created and
1377
00:48:21,839 --> 00:48:25,520
all these things and we get the list of
1378
00:48:23,839 --> 00:48:27,280
contents for all the directories or
1379
00:48:25,520 --> 00:48:29,200
folders which are present in uh that
1380
00:48:27,280 --> 00:48:32,880
particular uh directory. So that's what
1381
00:48:29,200 --> 00:48:35,280
ls does. Okay. So guys uh that was about
1382
00:48:32,880 --> 00:48:37,680
uh the author flag and uh in case we
1383
00:48:35,280 --> 00:48:39,760
want to use a combination of uh these
1384
00:48:37,680 --> 00:48:42,000
flags then even that is possible. So I
1385
00:48:39,760 --> 00:48:44,319
showed you earlier that there is this ls
1386
00:48:42,000 --> 00:48:47,440
minus l flag and then there is ls minus
1387
00:48:44,319 --> 00:48:49,359
a flag right. So minus a displays all
1388
00:48:47,440 --> 00:48:51,680
the hidden contents in that directory.
1389
00:48:49,359 --> 00:48:55,599
So let me use a combination of them. So
1390
00:48:51,680 --> 00:48:57,040
let me say ls - l and a since there are
1391
00:48:55,599 --> 00:48:59,520
two flags which I want to use then I'm
1392
00:48:57,040 --> 00:49:01,359
just going to use one hyphen symbol for
1393
00:48:59,520 --> 00:49:03,359
two different flags. So when I do this
1394
00:49:01,359 --> 00:49:05,920
then all the hidden contents will also
1395
00:49:03,359 --> 00:49:08,240
be displayed along with their extended
1396
00:49:05,920 --> 00:49:09,520
long format. Okay. So uh those are the
1397
00:49:08,240 --> 00:49:12,000
different folders or directories which
1398
00:49:09,520 --> 00:49:13,839
are present in this uh home directory of
1399
00:49:12,000 --> 00:49:17,920
mine. Okay. So that is the combination
1400
00:49:13,839 --> 00:49:20,559
of ls minus l and ls - a. So we saw a
1401
00:49:17,920 --> 00:49:22,400
combination and again so similarly if I
1402
00:49:20,559 --> 00:49:24,319
instead of those flags if I use the
1403
00:49:22,400 --> 00:49:27,440
hyphen s flag then it will sort that
1404
00:49:24,319 --> 00:49:30,000
entire list by the size. Okay. And let
1405
00:49:27,440 --> 00:49:33,119
me show you an example of that. So we
1406
00:49:30,000 --> 00:49:35,440
used ls minus l. Right? Now if I use s
1407
00:49:33,119 --> 00:49:37,680
over here, it will sort this entire list
1408
00:49:35,440 --> 00:49:39,040
of directories with the size. The high
1409
00:49:37,680 --> 00:49:40,640
the the folder with the largest size
1410
00:49:39,040 --> 00:49:42,400
will be on top and the one with the
1411
00:49:40,640 --> 00:49:43,920
smallest size will be at the bottom. So
1412
00:49:42,400 --> 00:49:45,520
as you can see here, it was all jumbled.
1413
00:49:43,920 --> 00:49:47,520
It was uh this is basically the size
1414
00:49:45,520 --> 00:49:49,599
block, right? So this is basically for
1415
00:49:47,520 --> 00:49:52,240
the size block here. If you see the
1416
00:49:49,599 --> 00:49:54,240
previous time when I just ran ls- l then
1417
00:49:52,240 --> 00:49:57,680
it was in a different order. But uh
1418
00:49:54,240 --> 00:50:00,640
since I ran ls - la and capital s this
1419
00:49:57,680 --> 00:50:03,119
has sorted the result in as per the uh
1420
00:50:00,640 --> 00:50:04,400
size of the blocks of the folders the
1421
00:50:03,119 --> 00:50:05,599
folder with the highest size is
1422
00:50:04,400 --> 00:50:07,520
displayed first and the one with the
1423
00:50:05,599 --> 00:50:10,160
lowest is displayed last. So that is
1424
00:50:07,520 --> 00:50:12,240
about the ls hyphen s. So there is one
1425
00:50:10,160 --> 00:50:13,760
more command that I want to uh show you
1426
00:50:12,240 --> 00:50:16,079
which can be executed with the help of
1427
00:50:13,760 --> 00:50:20,400
the ls command. Okay, we executed the
1428
00:50:16,079 --> 00:50:23,440
ls- l a and s flags right. So we
1429
00:50:20,400 --> 00:50:26,400
executed this one previously. Now what
1430
00:50:23,440 --> 00:50:27,839
if you want to uh store these details?
1431
00:50:26,400 --> 00:50:29,599
So whatever the output here was, if you
1432
00:50:27,839 --> 00:50:31,760
want to store it into another file, how
1433
00:50:29,599 --> 00:50:34,319
will you do that? We have uh an option
1434
00:50:31,760 --> 00:50:36,559
for that. Okay, and that is this symbol
1435
00:50:34,319 --> 00:50:38,480
greater than symbol. Okay, it's called
1436
00:50:36,559 --> 00:50:40,800
the direction flag. Input output
1437
00:50:38,480 --> 00:50:43,119
direction flag. And by using this flag,
1438
00:50:40,800 --> 00:50:45,200
whatever the result or the output of the
1439
00:50:43,119 --> 00:50:47,280
command that comes right prior to this
1440
00:50:45,200 --> 00:50:50,160
symbol, those will be stored in the file
1441
00:50:47,280 --> 00:50:51,599
that precedes this symbol. So let's say
1442
00:50:50,160 --> 00:50:53,200
that you know I want to create a new
1443
00:50:51,599 --> 00:50:54,720
file. I'm going to create that. Okay,
1444
00:50:53,200 --> 00:50:57,760
I'm currently in the home directory,
1445
00:50:54,720 --> 00:51:00,559
right? So, let's not execute it here.
1446
00:50:57,760 --> 00:51:04,480
What I'm going to say is uh let me first
1447
00:51:00,559 --> 00:51:06,880
change directory to documents. Okay.
1448
00:51:04,480 --> 00:51:09,440
Now, in here, of course, uh I don't
1449
00:51:06,880 --> 00:51:11,040
think there are any uh hidden documents
1450
00:51:09,440 --> 00:51:15,520
either. So, there are no folders here.
1451
00:51:11,040 --> 00:51:20,720
So, what I'm going to do is u ls minus l
1452
00:51:15,520 --> 00:51:24,000
a s. Okay. And I'm going to run the uh
1453
00:51:20,720 --> 00:51:26,319
this command at the home/ edurea
1454
00:51:24,000 --> 00:51:28,400
directory. Okay, I'm going to uh
1455
00:51:26,319 --> 00:51:31,280
basically run the same l. So basically
1456
00:51:28,400 --> 00:51:33,839
the same results I will run them by
1457
00:51:31,280 --> 00:51:36,880
specifying this uh directory and I will
1458
00:51:33,839 --> 00:51:39,520
be storing this file inside my new file.
1459
00:51:36,880 --> 00:51:41,680
Okay. Now let me name that file file
1460
00:51:39,520 --> 00:51:45,520
1.xt.
1461
00:51:41,680 --> 00:51:48,640
Okay. Now uh the reason I moved to uh
1462
00:51:45,520 --> 00:51:52,079
this directory is because I can store
1463
00:51:48,640 --> 00:51:54,319
the file in this directory. Okay. Uh had
1464
00:51:52,079 --> 00:51:56,960
I not moved to this directory and had I
1465
00:51:54,319 --> 00:51:59,760
just executed this uh ls minus l
1466
00:51:56,960 --> 00:52:00,960
followed by uh this direction then what
1467
00:51:59,760 --> 00:52:02,960
would have happened is it would have
1468
00:52:00,960 --> 00:52:05,359
just created this new file in my the
1469
00:52:02,960 --> 00:52:07,760
home directory itself. Okay. So if I
1470
00:52:05,359 --> 00:52:09,599
give an enter here there's a new file
1471
00:52:07,760 --> 00:52:12,319
that would have been created under my uh
1472
00:52:09,599 --> 00:52:14,319
documents directory. Okay. Now when I
1473
00:52:12,319 --> 00:52:17,280
ran ls inside documents there was no
1474
00:52:14,319 --> 00:52:18,800
folder but now let's uh run ls. So now
1475
00:52:17,280 --> 00:52:20,559
you can see that there's a new file
1476
00:52:18,800 --> 00:52:24,559
that's created and that is called file
1477
00:52:20,559 --> 00:52:26,720
1.xt. Now that is because I uh used this
1478
00:52:24,559 --> 00:52:28,880
uh direction symbol nothing but the
1479
00:52:26,720 --> 00:52:31,119
greater than uh symbol and when I do
1480
00:52:28,880 --> 00:52:33,359
this whatever result that gets generated
1481
00:52:31,119 --> 00:52:35,440
from uh this command right from these
1482
00:52:33,359 --> 00:52:37,680
options on these flags those will be
1483
00:52:35,440 --> 00:52:41,800
stored in a new file and uh the file
1484
00:52:37,680 --> 00:52:41,800
name needs to be specified over here.
1485
00:52:41,839 --> 00:52:46,160
Okay, so that was the wrong command that
1486
00:52:43,200 --> 00:52:47,920
I used. It's not ls. So, uh what I need
1487
00:52:46,160 --> 00:52:50,000
to do is let me just view that file.
1488
00:52:47,920 --> 00:52:52,160
Okay, so to view this particular file or
1489
00:52:50,000 --> 00:52:54,160
any file, we have to use the vi editor
1490
00:52:52,160 --> 00:52:56,960
or we have to use a gedit editor or we
1491
00:52:54,160 --> 00:52:58,960
can use the cat command. Okay, now the
1492
00:52:56,960 --> 00:53:01,520
most common one is the vi editor. So,
1493
00:52:58,960 --> 00:53:03,920
let's uh just execute the vi and open
1494
00:53:01,520 --> 00:53:05,599
this file from here. Okay. And the
1495
00:53:03,920 --> 00:53:07,599
reason that this ls do file did not
1496
00:53:05,599 --> 00:53:09,599
execute was because it lists down the
1497
00:53:07,599 --> 00:53:12,800
files, right? And this is a wrong usage.
1498
00:53:09,599 --> 00:53:14,880
I did a mistake by specifying ls and uh
1499
00:53:12,800 --> 00:53:16,720
by not giving a directory. So I should
1500
00:53:14,880 --> 00:53:19,119
have used vi instead. So that's why that
1501
00:53:16,720 --> 00:53:21,359
did not come. But anyways, if I give vi
1502
00:53:19,119 --> 00:53:22,800
and file name, then that file opens,
1503
00:53:21,359 --> 00:53:24,880
right? So the file which I created and
1504
00:53:22,800 --> 00:53:26,559
this file has the output that was
1505
00:53:24,880 --> 00:53:29,440
displayed earlier. Okay. So basically
1506
00:53:26,559 --> 00:53:32,559
whatever was generated by the ls and a
1507
00:53:29,440 --> 00:53:34,240
flags of ls. So that result instead of
1508
00:53:32,559 --> 00:53:37,760
coming in the terminal, it got stored in
1509
00:53:34,240 --> 00:53:41,200
a different file. Okay. Now uh let's
1510
00:53:37,760 --> 00:53:43,200
just exit this via file and explain the
1511
00:53:41,200 --> 00:53:45,839
same thing. So what you saw inside this
1512
00:53:43,200 --> 00:53:48,720
file file 1.txt the content is the same
1513
00:53:45,839 --> 00:53:51,599
as uh this one. Okay. So we ran the same
1514
00:53:48,720 --> 00:53:53,359
command ls - las but it is that instead
1515
00:53:51,599 --> 00:53:56,559
of getting the output in the terminal we
1516
00:53:53,359 --> 00:53:59,040
gave a direction command over here to uh
1517
00:53:56,559 --> 00:54:01,839
save it in a different file and we
1518
00:53:59,040 --> 00:54:03,599
stored this file in the home/ora
1519
00:54:01,839 --> 00:54:05,760
directory. Okay. Okay. Now supposing if
1520
00:54:03,599 --> 00:54:07,200
I want to store this file in the same
1521
00:54:05,760 --> 00:54:09,839
directory then even that can be done.
1522
00:54:07,200 --> 00:54:11,839
Okay. It's not a big deal. So this is
1523
00:54:09,839 --> 00:54:14,240
the command right. So if I remove the
1524
00:54:11,839 --> 00:54:15,839
path over here then what happens is
1525
00:54:14,240 --> 00:54:18,319
whatever the output gets that gets
1526
00:54:15,839 --> 00:54:20,079
generated from uh this option and this
1527
00:54:18,319 --> 00:54:23,280
command that will be stored in the file
1528
00:54:20,079 --> 00:54:25,200
one.txt inside my uh home directory.
1529
00:54:23,280 --> 00:54:26,960
Okay. If I'm inside the documents
1530
00:54:25,200 --> 00:54:29,280
directory right? So let me just go back
1531
00:54:26,960 --> 00:54:31,920
one path. So right now I am inside the
1532
00:54:29,280 --> 00:54:34,480
uh home directory. Right. So here if I
1533
00:54:31,920 --> 00:54:36,640
execute that uh command okay then a new
1534
00:54:34,480 --> 00:54:38,800
file will be created with uh the name
1535
00:54:36,640 --> 00:54:41,839
file 1.xe and it will have the same
1536
00:54:38,800 --> 00:54:43,599
details. So I'm have done that and uh
1537
00:54:41,839 --> 00:54:47,119
let's see what are the contents of that
1538
00:54:43,599 --> 00:54:49,839
file. Okay. So it's nice right? So you
1539
00:54:47,119 --> 00:54:51,839
can uh in this way whatever output that
1540
00:54:49,839 --> 00:54:54,079
you have that you can directly store it
1541
00:54:51,839 --> 00:54:56,480
into another file. So it's a very handy
1542
00:54:54,079 --> 00:54:58,720
uh command and a very handy option and
1543
00:54:56,480 --> 00:55:01,520
I'll talk about more such advantages
1544
00:54:58,720 --> 00:55:03,520
like this later. Okay, so for now I just
1545
00:55:01,520 --> 00:55:07,119
wanted to show you how the direction uh
1546
00:55:03,520 --> 00:55:08,960
works. So uh getting back to my slides,
1547
00:55:07,119 --> 00:55:12,079
I think I've shown you how to work with
1548
00:55:08,960 --> 00:55:13,680
uh the ls uh command and in the previous
1549
00:55:12,079 --> 00:55:15,599
slide I showed you the basic commands
1550
00:55:13,680 --> 00:55:17,440
with respect to uh present working
1551
00:55:15,599 --> 00:55:20,079
directory and clear directory and the
1552
00:55:17,440 --> 00:55:23,119
pseudo and the echo commands. So I've
1553
00:55:20,079 --> 00:55:24,720
done with ls also and now I'm going to
1554
00:55:23,119 --> 00:55:26,640
show you how to work with the cd
1555
00:55:24,720 --> 00:55:28,480
directory. So some of the CD directories
1556
00:55:26,640 --> 00:55:31,040
I showed you earlier also I showed you
1557
00:55:28,480 --> 00:55:33,040
how to switch to a new directory. So uh
1558
00:55:31,040 --> 00:55:35,280
when you type cd it'll just change the
1559
00:55:33,040 --> 00:55:37,520
directory to the home directory. Okay.
1560
00:55:35,280 --> 00:55:39,920
So the /home/ora.
1561
00:55:37,520 --> 00:55:42,000
Okay. Now that is my home directory. My
1562
00:55:39,920 --> 00:55:44,960
home directory is set to that path. So
1563
00:55:42,000 --> 00:55:46,800
if I go cd it will uh go to that
1564
00:55:44,960 --> 00:55:49,839
particular home directory. And uh
1565
00:55:46,800 --> 00:55:52,319
similarly if I uh you know give even cd
1566
00:55:49,839 --> 00:55:54,160
and space till day symbol as you can see
1567
00:55:52,319 --> 00:55:55,599
here then even this command will uh
1568
00:55:54,160 --> 00:55:58,400
change the directory to the home
1569
00:55:55,599 --> 00:56:01,440
directory. Okay. But however if you give
1570
00:55:58,400 --> 00:56:03,760
uh cd space uh just slash this will
1571
00:56:01,440 --> 00:56:04,880
change it to the root directory. So it
1572
00:56:03,760 --> 00:56:06,880
changes the current directory to the
1573
00:56:04,880 --> 00:56:08,880
root directory. That is because uh the
1574
00:56:06,880 --> 00:56:11,280
forward slash here it represents the
1575
00:56:08,880 --> 00:56:13,200
root. I uh told you this a number of
1576
00:56:11,280 --> 00:56:14,880
times earlier. Okay. And if there's any
1577
00:56:13,200 --> 00:56:17,359
other path or any other folder which you
1578
00:56:14,880 --> 00:56:19,280
want to move to then you start from the
1579
00:56:17,359 --> 00:56:21,200
root. So you specify the absolute
1580
00:56:19,280 --> 00:56:23,200
address right you start from the root
1581
00:56:21,200 --> 00:56:25,520
you say slash and then you put the
1582
00:56:23,200 --> 00:56:28,000
folder name you again uh say slash and
1583
00:56:25,520 --> 00:56:30,400
then you put the next folder name. So uh
1584
00:56:28,000 --> 00:56:32,720
it is similar to that the first forward
1585
00:56:30,400 --> 00:56:34,480
slash represents the uh root directory
1586
00:56:32,720 --> 00:56:36,000
and the subsequent slashes are to
1587
00:56:34,480 --> 00:56:38,640
differentiate between the different
1588
00:56:36,000 --> 00:56:40,559
parent and the subdirectories. So that's
1589
00:56:38,640 --> 00:56:41,920
what they are. So this will change you
1590
00:56:40,559 --> 00:56:45,440
to the root directory and then you have
1591
00:56:41,920 --> 00:56:48,000
the uh cd-en double period mark okay two
1592
00:56:45,440 --> 00:56:50,400
period symbols and when you give uh cd
1593
00:56:48,000 --> 00:56:52,160
space dot right if you give two dots cd
1594
00:56:50,400 --> 00:56:53,760
space dot dot then it'll change to
1595
00:56:52,160 --> 00:56:55,520
parent directory. So supposing I'm
1596
00:56:53,760 --> 00:56:57,680
inside the desktop directory. So
1597
00:56:55,520 --> 00:56:59,200
desktop's parent is home directory right
1598
00:56:57,680 --> 00:57:01,520
so it will change me to the home
1599
00:56:59,200 --> 00:57:04,319
directory. But supposing if I was uh
1600
00:57:01,520 --> 00:57:06,799
inside let's say the uh if I'm inside a
1601
00:57:04,319 --> 00:57:09,280
directory called uh directory C and if
1602
00:57:06,799 --> 00:57:11,599
C's parent was B then by running CD
1603
00:57:09,280 --> 00:57:13,200
space dot dot from the C directory then
1604
00:57:11,599 --> 00:57:15,680
it will switch me to the parent
1605
00:57:13,200 --> 00:57:17,440
directory which is B. So that's what
1606
00:57:15,680 --> 00:57:20,079
this does and then we have one more
1607
00:57:17,440 --> 00:57:21,680
command here that is uh CD within single
1608
00:57:20,079 --> 00:57:24,559
quotation marks we have some kind of
1609
00:57:21,680 --> 00:57:26,640
path. Now this is useful at times when
1610
00:57:24,559 --> 00:57:29,200
your folder name or your directory name
1611
00:57:26,640 --> 00:57:31,119
has two words. Okay. So if you have two
1612
00:57:29,200 --> 00:57:32,240
words then if you have a space in
1613
00:57:31,119 --> 00:57:34,400
between then the space will be
1614
00:57:32,240 --> 00:57:35,680
considered as an argument. Okay. So
1615
00:57:34,400 --> 00:57:37,520
terminal will consider that as an
1616
00:57:35,680 --> 00:57:39,520
argument. So if you want to switch to a
1617
00:57:37,520 --> 00:57:40,799
document in that kind of a situation you
1618
00:57:39,520 --> 00:57:42,799
know or if you want to switch to a
1619
00:57:40,799 --> 00:57:44,160
directory which has a space or a
1620
00:57:42,799 --> 00:57:46,160
document which has a space in the
1621
00:57:44,160 --> 00:57:47,680
middle. So in that kind of situation you
1622
00:57:46,160 --> 00:57:50,160
can use a single quotation mark or
1623
00:57:47,680 --> 00:57:51,760
double quotation mark. Okay. So it's uh
1624
00:57:50,160 --> 00:57:53,280
you know you also have the comfort to
1625
00:57:51,760 --> 00:57:54,720
switch to double quotation mark. So I'll
1626
00:57:53,280 --> 00:57:57,440
execute all these things and show you.
1627
00:57:54,720 --> 00:57:59,839
Okay. So first I'll show you the uh the
1628
00:57:57,440 --> 00:58:01,760
CD till day then with the forward slash
1629
00:57:59,839 --> 00:58:03,119
then with the dot mark this of course I
1630
00:58:01,760 --> 00:58:05,119
showed you earlier also and then I'll
1631
00:58:03,119 --> 00:58:06,720
show you how to switch to another folder
1632
00:58:05,119 --> 00:58:08,160
with you know which is having two
1633
00:58:06,720 --> 00:58:11,440
different names with a space in the
1634
00:58:08,160 --> 00:58:14,240
middle. So going back to my uh root. So
1635
00:58:11,440 --> 00:58:18,720
um right now we are inside the uh home
1636
00:58:14,240 --> 00:58:21,680
directory itself. So if I give uh cd -
1637
00:58:18,720 --> 00:58:25,119
desktop okay now in here we have my
1638
00:58:21,680 --> 00:58:28,400
other directories and if I do cd and lms
1639
00:58:25,119 --> 00:58:31,839
I'm inside the lms directory okay now
1640
00:58:28,400 --> 00:58:34,079
from here if I give cd and if I give use
1641
00:58:31,839 --> 00:58:36,880
the till day option right then it will
1642
00:58:34,079 --> 00:58:39,359
switch me to the uh root directory uh so
1643
00:58:36,880 --> 00:58:41,280
see this was the till day symbol earlier
1644
00:58:39,359 --> 00:58:43,680
okay so this till day symbol represents
1645
00:58:41,280 --> 00:58:46,640
root and since I uh said change
1646
00:58:43,680 --> 00:58:49,119
directory to t symbol this which implies
1647
00:58:46,640 --> 00:58:51,359
root it basically uh decodes it as
1648
00:58:49,119 --> 00:58:52,960
change directory to the root directory.
1649
00:58:51,359 --> 00:58:54,880
So when I did that I have automatically
1650
00:58:52,960 --> 00:58:57,599
switched to root directory while earlier
1651
00:58:54,880 --> 00:59:00,400
it was lms. So uh similarly if you're in
1652
00:58:57,599 --> 00:59:02,400
the uh lms directory and if you also
1653
00:59:00,400 --> 00:59:03,760
just press cd right if you just give
1654
00:59:02,400 --> 00:59:06,319
this command even this will switch you
1655
00:59:03,760 --> 00:59:09,119
to the root directory. So basically uh
1656
00:59:06,319 --> 00:59:12,079
cd and cd space till day they are uh
1657
00:59:09,119 --> 00:59:14,799
both the same. But uh however if you
1658
00:59:12,079 --> 00:59:16,880
give cd with forward slash then it will
1659
00:59:14,799 --> 00:59:19,040
uh switch you to the root directory. So
1660
00:59:16,880 --> 00:59:21,680
when I give enter as you can see I'm in
1661
00:59:19,040 --> 00:59:23,599
the root directory. So if I give ls over
1662
00:59:21,680 --> 00:59:25,280
here I have a list of other directories
1663
00:59:23,599 --> 00:59:28,400
which I showed you earlier. So in in
1664
00:59:25,280 --> 00:59:30,559
your file system right? So yeah so
1665
00:59:28,400 --> 00:59:32,400
inside your file system if you open this
1666
00:59:30,559 --> 00:59:34,559
folder then you have the root directory.
1667
00:59:32,400 --> 00:59:36,240
So inside this directory you have home
1668
00:59:34,559 --> 00:59:38,319
and network and this is where desktop
1669
00:59:36,240 --> 00:59:40,240
and documents are all present as a
1670
00:59:38,319 --> 00:59:42,000
subdirectory of this parent directory.
1671
00:59:40,240 --> 00:59:44,079
Okay. So this is the root directory
1672
00:59:42,000 --> 00:59:45,680
where everything is stored. So any
1673
00:59:44,079 --> 00:59:47,839
document or any folder in your Linux
1674
00:59:45,680 --> 00:59:50,480
operating system they can be referred or
1675
00:59:47,839 --> 00:59:53,359
they can be accessed from this root
1676
00:59:50,480 --> 00:59:55,280
directory. Okay. Now going back to the
1677
00:59:53,359 --> 00:59:57,520
terminal let me show you an example of
1678
00:59:55,280 --> 01:00:02,480
that. I've already moved to the uh root
1679
00:59:57,520 --> 01:00:06,319
directory. Now let me say cd bin and uh
1680
01:00:02,480 --> 01:00:09,359
okay we have this. So now when I uh gave
1681
01:00:06,319 --> 01:00:12,000
cd space bin then it moved me to the bin
1682
01:00:09,359 --> 01:00:14,079
folder inside my root directory. So uh I
1683
01:00:12,000 --> 01:00:16,079
ran the root directory added an ls which
1684
01:00:14,079 --> 01:00:18,000
listed down the list of uh folders
1685
01:00:16,079 --> 01:00:20,480
inside my root directory. These were the
1686
01:00:18,000 --> 01:00:22,160
options uh bin boot dev. These are all
1687
01:00:20,480 --> 01:00:25,040
the different folders. And when I said
1688
01:00:22,160 --> 01:00:27,520
change directory to bin, it uh shifted
1689
01:00:25,040 --> 01:00:30,079
me or it moved me to this particular
1690
01:00:27,520 --> 01:00:32,480
folder. Okay, inside the uh root
1691
01:00:30,079 --> 01:00:34,000
directory. So right now I am in the bin
1692
01:00:32,480 --> 01:00:36,559
directory. And inside the bin directory,
1693
01:00:34,000 --> 01:00:39,359
I ran the ls command which basically uh
1694
01:00:36,559 --> 01:00:41,200
means listing down all the uh contents
1695
01:00:39,359 --> 01:00:43,520
whether it's documents or whether it's
1696
01:00:41,200 --> 01:00:45,280
uh folders or directories all those will
1697
01:00:43,520 --> 01:00:48,079
be listed down. Okay, so these are the
1698
01:00:45,280 --> 01:00:50,480
list of all those uh contents in the uh
1699
01:00:48,079 --> 01:00:52,160
bin directory. Okay, now that we are in
1700
01:00:50,480 --> 01:00:55,200
bin, let me go back to my root directory
1701
01:00:52,160 --> 01:00:57,680
by giving double dot. Okay, so from bin
1702
01:00:55,200 --> 01:01:00,480
it again I go back to my uh uh root
1703
01:00:57,680 --> 01:01:01,599
directory. Okay, so this uh for/
1704
01:01:00,480 --> 01:01:04,000
represents root directory like I told
1705
01:01:01,599 --> 01:01:06,559
you earlier and if I do ls then I'm back
1706
01:01:04,000 --> 01:01:09,920
to this directory where we have bin boot
1707
01:01:06,559 --> 01:01:12,160
dev and etc home and all these things.
1708
01:01:09,920 --> 01:01:14,160
So now what I'm going to do is uh so now
1709
01:01:12,160 --> 01:01:17,359
that I'm in the root directory now let
1710
01:01:14,160 --> 01:01:19,520
me say change directory to home and
1711
01:01:17,359 --> 01:01:22,240
inside home there is EDA I want to go to
1712
01:01:19,520 --> 01:01:26,559
EDA inside Eureka let's go to desktop
1713
01:01:22,240 --> 01:01:28,480
and then there is LMS okay and uh in
1714
01:01:26,559 --> 01:01:31,119
here if I do ls then these are the list
1715
01:01:28,480 --> 01:01:34,319
of uh folders here okay now I'm going to
1716
01:01:31,119 --> 01:01:37,119
change directory to hbase and if I do an
1717
01:01:34,319 --> 01:01:39,119
ls over here then you can see that there
1718
01:01:37,119 --> 01:01:42,000
is one particular folder called advanced
1719
01:01:39,119 --> 01:01:46,559
hbase practicals module 9. Okay, if I
1720
01:01:42,000 --> 01:01:49,680
now just say cd and if I put adv space
1721
01:01:46,559 --> 01:01:52,000
hb then I will not be able to autofill
1722
01:01:49,680 --> 01:01:53,520
the option. Okay, that's because uh the
1723
01:01:52,000 --> 01:01:55,440
terminal or the CLI is not able to
1724
01:01:53,520 --> 01:01:57,440
recognize this particular uh command
1725
01:01:55,440 --> 01:02:00,000
because there's a space over here. Okay,
1726
01:01:57,440 --> 01:02:01,359
so it treats ADV as a separate folder.
1727
01:02:00,000 --> 01:02:04,079
But since it's not able to find any
1728
01:02:01,359 --> 01:02:06,079
folder here as ADV, that is the uh
1729
01:02:04,079 --> 01:02:08,559
problem. Okay, let me show you via the
1730
01:02:06,079 --> 01:02:10,240
GUI what it looks like. So we are in the
1731
01:02:08,559 --> 01:02:12,400
desktop and inside LMS we have
1732
01:02:10,240 --> 01:02:14,160
hedgebase. Inside HedgeBase we have
1733
01:02:12,400 --> 01:02:15,359
advanced hedgebased practical. So this
1734
01:02:14,160 --> 01:02:18,880
was what I was talking about this
1735
01:02:15,359 --> 01:02:22,000
particular folder. Correct. So let me
1736
01:02:18,880 --> 01:02:23,599
minimize this for you. Okay. Now this is
1737
01:02:22,000 --> 01:02:25,200
a classic situation of when you need to
1738
01:02:23,599 --> 01:02:27,920
use double quotation mark or single
1739
01:02:25,200 --> 01:02:33,440
quotation mark. Okay. Now if I just uh
1740
01:02:27,920 --> 01:02:35,920
put the same name uh like say ADV and uh
1741
01:02:33,440 --> 01:02:37,440
HB then it kind of autofills
1742
01:02:35,920 --> 01:02:39,359
automatically right.
1743
01:02:37,440 --> 01:02:41,359
So even the quotation mark ends over
1744
01:02:39,359 --> 01:02:43,920
here. So that indicates that this is
1745
01:02:41,359 --> 01:02:45,680
another folder that's present. So if I
1746
01:02:43,920 --> 01:02:47,520
uh you know just put enter then it will
1747
01:02:45,680 --> 01:02:49,760
change my directory to this particular
1748
01:02:47,520 --> 01:02:51,839
folder. So that is what the uh quotation
1749
01:02:49,760 --> 01:02:54,400
mark does. So when I do enter then I'm
1750
01:02:51,839 --> 01:02:56,079
inside this folder. When I do ls I have
1751
01:02:54,400 --> 01:02:58,400
the list of folders and directories
1752
01:02:56,079 --> 01:03:00,960
inside this advanced hbase practicals
1753
01:02:58,400 --> 01:03:03,200
folder. All right, guys. So, I'm just
1754
01:03:00,960 --> 01:03:06,240
going to do a CD to my home directory.
1755
01:03:03,200 --> 01:03:08,079
And I'm here. And that was about the
1756
01:03:06,240 --> 01:03:10,079
different uh CD commands that are
1757
01:03:08,079 --> 01:03:13,359
available which I wanted to show you.
1758
01:03:10,079 --> 01:03:16,799
Okay. So, let me just go back to my
1759
01:03:13,359 --> 01:03:18,720
slides now and go to the next slide. I
1760
01:03:16,799 --> 01:03:20,880
showed you all the uh different commands
1761
01:03:18,720 --> 01:03:22,640
here. Okay. So, the next set of commands
1762
01:03:20,880 --> 01:03:27,599
that I'm going to talk about are those
1763
01:03:22,640 --> 01:03:31,440
of cat, GP, sort, and pipe commands.
1764
01:03:27,599 --> 01:03:34,640
Okay. So uh let's first go to the next
1765
01:03:31,440 --> 01:03:36,960
slide and start off with cat command.
1766
01:03:34,640 --> 01:03:39,599
Okay. So when would we use the cat
1767
01:03:36,960 --> 01:03:41,440
command guys? So it's pretty obvious
1768
01:03:39,599 --> 01:03:43,119
right from what it's written here. It
1769
01:03:41,440 --> 01:03:45,520
says when you're working with files that
1770
01:03:43,119 --> 01:03:47,839
time you can use the cat command. So uh
1771
01:03:45,520 --> 01:03:49,920
the cat command it is basically used to
1772
01:03:47,839 --> 01:03:53,440
display the content of the text files
1773
01:03:49,920 --> 01:03:56,160
and concatenate several files into one.
1774
01:03:53,440 --> 01:03:58,559
So uh what this means is if I have a
1775
01:03:56,160 --> 01:04:00,079
particular uh you know I have a text
1776
01:03:58,559 --> 01:04:02,000
file. So earlier we created one text
1777
01:04:00,079 --> 01:04:04,000
file having all the file permissions
1778
01:04:02,000 --> 01:04:06,480
right. So if I have that kind of text
1779
01:04:04,000 --> 01:04:08,000
file and if I want to uh display the
1780
01:04:06,480 --> 01:04:09,839
content of that text file then I can use
1781
01:04:08,000 --> 01:04:11,359
the cat command. I can say cat and if I
1782
01:04:09,839 --> 01:04:12,799
give the file name then that content
1783
01:04:11,359 --> 01:04:14,960
will be displayed. So when I use only
1784
01:04:12,799 --> 01:04:17,760
the cat command with one file name it's
1785
01:04:14,960 --> 01:04:20,000
very similar to how the vi command works
1786
01:04:17,760 --> 01:04:21,520
or how the nano command works. Right? So
1787
01:04:20,000 --> 01:04:23,039
it will display the content in the
1788
01:04:21,520 --> 01:04:24,720
terminal itself.
1789
01:04:23,039 --> 01:04:27,680
Correct. But the difference with cat
1790
01:04:24,720 --> 01:04:29,599
command is that with cat I can list down
1791
01:04:27,680 --> 01:04:32,000
the contents of multiple files. So it's
1792
01:04:29,599 --> 01:04:33,760
not just one. Okay. I can have I can
1793
01:04:32,000 --> 01:04:35,839
even display I can specify three
1794
01:04:33,760 --> 01:04:37,839
different file names. And if I put enter
1795
01:04:35,839 --> 01:04:39,760
then the content of all the three files
1796
01:04:37,839 --> 01:04:41,680
will be displayed in my terminal. The
1797
01:04:39,760 --> 01:04:44,000
same thing won't happen with vi. So if I
1798
01:04:41,680 --> 01:04:45,440
say vi then only that particular files
1799
01:04:44,000 --> 01:04:49,039
content will be displayed. So same thing
1800
01:04:45,440 --> 01:04:50,960
with nano right. So uh let me just go to
1801
01:04:49,039 --> 01:04:53,440
the terminal and show you an example of
1802
01:04:50,960 --> 01:04:56,160
the cat command. So right now we are in
1803
01:04:53,440 --> 01:04:58,640
the cd directory. Let me just maximize
1804
01:04:56,160 --> 01:05:00,160
this. Okay want to clear the screen.
1805
01:04:58,640 --> 01:05:02,720
Present working directory is uh the
1806
01:05:00,160 --> 01:05:06,799
home/rea directory. This is the uh home
1807
01:05:02,720 --> 01:05:09,920
directory. And from here let me go to uh
1808
01:05:06,799 --> 01:05:11,599
documents. Okay. If I do an ls there is
1809
01:05:09,920 --> 01:05:14,400
this file one.xe which I created
1810
01:05:11,599 --> 01:05:16,720
earlier. Correct. So this was where the
1811
01:05:14,400 --> 01:05:19,760
different file permissions were present.
1812
01:05:16,720 --> 01:05:22,559
Right. So if I do cat-y file name and if
1813
01:05:19,760 --> 01:05:24,559
I give enter then I get the list of the
1814
01:05:22,559 --> 01:05:26,319
contents of that particular file. So in
1815
01:05:24,559 --> 01:05:28,160
that file there are only these three
1816
01:05:26,319 --> 01:05:30,240
rows because this was the latest updated
1817
01:05:28,160 --> 01:05:33,280
permissions that I specified in the file
1818
01:05:30,240 --> 01:05:35,599
1.xt. Okay. So guys I earlier told you
1819
01:05:33,280 --> 01:05:38,240
that you can enter uh details to a file
1820
01:05:35,599 --> 01:05:40,400
by using the direction command. Right?
1821
01:05:38,240 --> 01:05:41,839
So that was the greater than symbol. So
1822
01:05:40,400 --> 01:05:44,480
I'm going to use that kind of a symbol
1823
01:05:41,839 --> 01:05:46,240
over here and I'll create a new file by
1824
01:05:44,480 --> 01:05:49,039
adding details by using that command.
1825
01:05:46,240 --> 01:05:51,440
Okay. So, initially it was I used the ls
1826
01:05:49,039 --> 01:05:54,960
minus l. But this time I'll use the cat
1827
01:05:51,440 --> 01:05:56,640
command itself and uh say I'm going to
1828
01:05:54,960 --> 01:05:58,559
give the direction symbol here and when
1829
01:05:56,640 --> 01:06:01,599
I'm done with that let me give the name
1830
01:05:58,559 --> 01:06:04,000
of the new file. Let's say file 2.txt.
1831
01:06:01,599 --> 01:06:06,480
Now when I hit enter the command is not
1832
01:06:04,000 --> 01:06:08,480
executed completely. Okay. So I'm inside
1833
01:06:06,480 --> 01:06:10,799
this place where I can enter the text.
1834
01:06:08,480 --> 01:06:13,119
So it's basically going to create a new
1835
01:06:10,799 --> 01:06:14,480
file. Okay. Now whatever text I enter
1836
01:06:13,119 --> 01:06:19,119
here that will be stored inside this
1837
01:06:14,480 --> 01:06:23,119
file. So uh let's say hi
1838
01:06:19,119 --> 01:06:25,039
my name is uh Vardan and if I give enter
1839
01:06:23,119 --> 01:06:27,440
I can go to the next line and uh here
1840
01:06:25,039 --> 01:06:30,400
let's say
1841
01:06:27,440 --> 01:06:33,119
welcome to
1842
01:06:30,400 --> 01:06:35,280
Linux
1843
01:06:33,119 --> 01:06:36,960
tutorial by
1844
01:06:35,280 --> 01:06:40,640
Edurea.
1845
01:06:36,960 --> 01:06:42,640
Okay now if I want to uh you know just
1846
01:06:40,640 --> 01:06:45,039
add these two lines to this particular
1847
01:06:42,640 --> 01:06:47,680
uh file called filecore.txt txt then I
1848
01:06:45,039 --> 01:06:50,160
can press Ctrl D now. Okay, by pressing
1849
01:06:47,680 --> 01:06:52,480
Ctrl D I come back to my uh command
1850
01:06:50,160 --> 01:06:55,200
line. So what this command basically
1851
01:06:52,480 --> 01:06:58,640
does is this CAT command would have uh
1852
01:06:55,200 --> 01:07:01,599
created a new file file.xt and the uh
1853
01:06:58,640 --> 01:07:03,280
text that we entered below it right uh
1854
01:07:01,599 --> 01:07:09,760
this will be entered inside this text.
1855
01:07:03,280 --> 01:07:11,839
So if I do cat file 2 txt then whatever
1856
01:07:09,760 --> 01:07:15,359
I typed earlier that got saved in this
1857
01:07:11,839 --> 01:07:17,440
file. Now similarly if you see the uh
1858
01:07:15,359 --> 01:07:19,760
file 1.txt
1859
01:07:17,440 --> 01:07:22,240
the contents are these. Okay. So this is
1860
01:07:19,760 --> 01:07:25,520
the contents of this one and this is the
1861
01:07:22,240 --> 01:07:26,960
content of uh this file. Now I told you
1862
01:07:25,520 --> 01:07:28,720
that with the help of cat command you
1863
01:07:26,960 --> 01:07:30,720
can uh display the content of two
1864
01:07:28,720 --> 01:07:33,520
different files. So let me show you that
1865
01:07:30,720 --> 01:07:36,799
option. Okay. I'm going to say file 1.xt
1866
01:07:33,520 --> 01:07:38,640
and then I'm going to say file 2.xt. So
1867
01:07:36,799 --> 01:07:40,960
in this way I'm going to basically
1868
01:07:38,640 --> 01:07:44,559
display two files cat. I want to display
1869
01:07:40,960 --> 01:07:46,079
file one and file two. When I go enter,
1870
01:07:44,559 --> 01:07:48,480
first the file two contents will be
1871
01:07:46,079 --> 01:07:50,720
displayed and then the file two contents
1872
01:07:48,480 --> 01:07:52,319
or the lines in file 2.txt will be
1873
01:07:50,720 --> 01:07:53,359
displayed. Right? So first these were
1874
01:07:52,319 --> 01:07:56,079
the permissions that were there in the
1875
01:07:53,359 --> 01:07:57,760
first file and then uh this was what was
1876
01:07:56,079 --> 01:08:00,480
there in the second file. All right
1877
01:07:57,760 --> 01:08:02,640
guys, now uh this brings us to another
1878
01:08:00,480 --> 01:08:04,640
important concept of how to append
1879
01:08:02,640 --> 01:08:06,400
files. So cat basically stands for
1880
01:08:04,640 --> 01:08:08,880
concatenate, right? So that's the most
1881
01:08:06,400 --> 01:08:10,640
important option. So if you want to
1882
01:08:08,880 --> 01:08:12,160
concatenate a particular file with you
1883
01:08:10,640 --> 01:08:14,079
know some kind of lines then I showed
1884
01:08:12,160 --> 01:08:16,560
you how that is done by creating a new
1885
01:08:14,079 --> 01:08:19,120
file what I did was I I created a new
1886
01:08:16,560 --> 01:08:22,080
file file 2.xt and I concatenated these
1887
01:08:19,120 --> 01:08:26,239
lines into this particular file. So if I
1888
01:08:22,080 --> 01:08:29,759
just give cat and uh if I give file one
1889
01:08:26,239 --> 01:08:31,920
dot txt and if I give uh double marks
1890
01:08:29,759 --> 01:08:33,759
okay so double direction marks which is
1891
01:08:31,920 --> 01:08:36,319
uh nothing but the greater than symbol
1892
01:08:33,759 --> 01:08:39,120
okay we also call it direction marks. So
1893
01:08:36,319 --> 01:08:41,920
if you uh give file 1.txt and followed
1894
01:08:39,120 --> 01:08:44,719
by this if you give file 2.txt
1895
01:08:41,920 --> 01:08:46,960
then what's going to happen is whatever
1896
01:08:44,719 --> 01:08:49,759
contents are there in file one those
1897
01:08:46,960 --> 01:08:51,839
will get appended or concatenated to
1898
01:08:49,759 --> 01:08:54,799
this file 2.txt.
1899
01:08:51,839 --> 01:08:56,799
Okay. So in my file 2.txt we have these
1900
01:08:54,799 --> 01:08:59,920
two lines. Okay. Hi my name is Van and
1901
01:08:56,799 --> 01:09:02,880
welcome to Linux by Eda. And file one
1902
01:08:59,920 --> 01:09:06,159
has uh these three lines. So basically
1903
01:09:02,880 --> 01:09:07,920
when I uh enter now there will be uh a
1904
01:09:06,159 --> 01:09:11,279
file two in which there will be extra
1905
01:09:07,920 --> 01:09:14,159
lines. Okay. So let me uh do a cat file
1906
01:09:11,279 --> 01:09:17,920
2.txt. So as you can see initially when
1907
01:09:14,159 --> 01:09:20,719
I ran my uh cat file2 txt over here I
1908
01:09:17,920 --> 01:09:23,440
had only these two lines right but now
1909
01:09:20,719 --> 01:09:26,000
after using the birectional uh symbol
1910
01:09:23,440 --> 01:09:28,239
okay the direction symbol what has
1911
01:09:26,000 --> 01:09:30,080
happened is I have three extra lines. So
1912
01:09:28,239 --> 01:09:32,159
it says hi my name is van welcome to
1913
01:09:30,080 --> 01:09:34,799
Linux tutorial bya. After that I have
1914
01:09:32,159 --> 01:09:38,319
the permissions which was present in the
1915
01:09:34,799 --> 01:09:40,799
previous uh file. Okay. So uh that's
1916
01:09:38,319 --> 01:09:42,319
what happens here. Okay. In fact it's
1917
01:09:40,799 --> 01:09:44,799
actually four other lines. Thanks for
1918
01:09:42,319 --> 01:09:46,080
pointing that out. So Hmon you know
1919
01:09:44,799 --> 01:09:47,759
who's another person in our session. He
1920
01:09:46,080 --> 01:09:50,880
said that there are four lines in the
1921
01:09:47,759 --> 01:09:53,440
fire. Actually he's correct. So total
1922
01:09:50,880 --> 01:09:55,360
eight. So this is the first line and
1923
01:09:53,440 --> 01:09:58,320
these are the other three lines. So you
1924
01:09:55,360 --> 01:09:59,920
can also see that from uh here. Okay. So
1925
01:09:58,320 --> 01:10:02,480
the first time when I ran cat file
1926
01:09:59,920 --> 01:10:03,840
one.txe, txt right I first got total 8
1927
01:10:02,480 --> 01:10:05,520
this was the first line and after that I
1928
01:10:03,840 --> 01:10:07,280
got the permissions okay so this is the
1929
01:10:05,520 --> 01:10:09,520
first line and then you have the list of
1930
01:10:07,280 --> 01:10:12,719
the other contents so when we ran the ls
1931
01:10:09,520 --> 01:10:14,719
minus l the total number of entries were
1932
01:10:12,719 --> 01:10:16,320
right so that was what uh the total
1933
01:10:14,719 --> 01:10:19,760
eight stands for so these are the four
1934
01:10:16,320 --> 01:10:21,440
lines that got appended to my file 2 txt
1935
01:10:19,760 --> 01:10:23,520
okay but however there wouldn't be any
1936
01:10:21,440 --> 01:10:25,520
changes to my file 1 txt because I
1937
01:10:23,520 --> 01:10:27,280
didn't make any changes there so let me
1938
01:10:25,520 --> 01:10:29,120
anyway show you that also uh if you see
1939
01:10:27,280 --> 01:10:31,440
here again the contents here are the
1940
01:10:29,120 --> 01:10:33,760
same it's only that the file 2 has got
1941
01:10:31,440 --> 01:10:36,480
these four lines extra. So that is what
1942
01:10:33,760 --> 01:10:38,880
the direction symbol does. So these are
1943
01:10:36,480 --> 01:10:42,000
the uh advantages with the uh cat
1944
01:10:38,880 --> 01:10:43,840
command. All right. So u what I'm going
1945
01:10:42,000 --> 01:10:45,360
to do now is uh let me go back to my
1946
01:10:43,840 --> 01:10:47,600
slides and show you some more options.
1947
01:10:45,360 --> 01:10:50,400
Okay. So we have flags like we have the
1948
01:10:47,600 --> 01:10:52,480
B flag, the N flag, S flag and E flag.
1949
01:10:50,400 --> 01:10:54,800
Let's see what each of those stand for.
1950
01:10:52,480 --> 01:10:56,560
Okay. So when we use the B flag, it's
1951
01:10:54,800 --> 01:10:59,360
going to add line numbers to the
1952
01:10:56,560 --> 01:11:01,120
non-blank lines. Okay. So whichever line
1953
01:10:59,360 --> 01:11:03,520
there is some text. So those lines are
1954
01:11:01,120 --> 01:11:06,239
going to be numbered. Okay? And when you
1955
01:11:03,520 --> 01:11:07,760
say minus n then it is used to add line
1956
01:11:06,239 --> 01:11:09,280
numbers to all lines. It doesn't matter
1957
01:11:07,760 --> 01:11:10,320
if it's blank lines or non-blank lines.
1958
01:11:09,280 --> 01:11:12,480
It's just going to add numbers
1959
01:11:10,320 --> 01:11:15,040
everywhere line numbers. Okay. And when
1960
01:11:12,480 --> 01:11:16,560
you give the s flag, it is basically to
1961
01:11:15,040 --> 01:11:18,480
squeeze all the blank lines. Supposing
1962
01:11:16,560 --> 01:11:19,920
you have three blank lines one after the
1963
01:11:18,480 --> 01:11:22,239
other then it will squeeze all those
1964
01:11:19,920 --> 01:11:24,320
blank lines and it will reduce it. Okay.
1965
01:11:22,239 --> 01:11:26,880
So that's what the S does. And then the
1966
01:11:24,320 --> 01:11:29,280
e flag is going to uh show you a dollar
1967
01:11:26,880 --> 01:11:31,120
at the end of each line. So let me go
1968
01:11:29,280 --> 01:11:33,360
back to my terminal and show you this uh
1969
01:11:31,120 --> 01:11:37,040
option. So first of all let's see the
1970
01:11:33,360 --> 01:11:40,239
cat file 2.xt and uh let me use the uh
1971
01:11:37,040 --> 01:11:42,960
flag minus n. So this will list the
1972
01:11:40,239 --> 01:11:44,719
number of lines right. So there are
1973
01:11:42,960 --> 01:11:46,159
basically four lines from file one and
1974
01:11:44,719 --> 01:11:48,000
these were the two lines that were ear
1975
01:11:46,159 --> 01:11:51,840
present. So these are the six lines in
1976
01:11:48,000 --> 01:11:53,440
total we have in this file 2.txt. Okay.
1977
01:11:51,840 --> 01:11:55,040
Let me just clear the screen because uh
1978
01:11:53,440 --> 01:11:57,440
it's a little uh tough to see
1979
01:11:55,040 --> 01:12:00,400
everything, right? So yeah, so when I
1980
01:11:57,440 --> 01:12:02,239
ran the minus n command, the file 2.txt,
1981
01:12:00,400 --> 01:12:05,199
the lines in there were numbered. Okay,
1982
01:12:02,239 --> 01:12:07,679
1 to six. Uh and then we have another uh
1983
01:12:05,199 --> 01:12:10,400
flag called minus b flag, right? Minus b
1984
01:12:07,679 --> 01:12:12,640
flag will add numbers to also the uh
1985
01:12:10,400 --> 01:12:14,400
non-blank lines. So but for that we need
1986
01:12:12,640 --> 01:12:16,320
to first have blank lines over here. So
1987
01:12:14,400 --> 01:12:21,360
what we'll do is uh I'm going to do a
1988
01:12:16,320 --> 01:12:23,440
cat and u do this and file 2.txt. So
1989
01:12:21,360 --> 01:12:25,920
when I do this, I'll be adding uh lines
1990
01:12:23,440 --> 01:12:28,159
to this file 2.xt. Okay, I'll be
1991
01:12:25,920 --> 01:12:30,080
appending lines over here. So let me
1992
01:12:28,159 --> 01:12:32,080
just give one blank line. Enter some
1993
01:12:30,080 --> 01:12:35,440
random text and then enter, you know,
1994
01:12:32,080 --> 01:12:37,920
blank line and then random text. Okay,
1995
01:12:35,440 --> 01:12:40,800
so this is what I'm going to just enter
1996
01:12:37,920 --> 01:12:43,760
or append to my file totxt. Okay, you
1997
01:12:40,800 --> 01:12:45,760
press Ctrl D to exit this. And now these
1998
01:12:43,760 --> 01:12:47,600
would have been saved to my file 22.
1999
01:12:45,760 --> 01:12:50,560
TXT. So let me just run the same command
2000
01:12:47,600 --> 01:12:53,920
again. Oh, sorry. I should have ran this
2001
01:12:50,560 --> 01:12:56,320
cat file 2.txt. Okay, when I do this, as
2002
01:12:53,920 --> 01:12:57,679
you can see, uh it starts from here and
2003
01:12:56,320 --> 01:13:00,960
these were the other lines that were
2004
01:12:57,679 --> 01:13:05,040
appended. Okay, and now if I use the cat
2005
01:13:00,960 --> 01:13:07,280
hyphen B flag, okay, see what happens.
2006
01:13:05,040 --> 01:13:09,440
Only the non-blank lines are uh
2007
01:13:07,280 --> 01:13:11,920
numbered, right? So these lines are not
2008
01:13:09,440 --> 01:13:14,719
numbered. But if I use the minus N which
2009
01:13:11,920 --> 01:13:16,560
I used earlier, what it would do is it
2010
01:13:14,719 --> 01:13:19,280
will number each and every line. So
2011
01:13:16,560 --> 01:13:21,679
that's the difference between minusb and
2012
01:13:19,280 --> 01:13:23,600
the minus n flag. Okay. So n numbers all
2013
01:13:21,679 --> 01:13:27,040
the lines irrespective of it being empty
2014
01:13:23,600 --> 01:13:29,840
or not. But whereas minusb numbers only
2015
01:13:27,040 --> 01:13:32,640
lines which are non-blank. Okay. So that
2016
01:13:29,840 --> 01:13:35,520
is uh this one. And there is another
2017
01:13:32,640 --> 01:13:37,760
flag which is the uh hyphen s flag.
2018
01:13:35,520 --> 01:13:41,679
Okay. So it's not capital s it is small
2019
01:13:37,760 --> 01:13:43,760
s. Right. So when I say minus s then you
2020
01:13:41,679 --> 01:13:46,239
get the list of the documents. So as you
2021
01:13:43,760 --> 01:13:48,560
can see here all the u spaces are
2022
01:13:46,239 --> 01:13:50,960
squeezed into one. Uh seems like there
2023
01:13:48,560 --> 01:13:52,480
were no multiple spaces right no
2024
01:13:50,960 --> 01:13:56,960
multiple blank lines. So what we'll do
2025
01:13:52,480 --> 01:13:59,840
is let's edit the file 2.txt again. Okay
2026
01:13:56,960 --> 01:14:03,679
or in fact let me open it via the uh
2027
01:13:59,840 --> 01:14:07,360
editor vi editor. Okay. So when I do
2028
01:14:03,679 --> 01:14:11,199
this these are the uh existing ones.
2029
01:14:07,360 --> 01:14:12,719
So when you uh press insert or when you
2030
01:14:11,199 --> 01:14:15,199
press I button or insert button, you can
2031
01:14:12,719 --> 01:14:19,840
start entering text details inside this
2032
01:14:15,199 --> 01:14:22,159
file. Okay. Now u right now I'm here.
2033
01:14:19,840 --> 01:14:23,679
Let me add multiple blank lines here.
2034
01:14:22,159 --> 01:14:25,440
Okay.
2035
01:14:23,679 --> 01:14:27,520
So as you can see there are around three
2036
01:14:25,440 --> 01:14:29,360
blank lines here. 1 2 3 4. There are
2037
01:14:27,520 --> 01:14:32,400
four blank lines. And here there are
2038
01:14:29,360 --> 01:14:35,679
three blank lines. Okay. Now uh let me
2039
01:14:32,400 --> 01:14:38,239
press escape. Okay. Now if I give
2040
01:14:35,679 --> 01:14:40,320
escape. Okay. So now we are in insert
2041
01:14:38,239 --> 01:14:42,800
mode. So what I do is uh I'm going to
2042
01:14:40,320 --> 01:14:45,920
press escape and then followed by that
2043
01:14:42,800 --> 01:14:47,840
if you give colon and wq this would uh
2044
01:14:45,920 --> 01:14:49,679
save this file. Okay. So I've made
2045
01:14:47,840 --> 01:14:52,000
changes right? I've added lines here. So
2046
01:14:49,679 --> 01:14:54,719
it would save that changes and it would
2047
01:14:52,000 --> 01:14:57,360
quit the vi editor mode. So if I give
2048
01:14:54,719 --> 01:15:01,920
enter so I'm outside that file. So now
2049
01:14:57,360 --> 01:15:04,640
if you see the uh cat file 2.xt
2050
01:15:01,920 --> 01:15:06,320
then it has additional lines right? So
2051
01:15:04,640 --> 01:15:10,159
uh now I'm going to run the command that
2052
01:15:06,320 --> 01:15:12,239
I ran earlier. Cat hyphen flag s and
2053
01:15:10,159 --> 01:15:14,320
then file name. So when I do this all
2054
01:15:12,239 --> 01:15:16,320
the u multiple blank lines are squeezed
2055
01:15:14,320 --> 01:15:17,679
into one. So as you can see here there
2056
01:15:16,320 --> 01:15:20,640
there have been multiple lines here when
2057
01:15:17,679 --> 01:15:23,600
I ran the file 2.xt. But here when I ran
2058
01:15:20,640 --> 01:15:25,760
the cat hyphen with the yes flag then
2059
01:15:23,600 --> 01:15:27,440
there are all these multiple black
2060
01:15:25,760 --> 01:15:30,159
things are squeezed into one. Okay. So
2061
01:15:27,440 --> 01:15:32,320
that is uh the option with the cat
2062
01:15:30,159 --> 01:15:33,600
command. Okay. So I think with that I
2063
01:15:32,320 --> 01:15:35,280
think I've covered all the different
2064
01:15:33,600 --> 01:15:38,080
option. Okay, there is one left. There
2065
01:15:35,280 --> 01:15:40,960
is uh the minus E option right. So okay
2066
01:15:38,080 --> 01:15:44,080
now let me show you what that does. So
2067
01:15:40,960 --> 01:15:46,000
when we use the capital E flag okay
2068
01:15:44,080 --> 01:15:48,719
there is a dollar sign that is appended
2069
01:15:46,000 --> 01:15:50,320
after every line. So uh the first line
2070
01:15:48,719 --> 01:15:51,920
is total eight or let's say the first
2071
01:15:50,320 --> 01:15:53,679
line is this one. So there's a dollar
2072
01:15:51,920 --> 01:15:55,440
sign here and after this line there's a
2073
01:15:53,679 --> 01:15:57,520
dollar sign. After this there's a dollar
2074
01:15:55,440 --> 01:15:59,199
sign. And since these are blank lines
2075
01:15:57,520 --> 01:16:01,120
you'll only find the dollar sign here.
2076
01:15:59,199 --> 01:16:03,040
And again after this one you have a
2077
01:16:01,120 --> 01:16:05,120
dollar sign and uh you know blank lines
2078
01:16:03,040 --> 01:16:08,239
have dollar signs and yeah so that's how
2079
01:16:05,120 --> 01:16:10,880
the uh e flag works. Okay. So every the
2080
01:16:08,239 --> 01:16:13,920
end of the line is uh appended with the
2081
01:16:10,880 --> 01:16:16,480
dollar symbol. Okay. So with this I'm
2082
01:16:13,920 --> 01:16:19,040
done with all the uh cat commands. So
2083
01:16:16,480 --> 01:16:23,199
going back to my slides now. Let's go to
2084
01:16:19,040 --> 01:16:25,920
the uh next command that is grip. Okay.
2085
01:16:23,199 --> 01:16:27,600
So uh grip command working with grip
2086
01:16:25,920 --> 01:16:30,080
command. So what does the grip command
2087
01:16:27,600 --> 01:16:31,679
do? you guys have any idea? Okay. Well,
2088
01:16:30,080 --> 01:16:34,640
I don't expect you people to but uh
2089
01:16:31,679 --> 01:16:36,000
yeah. So, if people if any of you know
2090
01:16:34,640 --> 01:16:37,840
if you have an introduction to Linux,
2091
01:16:36,000 --> 01:16:39,040
then you can answer it. But it's fine if
2092
01:16:37,840 --> 01:16:41,520
you don't because I'm going to explain
2093
01:16:39,040 --> 01:16:43,199
that. It's my duty. And the grip command
2094
01:16:41,520 --> 01:16:45,040
is basically used to search for a
2095
01:16:43,199 --> 01:16:46,880
particular string or a word in a text
2096
01:16:45,040 --> 01:16:48,400
file. Right? We have a file document
2097
01:16:46,880 --> 01:16:50,560
like the one which we created. Now, like
2098
01:16:48,400 --> 01:16:52,880
we we have two documents like file 1.xt
2099
01:16:50,560 --> 01:16:54,480
and file 2.xt. And what if you want to
2100
01:16:52,880 --> 01:16:56,719
search for a particular string, right?
2101
01:16:54,480 --> 01:16:58,239
Or a particular uh word. So in this case
2102
01:16:56,719 --> 01:17:00,320
it's pretty simple because you can
2103
01:16:58,239 --> 01:17:02,960
easily find them. But what if you want
2104
01:17:00,320 --> 01:17:05,040
to do it to uh you know a very big pile
2105
01:17:02,960 --> 01:17:07,199
document which has like millions of
2106
01:17:05,040 --> 01:17:09,040
lines right? So supposing you have any
2107
01:17:07,199 --> 01:17:10,159
document then you'll have multiple lines
2108
01:17:09,040 --> 01:17:12,000
right and if you want to find one
2109
01:17:10,159 --> 01:17:13,520
particular word or if you want to go to
2110
01:17:12,000 --> 01:17:15,280
one particular string then how will you
2111
01:17:13,520 --> 01:17:18,480
do it? So in Windows you have the
2112
01:17:15,280 --> 01:17:20,480
control F option right but via a CLI you
2113
01:17:18,480 --> 01:17:23,120
can't use it right so via CLI you use
2114
01:17:20,480 --> 01:17:25,040
the uh grip command okay and the format
2115
01:17:23,120 --> 01:17:27,440
for executing the command is this so you
2116
01:17:25,040 --> 01:17:29,520
specify gp and then you specify the
2117
01:17:27,440 --> 01:17:30,640
string that you want to search for so
2118
01:17:29,520 --> 01:17:32,640
options is the string that I have
2119
01:17:30,640 --> 01:17:35,199
searched in this command and then the
2120
01:17:32,640 --> 01:17:37,840
file name okay and it will return the
2121
01:17:35,199 --> 01:17:40,400
result of the matching string options so
2122
01:17:37,840 --> 01:17:42,239
similarly if you use the i flag then it
2123
01:17:40,400 --> 01:17:44,640
will uh return the results for even case
2124
01:17:42,239 --> 01:17:47,440
insensitive strings So basically if you
2125
01:17:44,640 --> 01:17:49,520
do not use the I flag then it is uh it's
2126
01:17:47,440 --> 01:17:51,440
case sensitive right so it'll only
2127
01:17:49,520 --> 01:17:53,440
search for options with these letters
2128
01:17:51,440 --> 01:17:55,280
but if there is a word called options
2129
01:17:53,440 --> 01:17:58,320
with a capital O where the first letter
2130
01:17:55,280 --> 01:18:00,400
is capitalized then uh in that case only
2131
01:17:58,320 --> 01:18:02,880
when you use I will even that particular
2132
01:18:00,400 --> 01:18:04,800
result be uh shown okay so that is the
2133
01:18:02,880 --> 01:18:07,840
advantage with the I flag and then you
2134
01:18:04,800 --> 01:18:09,760
have the N flag which is the GP hyphen N
2135
01:18:07,840 --> 01:18:11,520
which will again returns the matching
2136
01:18:09,760 --> 01:18:14,239
strings along with their line number in
2137
01:18:11,520 --> 01:18:16,480
which line was that or that word found.
2138
01:18:14,239 --> 01:18:19,679
So that's what n does and when you give
2139
01:18:16,480 --> 01:18:21,360
minus v flag then what happens is uh you
2140
01:18:19,679 --> 01:18:23,840
will not be shown the list of lines
2141
01:18:21,360 --> 01:18:25,520
where the results were present but
2142
01:18:23,840 --> 01:18:27,840
instead you will be shown the list of
2143
01:18:25,520 --> 01:18:29,679
lines where the results were not found
2144
01:18:27,840 --> 01:18:31,120
where there was no matching string right
2145
01:18:29,679 --> 01:18:33,360
so those lines will be printed with the
2146
01:18:31,120 --> 01:18:34,880
help of v flag and then with the c flag
2147
01:18:33,360 --> 01:18:37,679
it returns the number of lines in which
2148
01:18:34,880 --> 01:18:39,920
the uh results matched the search string
2149
01:18:37,679 --> 01:18:42,800
so supposing you have like four words
2150
01:18:39,920 --> 01:18:45,120
okay you have a big document and uh your
2151
01:18:42,800 --> 01:18:46,960
word your string matched four times then
2152
01:18:45,120 --> 01:18:49,040
uh if you use the minus C flag then it
2153
01:18:46,960 --> 01:18:51,040
will display the number four instead of
2154
01:18:49,040 --> 01:18:53,920
displaying the search string. Okay, so
2155
01:18:51,040 --> 01:18:55,840
let me go to the uh VM let me go to my
2156
01:18:53,920 --> 01:18:59,040
CentOS and uh show you how to execute
2157
01:18:55,840 --> 01:19:01,920
these commands. Okay, so right now we
2158
01:18:59,040 --> 01:19:04,080
are in the documents folder. If I want
2159
01:19:01,920 --> 01:19:05,920
to execute uh that then we need to edit
2160
01:19:04,080 --> 01:19:08,960
this in a different way. Okay, we need
2161
01:19:05,920 --> 01:19:12,239
to have a different text and this
2162
01:19:08,960 --> 01:19:15,040
directory has uh these documents right?
2163
01:19:12,239 --> 01:19:18,320
So let me just quickly go to the uh
2164
01:19:15,040 --> 01:19:20,080
documents folder and here if I do an ls
2165
01:19:18,320 --> 01:19:23,679
we have the two files which we created.
2166
01:19:20,080 --> 01:19:25,679
We have file 2.txt and file 1.xt.
2167
01:19:23,679 --> 01:19:29,120
So what I'm going to do is uh I'm going
2168
01:19:25,679 --> 01:19:33,840
to see what's there in file 1.xt.
2169
01:19:29,120 --> 01:19:35,520
Okay. So let me edit this file. Okay. Or
2170
01:19:33,840 --> 01:19:37,440
let's say let's just create a new file.
2171
01:19:35,520 --> 01:19:40,800
What do you say? We can create a new
2172
01:19:37,440 --> 01:19:43,600
file by uh doing this right by uh giving
2173
01:19:40,800 --> 01:19:47,280
the direction symbol followed by the uh
2174
01:19:43,600 --> 01:19:49,040
name of the file. Let's say automobiles.
2175
01:19:47,280 --> 01:19:51,600
Automobiles.
2176
01:19:49,040 --> 01:19:53,280
This is the name of my uh file
2177
01:19:51,600 --> 01:19:54,800
automobiles.txt.
2178
01:19:53,280 --> 01:19:56,800
And I can start listing down the
2179
01:19:54,800 --> 01:19:59,920
automobiles that I want. So let's say
2180
01:19:56,800 --> 01:20:03,520
car or let's say
2181
01:19:59,920 --> 01:20:04,800
motorbikes. Okay, we can say train.
2182
01:20:03,520 --> 01:20:07,760
Well, train is technically not a
2183
01:20:04,800 --> 01:20:11,040
automobile but uh still or let's uh go
2184
01:20:07,760 --> 01:20:16,880
into details of the companies. Okay,
2185
01:20:11,040 --> 01:20:18,719
let's say Maruti, let's say Ferrari,
2186
01:20:16,880 --> 01:20:21,840
Lamborghini. These are some of the most
2187
01:20:18,719 --> 01:20:23,280
famous uh companies, right?
2188
01:20:21,840 --> 01:20:28,159
So, when it comes to bikes, you have
2189
01:20:23,280 --> 01:20:30,400
Bamaha, then you have uh Honda, right?
2190
01:20:28,159 --> 01:20:32,560
You have Suzuki,
2191
01:20:30,400 --> 01:20:36,800
you have
2192
01:20:32,560 --> 01:20:40,159
Acillia and uh to name a few more. We
2193
01:20:36,800 --> 01:20:44,159
can add some more companies like BMW, we
2194
01:20:40,159 --> 01:20:47,440
can add Audi, we can add
2195
01:20:44,159 --> 01:20:49,920
Foxwen to this list. Okay. Now, if I do
2196
01:20:47,440 --> 01:20:53,199
control D, then uh this will be the list
2197
01:20:49,920 --> 01:20:54,400
of content in my automobiles.xt. Okay.
2198
01:20:53,199 --> 01:20:57,360
Let me I'm going to clear the screen
2199
01:20:54,400 --> 01:21:00,239
now. And if I
2200
01:20:57,360 --> 01:21:03,920
do cat command here, then it displays a
2201
01:21:00,239 --> 01:21:06,400
list of contents here. Right? Okay. Now,
2202
01:21:03,920 --> 01:21:09,199
let's use the grip command to search the
2203
01:21:06,400 --> 01:21:14,320
content that is uh present in this uh
2204
01:21:09,199 --> 01:21:16,800
text. So u I'm going to do a grip and uh
2205
01:21:14,320 --> 01:21:21,120
the string that I want to search for is
2206
01:21:16,800 --> 01:21:23,360
uh let's say y because in Lamborghini we
2207
01:21:21,120 --> 01:21:26,320
have the search string y am and even in
2208
01:21:23,360 --> 01:21:28,800
yamaha we have uh the am right we are
2209
01:21:26,320 --> 01:21:32,400
supposed to get two results for this. So
2210
01:21:28,800 --> 01:21:35,120
in this case so if I uh just say gp yam
2211
01:21:32,400 --> 01:21:37,679
and if I specify the file name
2212
01:21:35,120 --> 01:21:40,800
automobiles.txt txt and if I give enter
2213
01:21:37,679 --> 01:21:42,960
then I get the two different words right
2214
01:21:40,800 --> 01:21:46,560
the two uh names where this was present
2215
01:21:42,960 --> 01:21:51,679
where am was present okay now if I use
2216
01:21:46,560 --> 01:21:54,159
the same thing with the uh i flag
2217
01:21:51,679 --> 01:21:57,199
then it will display the list of files
2218
01:21:54,159 --> 01:21:59,520
in a case insensitive fashion but in my
2219
01:21:57,199 --> 01:22:02,880
file there's no uppercase file I'm going
2220
01:21:59,520 --> 01:22:04,639
to say see automobile txt I'm going to
2221
01:22:02,880 --> 01:22:06,239
append
2222
01:22:04,639 --> 01:22:09,120
I'm going to append this word called
2223
01:22:06,239 --> 01:22:11,360
amber. Okay. So, Amber is another uh
2224
01:22:09,120 --> 01:22:15,679
automobile company. And when I do this
2225
01:22:11,360 --> 01:22:17,679
and if I run the cat command now, okay,
2226
01:22:15,679 --> 01:22:19,199
you will see that along with uh these
2227
01:22:17,679 --> 01:22:21,840
names which were there initially, there
2228
01:22:19,199 --> 01:22:24,639
is amber has been appended. Okay. And
2229
01:22:21,840 --> 01:22:26,719
this time when I search for y, right?
2230
01:22:24,639 --> 01:22:29,199
So, it should not show me this because
2231
01:22:26,719 --> 01:22:31,199
even though there is am here, uh the a
2232
01:22:29,199 --> 01:22:32,960
is capital here, but I'm searching for
2233
01:22:31,199 --> 01:22:34,320
small am. So, it should not show me this
2234
01:22:32,960 --> 01:22:37,679
result. Okay? I should get the same
2235
01:22:34,320 --> 01:22:41,760
result that I got previously. So if I uh
2236
01:22:37,679 --> 01:22:43,280
do a grip am like earlier I got the
2237
01:22:41,760 --> 01:22:46,480
Lamborghini and Yamaha as the only
2238
01:22:43,280 --> 01:22:50,719
options. Okay. But now if I uh append
2239
01:22:46,480 --> 01:22:52,960
this with minus I or the I flag. So what
2240
01:22:50,719 --> 01:22:55,280
happens is I'll get the option of even
2241
01:22:52,960 --> 01:22:56,400
amber along with this because it would
2242
01:22:55,280 --> 01:22:59,600
search for the string in a case
2243
01:22:56,400 --> 01:23:02,880
insensitive fashion. Okay. So this time
2244
01:22:59,600 --> 01:23:05,440
as you can see amber is uh added to this
2245
01:23:02,880 --> 01:23:08,639
list because uh it did not consider case
2246
01:23:05,440 --> 01:23:11,440
insensitive words letters. Okay. So that
2247
01:23:08,639 --> 01:23:13,600
is about the i flag and uh there is
2248
01:23:11,440 --> 01:23:16,000
another n flag right. So let's see what
2249
01:23:13,600 --> 01:23:19,360
the n flag does. So every time you use
2250
01:23:16,000 --> 01:23:21,440
the uh minus n flag then it'll list down
2251
01:23:19,360 --> 01:23:24,000
the line in which the word was present.
2252
01:23:21,440 --> 01:23:25,440
So that's what I mentioned earlier. So
2253
01:23:24,000 --> 01:23:26,719
over here in line number six and line
2254
01:23:25,440 --> 01:23:28,639
number seven we have lamborghini and
2255
01:23:26,719 --> 01:23:33,040
yamaha. Right? So the line number is
2256
01:23:28,639 --> 01:23:35,040
mentioned. Okay. Now u so that's what
2257
01:23:33,040 --> 01:23:36,880
the n flag does. Okay. So we have the v
2258
01:23:35,040 --> 01:23:40,880
flag and the c flag left. So let's
2259
01:23:36,880 --> 01:23:44,800
execute them and uh see what happens. So
2260
01:23:40,880 --> 01:23:47,520
when I remove n and when I execute v as
2261
01:23:44,800 --> 01:23:49,920
you can see all the uh results except
2262
01:23:47,520 --> 01:23:53,280
for yamaha and for lamborghini would be
2263
01:23:49,920 --> 01:23:56,080
present here. Okay. But if I give minus
2264
01:23:53,280 --> 01:23:58,159
IV okay which indicates IV flag then
2265
01:23:56,080 --> 01:24:00,560
even amber would not be present in the
2266
01:23:58,159 --> 01:24:02,320
output I will get now okay when I give
2267
01:24:00,560 --> 01:24:04,960
enter as you can see amber is not
2268
01:24:02,320 --> 01:24:07,280
present because uh amber is part of the
2269
01:24:04,960 --> 01:24:09,040
case insensitive option right when we
2270
01:24:07,280 --> 01:24:11,040
included I this should be chosen as the
2271
01:24:09,040 --> 01:24:13,280
search result and since it's considered
2272
01:24:11,040 --> 01:24:14,880
as a search result we will display only
2273
01:24:13,280 --> 01:24:17,040
the result uh the set of results which
2274
01:24:14,880 --> 01:24:18,960
were not found so the other lines which
2275
01:24:17,040 --> 01:24:21,679
text was not found were these and that's
2276
01:24:18,960 --> 01:24:23,199
why we got these options okay Now we
2277
01:24:21,679 --> 01:24:26,000
have one more flag which we need to see
2278
01:24:23,199 --> 01:24:29,040
and that is the C flag. And when you
2279
01:24:26,000 --> 01:24:31,199
enter the uh C flag then it displays the
2280
01:24:29,040 --> 01:24:33,360
list of uh the number of times that
2281
01:24:31,199 --> 01:24:35,120
string was found. So AM was found two
2282
01:24:33,360 --> 01:24:37,199
times in once in Lamogi and once in
2283
01:24:35,120 --> 01:24:39,679
Yamaha. So that's why we got the answer
2284
01:24:37,199 --> 01:24:42,719
as two. Now if I use C with the
2285
01:24:39,679 --> 01:24:44,880
combination of I all right I'm going to
2286
01:24:42,719 --> 01:24:46,960
get three. That's because even amber
2287
01:24:44,880 --> 01:24:50,320
will be considered in this case. Okay
2288
01:24:46,960 --> 01:24:52,639
guys. So uh this is uh what is uh there
2289
01:24:50,320 --> 01:24:55,520
with respect to the grip command. I
2290
01:24:52,639 --> 01:24:58,000
spoke about the uh grip command. Okay.
2291
01:24:55,520 --> 01:24:59,840
And now in the next slide let me talk
2292
01:24:58,000 --> 01:25:01,920
about the sort command. Okay. And so we
2293
01:24:59,840 --> 01:25:04,159
use a sort command to sort the results
2294
01:25:01,920 --> 01:25:07,520
of a search either alphabetically or
2295
01:25:04,159 --> 01:25:10,800
numerically. All right. And uh we can
2296
01:25:07,520 --> 01:25:13,760
sort either files or file contents or
2297
01:25:10,800 --> 01:25:16,239
directories. So what this means is
2298
01:25:13,760 --> 01:25:18,639
whatever results you get right or uh I
2299
01:25:16,239 --> 01:25:20,880
mean not just results or even if uh it's
2300
01:25:18,639 --> 01:25:21,920
the list of items that is present in a
2301
01:25:20,880 --> 01:25:23,920
particular directory even when you run
2302
01:25:21,920 --> 01:25:26,639
an ls command right you'll have a list
2303
01:25:23,920 --> 01:25:28,320
of files and the list of folders that
2304
01:25:26,639 --> 01:25:30,800
are there in that particular directory
2305
01:25:28,320 --> 01:25:33,120
so we can sort even those things okay
2306
01:25:30,800 --> 01:25:35,040
now that result can be sorted and uh
2307
01:25:33,120 --> 01:25:37,120
also we can sort anything else we can
2308
01:25:35,040 --> 01:25:39,040
sort the contents of a file right we can
2309
01:25:37,120 --> 01:25:40,239
sort the contents of the file or uh you
2310
01:25:39,040 --> 01:25:42,639
know all these things so that's what
2311
01:25:40,239 --> 01:25:44,639
this means So without wasting much time,
2312
01:25:42,639 --> 01:25:47,120
let me just uh show you how that is
2313
01:25:44,639 --> 01:25:49,120
done. So you can give sort and the file
2314
01:25:47,120 --> 01:25:51,679
that you want to uh search.
2315
01:25:49,120 --> 01:25:53,920
Alternatively, you can also search two
2316
01:25:51,679 --> 01:25:57,679
files at the same time by giving uh file
2317
01:25:53,920 --> 01:26:00,320
1.txt and file 2.txt. Okay. So and the
2318
01:25:57,679 --> 01:26:02,080
and the syntax for that is uh sort and
2319
01:26:00,320 --> 01:26:03,760
the file name. Okay. When you say sort
2320
01:26:02,080 --> 01:26:05,440
on the file name, then the contents of
2321
01:26:03,760 --> 01:26:07,600
this file will be returned in the
2322
01:26:05,440 --> 01:26:09,199
alphabetical order. Okay. If you want to
2323
01:26:07,600 --> 01:26:10,880
sort two files at the same time, then
2324
01:26:09,199 --> 01:26:12,800
you can uh in arguments you can just
2325
01:26:10,880 --> 01:26:14,800
give both the file names and it will
2326
01:26:12,800 --> 01:26:17,760
sort the contents for both file one.txt
2327
01:26:14,800 --> 01:26:19,360
and file 2.txt. Okay. And again if you
2328
01:26:17,760 --> 01:26:21,600
want to uh display them in the reverse
2329
01:26:19,360 --> 01:26:24,400
order, then you can specify the R flag.
2330
01:26:21,600 --> 01:26:26,800
And uh for case insensitive sorting, you
2331
01:26:24,400 --> 01:26:29,040
can do the hyphen F flag. And then if
2332
01:26:26,800 --> 01:26:31,199
you want to sort the results based on
2333
01:26:29,040 --> 01:26:34,480
the number in a numerical order, then
2334
01:26:31,199 --> 01:26:36,639
you can use the N flag. Okay guys, so uh
2335
01:26:34,480 --> 01:26:38,560
let me first of all go to my terminal
2336
01:26:36,639 --> 01:26:39,760
and start executing them. Okay, so what
2337
01:26:38,560 --> 01:26:42,880
I'm going to do is I'm going to clear my
2338
01:26:39,760 --> 01:26:44,639
screen and currently let me just list on
2339
01:26:42,880 --> 01:26:46,880
the contents of this directory. So we
2340
01:26:44,639 --> 01:26:50,000
have automobiles uh file, we have file
2341
01:26:46,880 --> 01:26:51,920
one and we have file two when I just
2342
01:26:50,000 --> 01:26:53,600
give a sort and press enter. Then I
2343
01:26:51,920 --> 01:26:56,080
enter the interactive mode. Okay, so
2344
01:26:53,600 --> 01:26:58,000
here I can uh type all this. I can type
2345
01:26:56,080 --> 01:27:05,120
random words.
2346
01:26:58,000 --> 01:27:10,480
Okay, I can say U A B C D or I can say B
2347
01:27:05,120 --> 01:27:12,320
C D A or I can say E F E D FG all these
2348
01:27:10,480 --> 01:27:14,080
things. Okay. And then when I press Ctrl
2349
01:27:12,320 --> 01:27:15,679
D, it gets me out of the interactive
2350
01:27:14,080 --> 01:27:17,840
mode. And when I exit the interactive
2351
01:27:15,679 --> 01:27:20,800
mode, the text that I typed in, right,
2352
01:27:17,840 --> 01:27:22,960
the input that has been sorted. So this
2353
01:27:20,800 --> 01:27:25,600
up till this line was what I entered as
2354
01:27:22,960 --> 01:27:29,679
input if you remember and uh up till
2355
01:27:25,600 --> 01:27:31,520
EDFG, right? So basically this text has
2356
01:27:29,679 --> 01:27:34,239
been ordered as per alphabetical order
2357
01:27:31,520 --> 01:27:37,360
and since a comes first in alphabetical
2358
01:27:34,239 --> 01:27:39,840
chronology this is first the BCDA is
2359
01:27:37,360 --> 01:27:41,760
second and then you have the other lines
2360
01:27:39,840 --> 01:27:46,480
okay uh these have been sorted in an
2361
01:27:41,760 --> 01:27:50,159
alphabetical order now if I give sort
2362
01:27:46,480 --> 01:27:53,280
with the file name okay that is uh
2363
01:27:50,159 --> 01:27:56,159
automobiles.exe exe and if I give enter
2364
01:27:53,280 --> 01:27:58,639
then this particular uh file will be
2365
01:27:56,159 --> 01:28:00,560
ordered in the alphabetical order. Okay,
2366
01:27:58,639 --> 01:28:02,960
the contents will be uh listed down in
2367
01:28:00,560 --> 01:28:05,199
an alphabetical order. Uh let me clear
2368
01:28:02,960 --> 01:28:08,159
the screen and show that again. So let
2369
01:28:05,199 --> 01:28:11,920
me first just do a cat and show you how
2370
01:28:08,159 --> 01:28:14,800
the order is. Okay, now let me run the
2371
01:28:11,920 --> 01:28:17,520
sort
2372
01:28:14,800 --> 01:28:19,920
with the file name. Okay, so now if you
2373
01:28:17,520 --> 01:28:21,440
see it was in this order initially,
2374
01:28:19,920 --> 01:28:23,120
right? So car was the first option,
2375
01:28:21,440 --> 01:28:25,600
motorbike was the second, train was the
2376
01:28:23,120 --> 01:28:28,239
next, Maruti and then came Ferrari and
2377
01:28:25,600 --> 01:28:30,880
Lamborghini. But if you look at the
2378
01:28:28,239 --> 01:28:32,639
sorted uh result then it's in a sorted
2379
01:28:30,880 --> 01:28:34,480
manner right so first comes Amber then
2380
01:28:32,639 --> 01:28:37,520
comes Aprilia then comes Audi and then
2381
01:28:34,480 --> 01:28:39,600
the others so that's what sorting does
2382
01:28:37,520 --> 01:28:41,199
okay and the same thing can be done for
2383
01:28:39,600 --> 01:28:43,840
two different files at the same time. So
2384
01:28:41,199 --> 01:28:46,480
this was the automobiles .txt. Supposing
2385
01:28:43,840 --> 01:28:49,679
I want to list down even my file 2
2386
01:28:46,480 --> 01:28:52,960
contents. Then I can just type file
2387
01:28:49,679 --> 01:28:55,760
2.txt here and the results of both the
2388
01:28:52,960 --> 01:28:57,440
files will be in my uh terminal. Okay.
2389
01:28:55,760 --> 01:28:58,719
But before that let me just uh clear the
2390
01:28:57,440 --> 01:29:00,639
screen so that it'll be easier for you
2391
01:28:58,719 --> 01:29:03,440
to view the results. Okay. So now that
2392
01:29:00,639 --> 01:29:05,840
I've cleared the screen, let me uh sort
2393
01:29:03,440 --> 01:29:08,400
these two files. Okay. So let's the
2394
01:29:05,840 --> 01:29:11,360
command is sort and this is what I had
2395
01:29:08,400 --> 01:29:14,560
previously and let me add file two to
2396
01:29:11,360 --> 01:29:16,400
it. Okay, file 2.txt. Now what this
2397
01:29:14,560 --> 01:29:18,880
would do is the results of both these
2398
01:29:16,400 --> 01:29:20,719
files right automobiles and file two the
2399
01:29:18,880 --> 01:29:22,880
results of those would be sorted in the
2400
01:29:20,719 --> 01:29:25,679
alphabetical manner. Okay, now if I give
2401
01:29:22,880 --> 01:29:27,679
an enter as you can see here first
2402
01:29:25,679 --> 01:29:30,800
initially you have blank space. Okay,
2403
01:29:27,679 --> 01:29:32,719
now that is because blanks are ahead of
2404
01:29:30,800 --> 01:29:35,440
the capital A, right? This is the
2405
01:29:32,719 --> 01:29:38,000
alphabetical order. Correct. So first
2406
01:29:35,440 --> 01:29:40,880
comes blank space then comes u white
2407
01:29:38,000 --> 01:29:42,960
space and then comes the characters. So
2408
01:29:40,880 --> 01:29:46,000
once we are done with those things then
2409
01:29:42,960 --> 01:29:47,920
we have amber Aprilia Audi this was the
2410
01:29:46,000 --> 01:29:50,560
order in which the files were listed in
2411
01:29:47,920 --> 01:29:52,239
the automobiles and right after C D
2412
01:29:50,560 --> 01:29:54,159
comes okay now this line is part of the
2413
01:29:52,239 --> 01:29:56,000
file one while these were part of
2414
01:29:54,159 --> 01:30:00,000
automobiles. This was part of file
2415
01:29:56,000 --> 01:30:03,679
2.txt. So yeah these results were a part
2416
01:30:00,000 --> 01:30:05,679
of the automobiles txt file. The blank
2417
01:30:03,679 --> 01:30:09,840
lines here these were part of the file
2418
01:30:05,679 --> 01:30:12,719
2.txt and u again these two lines right
2419
01:30:09,840 --> 01:30:14,560
these were part of file 2.txt txt. Okay,
2420
01:30:12,719 --> 01:30:18,320
so this is what happens when you give
2421
01:30:14,560 --> 01:30:19,840
two files as arguments. Now, uh there
2422
01:30:18,320 --> 01:30:22,400
are other options that I want to show
2423
01:30:19,840 --> 01:30:25,280
you though. So there were flags like R
2424
01:30:22,400 --> 01:30:28,000
flag, right? So R flag lists the uh
2425
01:30:25,280 --> 01:30:30,000
results in the reverse order. Okay, I'm
2426
01:30:28,000 --> 01:30:31,760
just going to clear the screen and yeah,
2427
01:30:30,000 --> 01:30:36,000
for clearing the screen, the shortcut is
2428
01:30:31,760 --> 01:30:38,960
Ctrl L. All right, guys. So um let's say
2429
01:30:36,000 --> 01:30:41,040
sort automobiles.txt.
2430
01:30:38,960 --> 01:30:43,440
Okay, it's cat, right? Right? I don't
2431
01:30:41,040 --> 01:30:45,840
want to do cat. I want to do sort
2432
01:30:43,440 --> 01:30:48,960
automobiles. txt and I want to use the
2433
01:30:45,840 --> 01:30:50,719
flag minus r. So when you use minus r,
2434
01:30:48,960 --> 01:30:52,639
it will display the result in the
2435
01:30:50,719 --> 01:30:55,040
reverse order. So we have the reverse
2436
01:30:52,639 --> 01:30:57,520
order in which yamaha comes first and
2437
01:30:55,040 --> 01:31:00,000
amber comes last. So that is the reverse
2438
01:30:57,520 --> 01:31:02,400
order. And we have another flag here.
2439
01:31:00,000 --> 01:31:04,560
The other flag is the f flag which will
2440
01:31:02,400 --> 01:31:08,560
return the results in uh the case
2441
01:31:04,560 --> 01:31:11,440
insensitive uh fashion. Okay. So that is
2442
01:31:08,560 --> 01:31:14,159
the uh minus f and then if you go back
2443
01:31:11,440 --> 01:31:16,080
to the slides there is uh n option right
2444
01:31:14,159 --> 01:31:19,040
so n will return the results in the
2445
01:31:16,080 --> 01:31:22,480
numerical order. Now let me go to my uh
2446
01:31:19,040 --> 01:31:24,480
terminal and let me use the n flag now.
2447
01:31:22,480 --> 01:31:26,159
But of course I don't think it will sort
2448
01:31:24,480 --> 01:31:27,840
anything because there are no numericals
2449
01:31:26,159 --> 01:31:31,280
here. So what I'm going to do is I'm
2450
01:31:27,840 --> 01:31:34,639
going to u use the file 2.txt here.
2451
01:31:31,280 --> 01:31:36,400
Okay. File2.txt.
2452
01:31:34,639 --> 01:31:39,280
Okay. So there are no numericals here
2453
01:31:36,400 --> 01:31:43,760
either. What I can do is I can edit
2454
01:31:39,280 --> 01:31:46,960
these details. So let me go vi and uh
2455
01:31:43,760 --> 01:31:50,000
say file
2456
01:31:46,960 --> 01:31:52,400
2.xt and I'm going to enter the insert
2457
01:31:50,000 --> 01:31:56,560
mode. I'm going to remove all these
2458
01:31:52,400 --> 01:32:00,080
unwanted lines. Okay. So I've removed
2459
01:31:56,560 --> 01:32:02,239
all the blank lines. Now I'm going to
2460
01:32:00,080 --> 01:32:03,920
put one here. I'm going to put two here.
2461
01:32:02,239 --> 01:32:08,560
I'm going to add three to this line. I'm
2462
01:32:03,920 --> 01:32:11,679
going to add four to this line. Okay.
2463
01:32:08,560 --> 01:32:14,800
All right guys. Or let's say let's give
2464
01:32:11,679 --> 01:32:18,159
the order seven here. Okay. You have two
2465
01:32:14,800 --> 01:32:20,159
here. Okay. So there are some kind of uh
2466
01:32:18,159 --> 01:32:22,480
numericals ahead of uh you know before
2467
01:32:20,159 --> 01:32:24,880
every line starts. Right. So when we run
2468
01:32:22,480 --> 01:32:26,960
the minus n command now the sort command
2469
01:32:24,880 --> 01:32:28,480
with the n flag now then it would sort
2470
01:32:26,960 --> 01:32:30,000
these lines with respect to the lines
2471
01:32:28,480 --> 01:32:32,320
with the numerical order. Okay. So first
2472
01:32:30,000 --> 01:32:35,199
this line would be uh shown the blank
2473
01:32:32,320 --> 01:32:37,600
line. Okay. Then you would be shown the
2474
01:32:35,199 --> 01:32:39,199
uh uh you know the total line. Then you
2475
01:32:37,600 --> 01:32:44,320
would be shown the third line and like
2476
01:32:39,199 --> 01:32:47,920
that. So let me just uh escape colon and
2477
01:32:44,320 --> 01:32:51,280
save and quit. Okay. Now let me uh run
2478
01:32:47,920 --> 01:32:53,120
that same sort command. Sort-en file
2479
01:32:51,280 --> 01:32:55,920
2.txt.
2480
01:32:53,120 --> 01:32:57,760
So as you can see the uh alphabets are
2481
01:32:55,920 --> 01:32:59,679
first sorted. Okay. So the lines where
2482
01:32:57,760 --> 01:33:01,520
there are text characters or
2483
01:32:59,679 --> 01:33:03,679
alphabetical letters so those are
2484
01:33:01,520 --> 01:33:04,960
displayed and after that the lines that
2485
01:33:03,679 --> 01:33:08,880
are formatted after that are in
2486
01:33:04,960 --> 01:33:11,520
numerological fashion. Okay. So if I
2487
01:33:08,880 --> 01:33:14,400
don't give the n it would be a different
2488
01:33:11,520 --> 01:33:16,560
fashion altogether. So earlier the file
2489
01:33:14,400 --> 01:33:18,560
was just displayed in the regular
2490
01:33:16,560 --> 01:33:20,320
numerological order. Okay. So where 1 2
2491
01:33:18,560 --> 01:33:22,000
3 4 5 the numbers came first and then
2492
01:33:20,320 --> 01:33:24,800
came the text. But since we ran the
2493
01:33:22,000 --> 01:33:27,280
hyphen n the alphabetical letters or the
2494
01:33:24,800 --> 01:33:30,080
characters came first. Okay, after that
2495
01:33:27,280 --> 01:33:31,920
it was sorted by uh numerical letters.
2496
01:33:30,080 --> 01:33:33,760
So that's what the n flag does and and
2497
01:33:31,920 --> 01:33:36,159
that brings us to the end of the sort
2498
01:33:33,760 --> 01:33:38,880
commands. Okay,
2499
01:33:36,159 --> 01:33:41,280
so uh after the sort command, the next
2500
01:33:38,880 --> 01:33:44,239
one that we have in line is that of pipe
2501
01:33:41,280 --> 01:33:46,960
command. Okay, so this is referred to as
2502
01:33:44,239 --> 01:33:48,800
the pipe. So you'll find this in your uh
2503
01:33:46,960 --> 01:33:51,120
in your keyboards right above the enter
2504
01:33:48,800 --> 01:33:54,000
button. Okay, uh where you have the
2505
01:33:51,120 --> 01:33:55,440
backward slash. So in that button if you
2506
01:33:54,000 --> 01:33:57,520
press uh shift and if you press that
2507
01:33:55,440 --> 01:33:59,679
button you'll get this pipe command and
2508
01:33:57,520 --> 01:34:01,760
what the pipe command helps you does is
2509
01:33:59,679 --> 01:34:04,560
it uh lets you perform two operations in
2510
01:34:01,760 --> 01:34:06,159
the same command like it'll uh let me
2511
01:34:04,560 --> 01:34:08,480
search let's take the example that's
2512
01:34:06,159 --> 01:34:10,000
specified here okay we using the gp to
2513
01:34:08,480 --> 01:34:12,480
search for a particular string from a
2514
01:34:10,000 --> 01:34:15,199
file and uh we are using that and then
2515
01:34:12,480 --> 01:34:16,719
we are sorting that result okay now
2516
01:34:15,199 --> 01:34:18,880
since there are two operations involved
2517
01:34:16,719 --> 01:34:20,400
okay one is the sort and one is the uh
2518
01:34:18,880 --> 01:34:22,239
search since there are two operations
2519
01:34:20,400 --> 01:34:24,080
involved in the same command we separate
2520
01:34:22,239 --> 01:34:26,719
the two operations with the help of the
2521
01:34:24,080 --> 01:34:29,600
pipe command. So that's what uh this is
2522
01:34:26,719 --> 01:34:31,280
and uh as the definition says the pipe
2523
01:34:29,600 --> 01:34:33,679
command is used to output the result of
2524
01:34:31,280 --> 01:34:35,280
one command as input to another command.
2525
01:34:33,679 --> 01:34:37,360
Okay, the same thing can be said over
2526
01:34:35,280 --> 01:34:38,960
here also. So we'll first search the
2527
01:34:37,360 --> 01:34:40,800
file for a particular string and
2528
01:34:38,960 --> 01:34:43,199
whatever result you get that will be
2529
01:34:40,800 --> 01:34:46,800
given as input to the sort command over
2530
01:34:43,199 --> 01:34:49,520
here. Right? So this uh saves us time in
2531
01:34:46,800 --> 01:34:52,159
not having to mention the uh file name
2532
01:34:49,520 --> 01:34:54,480
after sort again. So we'll just be
2533
01:34:52,159 --> 01:34:56,239
performing one GP search and then we'll
2534
01:34:54,480 --> 01:34:58,000
just whatever result comes that result
2535
01:34:56,239 --> 01:35:01,440
will go to the operation that's
2536
01:34:58,000 --> 01:35:02,880
performed over here. Right? So um let me
2537
01:35:01,440 --> 01:35:04,960
just go to the terminal and show you an
2538
01:35:02,880 --> 01:35:08,400
example of this. I'm going to clear the
2539
01:35:04,960 --> 01:35:11,120
screen and uh let's run the grip command
2540
01:35:08,400 --> 01:35:12,800
to search for am from the
2541
01:35:11,120 --> 01:35:14,880
automobiles.txt.
2542
01:35:12,800 --> 01:35:17,920
Okay, I'm going to use the pipe command
2543
01:35:14,880 --> 01:35:20,239
and uh sort this. So these were the two
2544
01:35:17,920 --> 01:35:21,920
results, right? So when you do a cat
2545
01:35:20,239 --> 01:35:24,400
command or when you do when you just run
2546
01:35:21,920 --> 01:35:25,520
the gp command with am right so what
2547
01:35:24,400 --> 01:35:27,520
would happen is you'll get these two
2548
01:35:25,520 --> 01:35:30,239
results because these two lines or these
2549
01:35:27,520 --> 01:35:33,120
two words have the am characters inside
2550
01:35:30,239 --> 01:35:35,199
right now when you give the sort it
2551
01:35:33,120 --> 01:35:37,280
would sort it alphabetically right and
2552
01:35:35,199 --> 01:35:39,360
if I if I want to sort it in the other
2553
01:35:37,280 --> 01:35:42,560
way then I can just run the same command
2554
01:35:39,360 --> 01:35:44,639
with the r flag so when I do r then this
2555
01:35:42,560 --> 01:35:46,400
result will be sorted in the reverse
2556
01:35:44,639 --> 01:35:48,719
fashion so yamaha comes first and
2557
01:35:46,400 --> 01:35:50,880
lamoggony comes first so that's how the
2558
01:35:48,719 --> 01:35:53,199
pipe command can be used to get the
2559
01:35:50,880 --> 01:35:55,280
output from one operation and feed that
2560
01:35:53,199 --> 01:35:58,159
output as the input to the next
2561
01:35:55,280 --> 01:36:00,639
operation. Right? So um this is
2562
01:35:58,159 --> 01:36:02,560
relatively smaller topic. Okay. And we
2563
01:36:00,639 --> 01:36:04,719
quite often we'd be using uh the pipe
2564
01:36:02,560 --> 01:36:06,400
command when you want to use multiple uh
2565
01:36:04,719 --> 01:36:08,400
operations in the same command. So
2566
01:36:06,400 --> 01:36:10,000
that's about the pipe command. Okay. So
2567
01:36:08,400 --> 01:36:11,840
let me just clear the screen and get
2568
01:36:10,000 --> 01:36:14,480
back to my presentation and see what's
2569
01:36:11,840 --> 01:36:17,520
my next slide all about. Okay. So now
2570
01:36:14,480 --> 01:36:19,440
that I've shown you how to sort the
2571
01:36:17,520 --> 01:36:21,600
contents of the file, let's go to the
2572
01:36:19,440 --> 01:36:23,679
next uh slide. Right. So the next
2573
01:36:21,600 --> 01:36:26,159
section of uh this Linux tutorial is
2574
01:36:23,679 --> 01:36:28,639
going to be about the copy, move, make
2575
01:36:26,159 --> 01:36:31,679
directory, remove, remove directory, and
2576
01:36:28,639 --> 01:36:33,280
the user permissions. All right. So
2577
01:36:31,679 --> 01:36:35,760
let's get started with this section.
2578
01:36:33,280 --> 01:36:37,760
Okay. Uh CP stands for copy and that
2579
01:36:35,760 --> 01:36:39,600
will be the first slide uh that we're
2580
01:36:37,760 --> 01:36:42,080
going to talk about. Okay. So as you
2581
01:36:39,600 --> 01:36:44,480
know copy is basically used to copy
2582
01:36:42,080 --> 01:36:46,800
files or directories. Okay. The point to
2583
01:36:44,480 --> 01:36:48,639
notice files and directories. So in
2584
01:36:46,800 --> 01:36:51,360
Windows you have the option of right
2585
01:36:48,639 --> 01:36:53,520
clicking on any file or any folder and
2586
01:36:51,360 --> 01:36:56,080
you know saying copy or copy paste or
2587
01:36:53,520 --> 01:36:58,239
cut paste right that's in Windows and
2588
01:36:56,080 --> 01:36:59,840
you can do that even through the GUI in
2589
01:36:58,239 --> 01:37:02,159
Linux. But how will you do it through
2590
01:36:59,840 --> 01:37:04,639
the CLI right through the terminal? You
2591
01:37:02,159 --> 01:37:06,719
specify this command. you specify CP and
2592
01:37:04,639 --> 01:37:08,800
if you have any flag you enter the flag
2593
01:37:06,719 --> 01:37:11,360
and then you specify the source and the
2594
01:37:08,800 --> 01:37:13,040
destination. Okay, so the source is
2595
01:37:11,360 --> 01:37:14,320
basically this will be the path of the
2596
01:37:13,040 --> 01:37:16,159
folder that you want to copy and this is
2597
01:37:14,320 --> 01:37:19,920
the place where you want to copy it to.
2598
01:37:16,159 --> 01:37:21,199
All right, so uh let's uh get back to
2599
01:37:19,920 --> 01:37:22,480
executing and showing you a
2600
01:37:21,199 --> 01:37:24,960
demonstration of this. So I'm going to
2601
01:37:22,480 --> 01:37:27,119
go back to my terminal. So uh first of
2602
01:37:24,960 --> 01:37:28,560
all uh we are in the documents directory
2603
01:37:27,119 --> 01:37:30,000
and let's see what is there in this
2604
01:37:28,560 --> 01:37:31,920
directory. Okay, there are the three
2605
01:37:30,000 --> 01:37:35,040
files that we created, right? There is
2606
01:37:31,920 --> 01:37:37,280
automobiles.txt. There is file 1.xt and
2607
01:37:35,040 --> 01:37:39,280
file 2.txt.
2608
01:37:37,280 --> 01:37:42,239
Now what I'm going to do is I'm going to
2609
01:37:39,280 --> 01:37:46,080
copy the automobiles.txt and uh paste it
2610
01:37:42,239 --> 01:37:48,880
in my uh desktop. Okay. So let me just
2611
01:37:46,080 --> 01:37:50,320
minimize this. So this is my desktop,
2612
01:37:48,880 --> 01:37:52,080
right? So right now I don't have the
2613
01:37:50,320 --> 01:37:53,440
automobiles. But through the terminal
2614
01:37:52,080 --> 01:37:56,480
I'm going to run a command which will
2615
01:37:53,440 --> 01:37:58,320
copy the uh automobiles.txt to this
2616
01:37:56,480 --> 01:38:00,159
folder. Okay. So I'm just going to
2617
01:37:58,320 --> 01:38:03,040
minimize the terminal now to show you
2618
01:38:00,159 --> 01:38:05,920
that it happens. Okay, real time. So
2619
01:38:03,040 --> 01:38:08,719
what I'm going to do is u ls and I'm
2620
01:38:05,920 --> 01:38:10,480
going to say copy automobiles.txt.
2621
01:38:08,719 --> 01:38:16,639
This is the source and the destination
2622
01:38:10,480 --> 01:38:19,280
is uh root home edurea and uh in edureka
2623
01:38:16,639 --> 01:38:20,400
it's the desktop folder right when I hit
2624
01:38:19,280 --> 01:38:22,480
enter there will be a new
2625
01:38:20,400 --> 01:38:25,520
automobiles.txt file that'll be created
2626
01:38:22,480 --> 01:38:28,719
over here. So as you can see the new
2627
01:38:25,520 --> 01:38:30,400
file got created over here and uh yeah
2628
01:38:28,719 --> 01:38:32,719
so it's it's a very simple command that
2629
01:38:30,400 --> 01:38:35,199
you can uh execute. So you can do the
2630
01:38:32,719 --> 01:38:38,159
same thing to even uh directories and uh
2631
01:38:35,199 --> 01:38:41,119
files. All right. Uh so what I'm going
2632
01:38:38,159 --> 01:38:43,840
to do is uh I'll go to the home
2633
01:38:41,119 --> 01:38:45,199
directory and from the home directory
2634
01:38:43,840 --> 01:38:48,400
I'm going to go to the desktop directory
2635
01:38:45,199 --> 01:38:50,400
and copy the LMS folder. Right? So the
2636
01:38:48,400 --> 01:38:51,679
LMS folder is again uh you know it's
2637
01:38:50,400 --> 01:38:53,040
it's a folder this time. It's not a
2638
01:38:51,679 --> 01:38:54,000
file. So last time we copied a file.
2639
01:38:53,040 --> 01:38:56,320
This time I'm going to show you how to
2640
01:38:54,000 --> 01:38:58,080
copy the folder itself. Okay, I'm going
2641
01:38:56,320 --> 01:39:00,000
to copy this folder and paste it
2642
01:38:58,080 --> 01:39:05,199
somewhere else.
2643
01:39:00,000 --> 01:39:08,960
So let me go to the terminal cd and I'm
2644
01:39:05,199 --> 01:39:12,639
going to go to the desktop here.
2645
01:39:08,960 --> 01:39:16,719
All right. So we have uh LMS here. So
2646
01:39:12,639 --> 01:39:18,719
I'm going to say copy LMS. All right. So
2647
01:39:16,719 --> 01:39:20,800
I'm going to remove the slash from here
2648
01:39:18,719 --> 01:39:23,119
because I'm going to copy this uh folder
2649
01:39:20,800 --> 01:39:25,199
now. And uh this would make it the
2650
01:39:23,119 --> 01:39:27,199
source that would make LMS the source.
2651
01:39:25,199 --> 01:39:28,639
And the destination is we have to put
2652
01:39:27,199 --> 01:39:30,880
the absolute path here. Right? So we got
2653
01:39:28,639 --> 01:39:34,400
to start from the root directory and go
2654
01:39:30,880 --> 01:39:37,600
to home edurea. And let's say I want to
2655
01:39:34,400 --> 01:39:39,840
put it in the uh documents directory.
2656
01:39:37,600 --> 01:39:43,199
Okay. So something that is present uh in
2657
01:39:39,840 --> 01:39:45,600
the desktop directory that is uh being
2658
01:39:43,199 --> 01:39:48,080
copied and pasted inside the documents
2659
01:39:45,600 --> 01:39:50,159
directory. Okay. So when we give enter.
2660
01:39:48,080 --> 01:39:53,119
So guys uh we're getting an error here,
2661
01:39:50,159 --> 01:39:55,600
right? So it says copy cp omitting
2662
01:39:53,119 --> 01:39:56,960
directory lms. Can you all guess why
2663
01:39:55,600 --> 01:39:58,560
that is the case? Can you all like
2664
01:39:56,960 --> 01:40:00,400
understand the meaning of this error?
2665
01:39:58,560 --> 01:40:02,560
Omitting directory. Don't break your
2666
01:40:00,400 --> 01:40:04,080
sweat too much because u the meaning is
2667
01:40:02,560 --> 01:40:06,880
simple here. It just it has just omitted
2668
01:40:04,080 --> 01:40:09,520
a directory. Okay. Now the reason is so
2669
01:40:06,880 --> 01:40:12,000
that is because uh the cp command it by
2670
01:40:09,520 --> 01:40:13,920
default it copies only files. Okay. If
2671
01:40:12,000 --> 01:40:16,480
you want to copy directories also then
2672
01:40:13,920 --> 01:40:18,320
you got to add another flag called r
2673
01:40:16,480 --> 01:40:20,400
flag. So let me just quickly go to the
2674
01:40:18,320 --> 01:40:23,119
slides and show you uh the functionality
2675
01:40:20,400 --> 01:40:26,400
there. Okay, as you can see here uh we
2676
01:40:23,119 --> 01:40:28,639
have the R flag right. So CP minus R it
2677
01:40:26,400 --> 01:40:30,560
is for recursive copy and that is for
2678
01:40:28,639 --> 01:40:32,480
copying directories also. Okay, and it
2679
01:40:30,560 --> 01:40:33,840
copies also hidden files. If there are
2680
01:40:32,480 --> 01:40:35,360
any hidden files or if you have
2681
01:40:33,840 --> 01:40:37,360
directories which you want to copy
2682
01:40:35,360 --> 01:40:39,760
inside that directory then it will uh it
2683
01:40:37,360 --> 01:40:42,080
will copy that that itself. So that is
2684
01:40:39,760 --> 01:40:43,679
the thing because you cannot copy uh
2685
01:40:42,080 --> 01:40:46,080
directories without the R flag. You can
2686
01:40:43,679 --> 01:40:48,800
only copy files. So that is the uh
2687
01:40:46,080 --> 01:40:50,800
meaning here and uh we have another flag
2688
01:40:48,800 --> 01:40:53,520
here called the V flag and that is
2689
01:40:50,800 --> 01:40:55,440
verbose. Well, what verbose means is it
2690
01:40:53,520 --> 01:40:56,960
prints informative messages. Supposing
2691
01:40:55,440 --> 01:40:58,239
you're executing a command okay and
2692
01:40:56,960 --> 01:41:00,239
supposing the command is going to take
2693
01:40:58,239 --> 01:41:02,560
time like it's going to take a good 5 10
2694
01:41:00,239 --> 01:41:04,480
seconds then during that time it would
2695
01:41:02,560 --> 01:41:06,480
print the status of the system like
2696
01:41:04,480 --> 01:41:09,199
supposing it has completed like step one
2697
01:41:06,480 --> 01:41:10,800
to step three okay and it's stuck at
2698
01:41:09,199 --> 01:41:12,239
step four then it would print that
2699
01:41:10,800 --> 01:41:13,920
message and as an event when step four
2700
01:41:12,239 --> 01:41:15,520
is completed you will get a message uh
2701
01:41:13,920 --> 01:41:17,520
saying that's completed and yeah
2702
01:41:15,520 --> 01:41:19,040
similarly it's like progress wise it
2703
01:41:17,520 --> 01:41:20,719
tells you what is the progress and what
2704
01:41:19,040 --> 01:41:23,040
are the action that the system is taking
2705
01:41:20,719 --> 01:41:24,800
and what step it's performing so it just
2706
01:41:23,040 --> 01:41:27,199
prints such informative messages just
2707
01:41:24,800 --> 01:41:29,600
minus V. Okay. Okay. Let's first start
2708
01:41:27,199 --> 01:41:31,760
off with the I flag. Okay. So we have
2709
01:41:29,600 --> 01:41:33,600
something called as a CP flag I. Okay.
2710
01:41:31,760 --> 01:41:36,159
So when you give the I flag, it enters
2711
01:41:33,600 --> 01:41:38,400
the interactive mode. So when you say
2712
01:41:36,159 --> 01:41:40,239
interactive mode, it is because u at
2713
01:41:38,400 --> 01:41:42,000
times you might have files which will
2714
01:41:40,239 --> 01:41:44,000
all be already be present in in a
2715
01:41:42,000 --> 01:41:46,719
particular directory. Okay. Uh you saw
2716
01:41:44,000 --> 01:41:48,880
me copy automobiles.txt once from
2717
01:41:46,719 --> 01:41:50,719
documents to desktop. Okay. Now if I do
2718
01:41:48,880 --> 01:41:53,040
the same operation again if I run the
2719
01:41:50,719 --> 01:41:55,040
same command again at that time it'll
2720
01:41:53,040 --> 01:41:57,040
automatically overwrite the file right
2721
01:41:55,040 --> 01:41:59,119
because uh the file name is the same the
2722
01:41:57,040 --> 01:42:00,960
automobiles or txt is was the one that
2723
01:41:59,119 --> 01:42:02,800
is there in my documents folder and
2724
01:42:00,960 --> 01:42:04,960
again even over here on my desktop it is
2725
01:42:02,800 --> 01:42:06,400
documents uh sorry it's automobiles when
2726
01:42:04,960 --> 01:42:08,880
I copy them what would happen is that
2727
01:42:06,400 --> 01:42:10,639
file would be replaced okay now uh in
2728
01:42:08,880 --> 01:42:12,320
that kind of a situation when you're
2729
01:42:10,639 --> 01:42:14,080
copying multiple files you might want to
2730
01:42:12,320 --> 01:42:16,080
be notified before something happens
2731
01:42:14,080 --> 01:42:17,840
right so if you specify something like
2732
01:42:16,080 --> 01:42:19,360
the i flag then you will get an
2733
01:42:17,840 --> 01:42:21,360
interactive mode so the system will not
2734
01:42:19,360 --> 01:42:23,040
take a decision on its own but instead
2735
01:42:21,360 --> 01:42:26,080
it will not use any defaults okay that's
2736
01:42:23,040 --> 01:42:28,080
what we mean by uh on its own okay so it
2737
01:42:26,080 --> 01:42:30,080
would uh you know ask you it prompt you
2738
01:42:28,080 --> 01:42:31,520
for an answer. It will tell you that
2739
01:42:30,080 --> 01:42:33,840
okay this file already exists in this
2740
01:42:31,520 --> 01:42:35,440
directory and do you want to replace it
2741
01:42:33,840 --> 01:42:38,080
and then it'll give you an option Y or
2742
01:42:35,440 --> 01:42:41,040
N. Y stands for S, N stands for no. So
2743
01:42:38,080 --> 01:42:42,800
that's what the CP and I flag does and
2744
01:42:41,040 --> 01:42:44,480
when you give the N flag it will not
2745
01:42:42,800 --> 01:42:46,880
override the file. Okay, because by
2746
01:42:44,480 --> 01:42:48,719
default it overrides the file and if you
2747
01:42:46,880 --> 01:42:51,199
specify the N flag it will not override
2748
01:42:48,719 --> 01:42:53,199
the file. But the whole concept here is
2749
01:42:51,199 --> 01:42:55,040
it is based on the file name. What if
2750
01:42:53,199 --> 01:42:57,280
the file name is the same and the file
2751
01:42:55,040 --> 01:42:58,880
contents are different? Okay, at that
2752
01:42:57,280 --> 01:43:01,280
situation you might want something like
2753
01:42:58,880 --> 01:43:03,119
the flag u. Okay, now what the flag U
2754
01:43:01,280 --> 01:43:04,480
does is it will update the destination
2755
01:43:03,119 --> 01:43:06,400
file only when the source file is
2756
01:43:04,480 --> 01:43:08,080
different from the destination file. So
2757
01:43:06,400 --> 01:43:10,400
by using the N flag, you will make sure
2758
01:43:08,080 --> 01:43:12,560
that the file is not overwritten. Okay,
2759
01:43:10,400 --> 01:43:14,960
but then if you use the U flag, you will
2760
01:43:12,560 --> 01:43:16,719
have another benefit. Okay, what will
2761
01:43:14,960 --> 01:43:18,480
happen when you use the U flag is so
2762
01:43:16,719 --> 01:43:19,840
first it would check the file name. If
2763
01:43:18,480 --> 01:43:22,480
the file names are different, then it
2764
01:43:19,840 --> 01:43:24,480
would create a new file. If in case
2765
01:43:22,480 --> 01:43:26,239
there is another file by the same name
2766
01:43:24,480 --> 01:43:29,040
then it would check the contents of that
2767
01:43:26,239 --> 01:43:30,800
file. If the contents of that file and
2768
01:43:29,040 --> 01:43:33,199
the file that's being copied if they are
2769
01:43:30,800 --> 01:43:35,280
the same then it would not get copied
2770
01:43:33,199 --> 01:43:36,719
and it would only get copied when the
2771
01:43:35,280 --> 01:43:38,239
content is different. So at that time
2772
01:43:36,719 --> 01:43:40,400
you'll have two different files with the
2773
01:43:38,239 --> 01:43:44,080
same name. So that's the advantage with
2774
01:43:40,400 --> 01:43:47,280
the uh CP and U flag. Okay. So let's try
2775
01:43:44,080 --> 01:43:49,119
executing uh these options. All right.
2776
01:43:47,280 --> 01:43:52,000
So I'm just going to go back to my
2777
01:43:49,119 --> 01:43:54,960
terminal here. So first and foremost
2778
01:43:52,000 --> 01:43:58,480
let's execute the uh R flag. Okay, it's
2779
01:43:54,960 --> 01:44:02,000
capital R. So do note that. And uh when
2780
01:43:58,480 --> 01:44:04,560
you say enter, so the item is copied. So
2781
01:44:02,000 --> 01:44:05,920
if you go back to your documents folder,
2782
01:44:04,560 --> 01:44:07,280
you can see that there's a new folder
2783
01:44:05,920 --> 01:44:09,760
called elements that's been created. So
2784
01:44:07,280 --> 01:44:12,560
this was initially not present and it's
2785
01:44:09,760 --> 01:44:15,199
uh present now. Okay. Now what we'll do
2786
01:44:12,560 --> 01:44:17,760
is I'll delete this. Okay. I'm going to
2787
01:44:15,199 --> 01:44:20,159
minimize this. Execute the same command
2788
01:44:17,760 --> 01:44:22,880
along with the verbose flag. All right.
2789
01:44:20,159 --> 01:44:24,159
So, as you can see, the uh status of the
2790
01:44:22,880 --> 01:44:26,719
system was also displayed in the
2791
01:44:24,159 --> 01:44:29,679
meanwhile even though I entered my uh
2792
01:44:26,719 --> 01:44:32,400
text somewhere here. Yep, it's right
2793
01:44:29,679 --> 01:44:34,000
here. Correct. So, this was the earlier
2794
01:44:32,400 --> 01:44:36,000
uh command that I executed without the
2795
01:44:34,000 --> 01:44:38,800
verbos. Okay, here it just straightway
2796
01:44:36,000 --> 01:44:41,520
copied the file. Okay, the LMS sorry,
2797
01:44:38,800 --> 01:44:43,920
the LMS folder to my uh documents
2798
01:44:41,520 --> 01:44:46,000
folder. But when I gave V, the
2799
01:44:43,920 --> 01:44:48,080
informative message also came, right? So
2800
01:44:46,000 --> 01:44:50,320
it uh the step-by-step process of what
2801
01:44:48,080 --> 01:44:51,920
all is being copied came. So first uh
2802
01:44:50,320 --> 01:44:53,280
this was the first folder being copied.
2803
01:44:51,920 --> 01:44:54,800
This was the first subfolder being
2804
01:44:53,280 --> 01:44:56,320
copied and after that all the other
2805
01:44:54,800 --> 01:44:58,400
files that are being copied each and
2806
01:44:56,320 --> 01:45:00,159
every document step by step it is all
2807
01:44:58,400 --> 01:45:02,159
listed down and u you'll get all those
2808
01:45:00,159 --> 01:45:03,840
details here if you give minus v in your
2809
01:45:02,159 --> 01:45:06,880
command. So that's what the minus v
2810
01:45:03,840 --> 01:45:10,320
does. Okay. So I'm left to show you the
2811
01:45:06,880 --> 01:45:12,960
i, n and u flags, right? So what I'm
2812
01:45:10,320 --> 01:45:15,360
going to do is um let's say I just want
2813
01:45:12,960 --> 01:45:18,320
to clear the screen now. Okay. I'm going
2814
01:45:15,360 --> 01:45:19,520
to remove this command here and go back
2815
01:45:18,320 --> 01:45:21,520
to the documents folder and show you
2816
01:45:19,520 --> 01:45:23,199
that the LMS has been copied okay with
2817
01:45:21,520 --> 01:45:25,840
the verbos when I created this folder.
2818
01:45:23,199 --> 01:45:27,679
Okay. Now what I wanted to show you is I
2819
01:45:25,840 --> 01:45:30,080
want to show you copy with the
2820
01:45:27,679 --> 01:45:32,239
interactive mode. So earlier if you see
2821
01:45:30,080 --> 01:45:35,199
the uh desktop and there's already an
2822
01:45:32,239 --> 01:45:36,239
automobiles txt right so what I'm going
2823
01:45:35,199 --> 01:45:38,960
to do is I'm going to copy
2824
01:45:36,239 --> 01:45:40,880
automobiles.txt txt I'm going to copy
2825
01:45:38,960 --> 01:45:42,800
this one again to the desktop but this
2826
01:45:40,880 --> 01:45:44,960
time it should uh you know I'm going to
2827
01:45:42,800 --> 01:45:47,600
use an I flag and it will not overwrite
2828
01:45:44,960 --> 01:45:52,800
the existing flag. So I'm going to say
2829
01:45:47,600 --> 01:45:55,440
cp automobiles txt to destination is uh
2830
01:45:52,800 --> 01:45:58,239
home/ora
2831
01:45:55,440 --> 01:46:00,960
slash All right. Uh I think I'm in the
2832
01:45:58,239 --> 01:46:04,719
wrong directory right now. Okay. So I
2833
01:46:00,960 --> 01:46:08,639
need to go one uh path back. Switch to
2834
01:46:04,719 --> 01:46:11,760
documents. All right. Now here I need to
2835
01:46:08,639 --> 01:46:16,320
copy the automobiles from here right and
2836
01:46:11,760 --> 01:46:19,320
put it in the desktop. So
2837
01:46:16,320 --> 01:46:19,320
home/ora/
2838
01:46:21,040 --> 01:46:25,679
desktop. Okay. So I'm going to copy the
2839
01:46:23,679 --> 01:46:28,880
automobiles.txt over here. So when I
2840
01:46:25,679 --> 01:46:31,679
give enter the automobiles.xt has been
2841
01:46:28,880 --> 01:46:34,080
copied here again. So let me just go
2842
01:46:31,679 --> 01:46:35,920
back to my desktop and see that even
2843
01:46:34,080 --> 01:46:39,679
though I've run run this command two
2844
01:46:35,920 --> 01:46:41,679
times one now and uh one earlier and one
2845
01:46:39,679 --> 01:46:43,360
uh now just a couple of seconds back
2846
01:46:41,679 --> 01:46:44,639
there has been no duplicate that's been
2847
01:46:43,360 --> 01:46:46,639
created. That's because this file has
2848
01:46:44,639 --> 01:46:48,159
been overwritten. Okay, the one with the
2849
01:46:46,639 --> 01:46:50,080
name automobiles has been overwritten
2850
01:46:48,159 --> 01:46:52,000
with the latest command. So what I'm
2851
01:46:50,080 --> 01:46:55,440
going to show you now is I'm going to
2852
01:46:52,000 --> 01:46:57,360
use an I flag here. Like I told you flag
2853
01:46:55,440 --> 01:46:59,040
is what gets you into interactive mode.
2854
01:46:57,360 --> 01:47:01,119
So you will start interacting with the
2855
01:46:59,040 --> 01:47:04,000
uh Linux uh kernel or the Linux shell
2856
01:47:01,119 --> 01:47:06,000
over here. So as it says the uh home eda
2857
01:47:04,000 --> 01:47:07,679
desktop automobile.txt
2858
01:47:06,000 --> 01:47:10,639
it says overwrite. Do you want to
2859
01:47:07,679 --> 01:47:12,239
overwrite this particular uh file
2860
01:47:10,639 --> 01:47:14,880
because it's already present. If you
2861
01:47:12,239 --> 01:47:16,800
want to override if you say y and if you
2862
01:47:14,880 --> 01:47:19,360
enter then the file would be
2863
01:47:16,800 --> 01:47:21,040
overwritten. Okay. But if you uh give n
2864
01:47:19,360 --> 01:47:23,440
and enter then that file would not be
2865
01:47:21,040 --> 01:47:25,360
overwritten. So if I say no and if I
2866
01:47:23,440 --> 01:47:27,520
enter then uh that copy would have
2867
01:47:25,360 --> 01:47:29,760
failed. Okay. But if I do the same thing
2868
01:47:27,520 --> 01:47:30,880
again and if I press Y, it would have
2869
01:47:29,760 --> 01:47:33,920
overwritten the file would have been
2870
01:47:30,880 --> 01:47:36,239
overwritten. So that is uh what the I
2871
01:47:33,920 --> 01:47:39,119
flag is. And then you have another
2872
01:47:36,239 --> 01:47:40,639
option okay of the N flag. So the N flag
2873
01:47:39,119 --> 01:47:43,199
what it does is it does not overwrite
2874
01:47:40,639 --> 01:47:45,360
the file by default. So for that option
2875
01:47:43,199 --> 01:47:48,000
I told you that uh by default it
2876
01:47:45,360 --> 01:47:50,080
overrides right. So I also showed you
2877
01:47:48,000 --> 01:47:51,760
earlier that uh no duplicate was created
2878
01:47:50,080 --> 01:47:53,679
and the existing file was overwritten.
2879
01:47:51,760 --> 01:47:55,920
Supposing you don't want to do that then
2880
01:47:53,679 --> 01:47:58,000
you can just use the n flag which would
2881
01:47:55,920 --> 01:48:00,719
automatically indicate and tell the uh
2882
01:47:58,000 --> 01:48:03,679
Linux runtime engine that uh not to
2883
01:48:00,719 --> 01:48:05,040
overwrite this particular file. Okay. So
2884
01:48:03,679 --> 01:48:07,199
you can have any number of files there.
2885
01:48:05,040 --> 01:48:10,159
So even if the contents are different
2886
01:48:07,199 --> 01:48:11,760
here okay so even in caseh the new file
2887
01:48:10,159 --> 01:48:14,159
that's being copied has a different
2888
01:48:11,760 --> 01:48:15,920
content okay but it has the same name
2889
01:48:14,159 --> 01:48:18,000
then even in that case by specifying the
2890
01:48:15,920 --> 01:48:19,600
end file it will not be overwritten
2891
01:48:18,000 --> 01:48:21,119
because there's a good chance that you
2892
01:48:19,600 --> 01:48:23,199
might have made changes to the latest
2893
01:48:21,119 --> 01:48:24,880
file and by copying another file with
2894
01:48:23,199 --> 01:48:26,080
the same name to that same directory
2895
01:48:24,880 --> 01:48:27,360
then there's a good chance that you'll
2896
01:48:26,080 --> 01:48:29,760
be losing out on the changes that you
2897
01:48:27,360 --> 01:48:31,679
made right so at that time you can uh
2898
01:48:29,760 --> 01:48:33,520
use the n flag so in fact let me show
2899
01:48:31,679 --> 01:48:35,280
you that with an example uh what I'm
2900
01:48:33,520 --> 01:48:36,719
going to do is uh Right now we are in
2901
01:48:35,280 --> 01:48:40,719
the documents directory. So I'm going to
2902
01:48:36,719 --> 01:48:44,400
do a cat and automobiles. Okay. So these
2903
01:48:40,719 --> 01:48:47,199
are the contents here. And let me update
2904
01:48:44,400 --> 01:48:49,040
this. Okay. What I'm going to add is I'm
2905
01:48:47,199 --> 01:48:52,159
going to add another uh company of
2906
01:48:49,040 --> 01:48:55,520
another bike. Okay. Uh let's say we are
2907
01:48:52,159 --> 01:48:57,840
adding KTM to that list. Okay. So when I
2908
01:48:55,520 --> 01:49:00,880
do Ctrl D and exit the interactive mode
2909
01:48:57,840 --> 01:49:04,159
and if I do cat automobiles txt then KTM
2910
01:49:00,880 --> 01:49:06,639
would be added over here. Okay. Now this
2911
01:49:04,159 --> 01:49:09,119
uh automobiles file in the documents
2912
01:49:06,639 --> 01:49:11,760
right now this is the updated one. Okay.
2913
01:49:09,119 --> 01:49:14,560
But in the desktop the updated file is
2914
01:49:11,760 --> 01:49:16,560
not present. Okay. In the desktop the
2915
01:49:14,560 --> 01:49:18,480
file with only uh this much of content
2916
01:49:16,560 --> 01:49:21,520
is there. Now I'm going to execute the
2917
01:49:18,480 --> 01:49:23,520
command with the n flag. Okay. So with
2918
01:49:21,520 --> 01:49:25,040
the n flag it's basically indicating
2919
01:49:23,520 --> 01:49:27,360
that you're not supposed to override the
2920
01:49:25,040 --> 01:49:29,280
file. Okay. So when it says that when it
2921
01:49:27,360 --> 01:49:31,040
finds out that automobiles.xe txt is
2922
01:49:29,280 --> 01:49:34,080
present over there also in the desktop
2923
01:49:31,040 --> 01:49:36,800
also it would not copy the file at all
2924
01:49:34,080 --> 01:49:38,800
okay so when I go enter and of course so
2925
01:49:36,800 --> 01:49:41,040
there's nothing here now if I go to the
2926
01:49:38,800 --> 01:49:43,600
uh desktop okay if I click on
2927
01:49:41,040 --> 01:49:46,400
automobiles txt here you can see that uh
2928
01:49:43,600 --> 01:49:49,600
ktm is not present all right but however
2929
01:49:46,400 --> 01:49:52,000
when I close it and if I uh remove the n
2930
01:49:49,600 --> 01:49:54,000
flag right if I remove this flag and
2931
01:49:52,000 --> 01:49:56,159
execute it and if I go back to the
2932
01:49:54,000 --> 01:49:58,560
automobiles txt you'll find that km is
2933
01:49:56,159 --> 01:50:01,520
updated awesome right so that's the
2934
01:49:58,560 --> 01:50:03,920
power of this N flag. Okay, so that is
2935
01:50:01,520 --> 01:50:05,520
uh the end of uh all the different flags
2936
01:50:03,920 --> 01:50:08,320
that I was about to show you from my
2937
01:50:05,520 --> 01:50:09,600
PPT. Okay, so additionally there is one
2938
01:50:08,320 --> 01:50:11,520
other thing that I want to show you.
2939
01:50:09,600 --> 01:50:13,920
Okay, now I showed you how to copy from
2940
01:50:11,520 --> 01:50:15,119
source to destination. Okay, and now you
2941
01:50:13,920 --> 01:50:16,639
know what if you know the path of
2942
01:50:15,119 --> 01:50:18,560
something and you want to copy it to
2943
01:50:16,639 --> 01:50:20,239
your present directory to where you are
2944
01:50:18,560 --> 01:50:22,239
currently. So this is basically I'm just
2945
01:50:20,239 --> 01:50:23,920
teaching you this option to you know
2946
01:50:22,239 --> 01:50:25,679
save some time. Uh you know at times you
2947
01:50:23,920 --> 01:50:27,040
might want some shortcuts or some hacks,
2948
01:50:25,679 --> 01:50:29,360
right? you don't want to provide the
2949
01:50:27,040 --> 01:50:31,360
complete path everywhere. So at that
2950
01:50:29,360 --> 01:50:34,719
situations at that scenarios you can uh
2951
01:50:31,360 --> 01:50:36,560
use this uh hack and let me explain that
2952
01:50:34,719 --> 01:50:38,880
before I uh execute it in my uh
2953
01:50:36,560 --> 01:50:41,040
terminal. So what I'm saying is uh right
2954
01:50:38,880 --> 01:50:43,040
now I'm in my desktop and I have only my
2955
01:50:41,040 --> 01:50:46,000
automobiles and my readme text files.
2956
01:50:43,040 --> 01:50:47,920
Okay. Now but in my documents folder I
2957
01:50:46,000 --> 01:50:50,800
have three other text. I have file 1.xt
2958
01:50:47,920 --> 01:50:52,800
and file 2.xt. Okay. Let's say I just
2959
01:50:50,800 --> 01:50:54,880
want to copy the file 2.xt. What will I
2960
01:50:52,800 --> 01:50:57,440
do if I want to copy my file 2.txt txt
2961
01:50:54,880 --> 01:50:59,520
into my desktop. I'll have to go to my
2962
01:50:57,440 --> 01:51:01,199
uh documents folder then put the cp
2963
01:50:59,520 --> 01:51:03,760
command and then enter the file name and
2964
01:51:01,199 --> 01:51:05,040
then copy it to this folder. Right. I
2965
01:51:03,760 --> 01:51:07,679
have to specify the path of this
2966
01:51:05,040 --> 01:51:09,679
desktop. So instead of that there is
2967
01:51:07,679 --> 01:51:12,159
another hack over there. Okay. Now
2968
01:51:09,679 --> 01:51:14,400
instead of doing that what I can do is I
2969
01:51:12,159 --> 01:51:16,239
can just go to my terminal. I need to
2970
01:51:14,400 --> 01:51:19,440
first go to the desktop folder button.
2971
01:51:16,239 --> 01:51:22,560
Okay. So I'm going to go one step back.
2972
01:51:19,440 --> 01:51:24,960
I'm going to say change to desktop. And
2973
01:51:22,560 --> 01:51:27,360
here yes there is only automobiles.txt
2974
01:51:24,960 --> 01:51:29,360
and there is uh readme.txt. Now what I'm
2975
01:51:27,360 --> 01:51:32,320
going to do is I'm going to run the cp
2976
01:51:29,360 --> 01:51:34,000
command such that I copy file from this
2977
01:51:32,320 --> 01:51:37,280
particular directory to the current
2978
01:51:34,000 --> 01:51:38,719
directory. Okay. So the file 2.txt if
2979
01:51:37,280 --> 01:51:40,159
you remember that is present in my
2980
01:51:38,719 --> 01:51:41,520
documents directory. Right? So I'm going
2981
01:51:40,159 --> 01:51:42,880
to specify the path to the documents
2982
01:51:41,520 --> 01:51:48,639
directory and the path to documents
2983
01:51:42,880 --> 01:51:51,920
directory is / home edora and documents.
2984
01:51:48,639 --> 01:51:55,599
Okay. and the file name is uh file
2985
01:51:51,920 --> 01:51:58,000
2.txt. Okay, I'm going to copy this file
2986
01:51:55,599 --> 01:52:00,159
which is under this path to my current
2987
01:51:58,000 --> 01:52:02,239
directory. Okay, instead of uh having to
2988
01:52:00,159 --> 01:52:05,440
specify my complete current directory, I
2989
01:52:02,239 --> 01:52:06,880
can just give one dot. So this one dot
2990
01:52:05,440 --> 01:52:08,800
represents the current working
2991
01:52:06,880 --> 01:52:11,280
directory. Okay, I'm currently in my
2992
01:52:08,800 --> 01:52:15,760
desktop and what this command would do
2993
01:52:11,280 --> 01:52:17,840
is it would copy this file into this uh
2994
01:52:15,760 --> 01:52:21,280
current directory. Okay. Now when I give
2995
01:52:17,840 --> 01:52:23,360
enter and if I go back to my uh desktop,
2996
01:52:21,280 --> 01:52:25,360
you'll see that the file 2.txt has been
2997
01:52:23,360 --> 01:52:27,199
created. Okay. That's because it it went
2998
01:52:25,360 --> 01:52:30,239
to this path, picked up this file and
2999
01:52:27,199 --> 01:52:32,239
pasted it in my uh current direct. Okay.
3000
01:52:30,239 --> 01:52:33,360
So that's what this is about. All right.
3001
01:52:32,239 --> 01:52:34,880
So this is what I wanted to show you
3002
01:52:33,360 --> 01:52:36,880
guys. This was something additional
3003
01:52:34,880 --> 01:52:38,880
which was not there on the slides. So
3004
01:52:36,880 --> 01:52:42,320
I'm uh done with that. So moving on to
3005
01:52:38,880 --> 01:52:44,480
the next slide. Okay. So uh next up we
3006
01:52:42,320 --> 01:52:47,360
have uh is the move command. Okay. So
3007
01:52:44,480 --> 01:52:49,760
the MV like CP stands for copy. The MV
3008
01:52:47,360 --> 01:52:51,280
here stands for move. Okay. And this is
3009
01:52:49,760 --> 01:52:53,360
uh used at times when you want to cut
3010
01:52:51,280 --> 01:52:55,599
paste something. Okay. Uh this would
3011
01:52:53,360 --> 01:52:57,119
when we used copy then the original copy
3012
01:52:55,599 --> 01:52:58,800
of that file was also present in the
3013
01:52:57,119 --> 01:53:00,800
existing directory and it was created in
3014
01:52:58,800 --> 01:53:03,119
another directory. Right. But if you use
3015
01:53:00,800 --> 01:53:04,560
the MV command then it's going to
3016
01:53:03,119 --> 01:53:06,560
basically work like cut paste where
3017
01:53:04,560 --> 01:53:08,880
it'll remove the content from the uh
3018
01:53:06,560 --> 01:53:10,560
source directory and the only copy would
3019
01:53:08,880 --> 01:53:13,040
be present in the destination directory.
3020
01:53:10,560 --> 01:53:14,560
All right. So uh let me straight away
3021
01:53:13,040 --> 01:53:16,159
get started. It's not too much of an
3022
01:53:14,560 --> 01:53:18,080
explanation needed over here because uh
3023
01:53:16,159 --> 01:53:19,360
it's self-explanatory. If you use the I
3024
01:53:18,080 --> 01:53:21,599
flag, it basically enters into
3025
01:53:19,360 --> 01:53:23,599
interactive mode again like before. So
3026
01:53:21,599 --> 01:53:25,679
the U flag is again the same as what it
3027
01:53:23,599 --> 01:53:27,040
was in the copy command. It updates the
3028
01:53:25,679 --> 01:53:28,639
destination file only when the source
3029
01:53:27,040 --> 01:53:31,840
file is different from the destination
3030
01:53:28,639 --> 01:53:34,639
file. And uh the MV minus V again it
3031
01:53:31,840 --> 01:53:36,960
would uh you know uh move it would print
3032
01:53:34,639 --> 01:53:38,880
the system state. Okay, prints the
3033
01:53:36,960 --> 01:53:41,119
source and the destination files. Uh
3034
01:53:38,880 --> 01:53:42,960
gets into the interactive mode where the
3035
01:53:41,119 --> 01:53:44,639
okay, not interactive mode. It basically
3036
01:53:42,960 --> 01:53:45,920
means uh the system status will be
3037
01:53:44,639 --> 01:53:48,320
displayed over here. Okay, that's what
3038
01:53:45,920 --> 01:53:50,159
the verbose is all about. Uh so let me
3039
01:53:48,320 --> 01:53:53,599
go back to my terminal and uh show you
3040
01:53:50,159 --> 01:53:56,320
how this copy is done. All right, so let
3041
01:53:53,599 --> 01:54:00,480
me clear the screen and currently I'm in
3042
01:53:56,320 --> 01:54:02,480
my uh desktop folder. Okay, and here I
3043
01:54:00,480 --> 01:54:05,599
have these files. I have automobiles.txt
3044
01:54:02,480 --> 01:54:08,320
and readme and file 2. Okay. Now, what
3045
01:54:05,599 --> 01:54:12,159
I'm going to do is uh I'm going to use
3046
01:54:08,320 --> 01:54:14,320
the move command to move file 2.txt to
3047
01:54:12,159 --> 01:54:18,639
another uh destination. I'm going to
3048
01:54:14,320 --> 01:54:22,320
move it to the LMS. Right? So, when I
3049
01:54:18,639 --> 01:54:24,480
give uh LMS, okay, this means that this
3050
01:54:22,320 --> 01:54:27,040
move command will work such that this
3051
01:54:24,480 --> 01:54:29,280
file will be moved to LMS folder. Okay,
3052
01:54:27,040 --> 01:54:30,800
let me give enter and go back to my
3053
01:54:29,280 --> 01:54:32,320
desktop and find that it's not it's
3054
01:54:30,800 --> 01:54:34,480
missing. That's because I ran a command
3055
01:54:32,320 --> 01:54:37,119
over there. If I go to LMS, however,
3056
01:54:34,480 --> 01:54:39,760
I'll find the file 2.txt over here. All
3057
01:54:37,119 --> 01:54:42,880
right. Awesome. Right. So, that's what
3058
01:54:39,760 --> 01:54:45,760
the MV file does. And supposing I want
3059
01:54:42,880 --> 01:54:48,639
to uh you know, similar to copy, you can
3060
01:54:45,760 --> 01:54:51,360
move multiple uh files at the same time.
3061
01:54:48,639 --> 01:54:54,080
All right. So, I can uh move, you know,
3062
01:54:51,360 --> 01:54:56,159
supposing uh I go back to my desktop.
3063
01:54:54,080 --> 01:54:57,760
Okay. And I'll find that there is
3064
01:54:56,159 --> 01:55:00,080
automobiles and readme. Suppose I want
3065
01:54:57,760 --> 01:55:01,840
to move both of these to the uh LMS
3066
01:55:00,080 --> 01:55:04,639
directory, then I can do that also. I
3067
01:55:01,840 --> 01:55:08,800
can just uh simply give move. I can give
3068
01:55:04,639 --> 01:55:11,360
automobiles.txt and readme.txt and
3069
01:55:08,800 --> 01:55:13,280
specify the destination. I can move to
3070
01:55:11,360 --> 01:55:15,040
any other folder or I can move to LMS
3071
01:55:13,280 --> 01:55:17,440
folder. If I'm moving to LMS folder,
3072
01:55:15,040 --> 01:55:19,840
then I just need to give LMS. Okay. But
3073
01:55:17,440 --> 01:55:21,440
however, if I'm moving uh to another uh
3074
01:55:19,840 --> 01:55:25,920
folder, then I got to start from the
3075
01:55:21,440 --> 01:55:28,000
root say home eda and from here let's
3076
01:55:25,920 --> 01:55:29,760
say I want to go to downloads. Okay. So
3077
01:55:28,000 --> 01:55:33,040
downloads if I want to go I'll give this
3078
01:55:29,760 --> 01:55:35,760
path. I'll give enter. And if you notice
3079
01:55:33,040 --> 01:55:38,639
both are missing from my uh desktop. And
3080
01:55:35,760 --> 01:55:41,360
if I go to my eda and if I go to
3081
01:55:38,639 --> 01:55:44,000
downloads I can find the two files over
3082
01:55:41,360 --> 01:55:46,719
here. So that's how simple it is guys.
3083
01:55:44,000 --> 01:55:49,760
So that's the uh move command. And if
3084
01:55:46,719 --> 01:55:51,840
you want to see the system status then
3085
01:55:49,760 --> 01:55:53,840
you can use the V flag like we use for
3086
01:55:51,840 --> 01:55:55,360
CP. So a similar log will be generated
3087
01:55:53,840 --> 01:55:57,040
and shown. If you want to enter
3088
01:55:55,360 --> 01:55:59,119
interactive mode then you can use the I
3089
01:55:57,040 --> 01:56:01,199
flag. All right. If you're moving like
3090
01:55:59,119 --> 01:56:03,199
two files right at that time you might
3091
01:56:01,199 --> 01:56:05,679
need the interactive uh interactive
3092
01:56:03,199 --> 01:56:07,679
file. So similar to copy where if you're
3093
01:56:05,679 --> 01:56:09,280
moving to the destinations folder where
3094
01:56:07,679 --> 01:56:10,639
there's already another file with the
3095
01:56:09,280 --> 01:56:12,560
same name then at that time you might
3096
01:56:10,639 --> 01:56:14,239
want to use the i flag. It would ask you
3097
01:56:12,560 --> 01:56:15,599
whether you want to override it or not.
3098
01:56:14,239 --> 01:56:17,280
If you don't want to override it at all
3099
01:56:15,599 --> 01:56:18,800
then you can just give the n flag. But
3100
01:56:17,280 --> 01:56:21,119
there again if you don't want to use the
3101
01:56:18,800 --> 01:56:23,280
n flag either then you can uh use the
3102
01:56:21,119 --> 01:56:25,280
minus u flag which would update the
3103
01:56:23,280 --> 01:56:27,360
destination file only when the source
3104
01:56:25,280 --> 01:56:30,800
and the destination files are different.
3105
01:56:27,360 --> 01:56:32,639
Okay. So these are the uh different
3106
01:56:30,800 --> 01:56:33,840
flags that can be used with MB. So the
3107
01:56:32,639 --> 01:56:35,280
basically the flags that can be used
3108
01:56:33,840 --> 01:56:37,920
here are the same as the flags that can
3109
01:56:35,280 --> 01:56:40,159
be used with the copy command. So guys
3110
01:56:37,920 --> 01:56:41,760
uh that's it with the uh move command
3111
01:56:40,159 --> 01:56:43,679
and we can go to the next slide. Okay.
3112
01:56:41,760 --> 01:56:45,199
We can go to the next topic. But before
3113
01:56:43,679 --> 01:56:46,639
that there is one more functionality
3114
01:56:45,199 --> 01:56:49,040
that I want to show you with respect to
3115
01:56:46,639 --> 01:56:51,440
both copy and move. I uh actually forgot
3116
01:56:49,040 --> 01:56:53,920
to show you this aspect. Okay. Now uh
3117
01:56:51,440 --> 01:56:56,480
for this let me first show you the GUI
3118
01:56:53,920 --> 01:56:59,280
aspect. Okay. All right. I go to my
3119
01:56:56,480 --> 01:57:00,880
ederka and if you go to my documents
3120
01:56:59,280 --> 01:57:03,360
you'll find all these uh three text
3121
01:57:00,880 --> 01:57:05,840
files and also my LMS folder right now
3122
01:57:03,360 --> 01:57:07,199
whether be it copy or whether be it move
3123
01:57:05,840 --> 01:57:08,960
commands I've showed you how to copy
3124
01:57:07,199 --> 01:57:11,440
like one file or two files or three
3125
01:57:08,960 --> 01:57:13,440
files okay but what if you have like 25
3126
01:57:11,440 --> 01:57:15,040
files right so what you have like I mean
3127
01:57:13,440 --> 01:57:16,800
just think about this what if you're a
3128
01:57:15,040 --> 01:57:18,800
proper uh Linux user and you and you
3129
01:57:16,800 --> 01:57:20,800
want to just transfer all your files of
3130
01:57:18,800 --> 01:57:22,080
some particular format right you want to
3131
01:57:20,800 --> 01:57:23,199
just transfer it to another folder you
3132
01:57:22,080 --> 01:57:25,760
want to take a backup or something like
3133
01:57:23,199 --> 01:57:27,520
that what would you do instead you know
3134
01:57:25,760 --> 01:57:29,360
you can do a control A over here and
3135
01:57:27,520 --> 01:57:31,119
choose all the files okay or you can
3136
01:57:29,360 --> 01:57:33,440
choose one after the other like this but
3137
01:57:31,119 --> 01:57:35,440
through the CLI how do you do it correct
3138
01:57:33,440 --> 01:57:37,599
so you have such problems right so for
3139
01:57:35,440 --> 01:57:40,320
that you know we have options also for
3140
01:57:37,599 --> 01:57:42,000
CLI and uh those work with both CP and
3141
01:57:40,320 --> 01:57:43,599
the move commands so what I'm going to
3142
01:57:42,000 --> 01:57:46,159
do is I'm going to show you how that is
3143
01:57:43,599 --> 01:57:48,239
done uh so for that purpose I'm going to
3144
01:57:46,159 --> 01:57:51,280
first go to my documents directory I'm
3145
01:57:48,239 --> 01:57:56,000
going to make that my uh pwd so I'll
3146
01:57:51,280 --> 01:57:59,199
just go on back and here I um
3147
01:57:56,000 --> 01:58:00,639
go to documents. Okay, now I'm here. So,
3148
01:57:59,199 --> 01:58:02,400
what I'm going to do is uh I'm just
3149
01:58:00,639 --> 01:58:03,679
going to clear the screen. So, of
3150
01:58:02,400 --> 01:58:06,000
course, for clearing the screen, the
3151
01:58:03,679 --> 01:58:08,239
shortcut is uh Ctrl L. Okay, if you guys
3152
01:58:06,000 --> 01:58:10,239
have forgotten that and uh I also
3153
01:58:08,239 --> 01:58:13,040
mentioned that earlier. So, Ctrl L is
3154
01:58:10,239 --> 01:58:15,360
the shortcut for that. Uh so, yeah, we
3155
01:58:13,040 --> 01:58:18,000
have automobile.txt, file 1 and file 2
3156
01:58:15,360 --> 01:58:20,320
and LMS. So, we have these four files
3157
01:58:18,000 --> 01:58:21,920
and one folder there. Okay. Now if I
3158
01:58:20,320 --> 01:58:23,920
want to move this one of the directory
3159
01:58:21,920 --> 01:58:25,119
then there's another option. So what I
3160
01:58:23,920 --> 01:58:27,360
can do is I can use something called as
3161
01:58:25,119 --> 01:58:28,800
regular expressions. Okay. Uh regular
3162
01:58:27,360 --> 01:58:30,480
expressions is one topic which I'm going
3163
01:58:28,800 --> 01:58:32,000
to cover in detail later during the
3164
01:58:30,480 --> 01:58:34,960
session. But just because we're in the
3165
01:58:32,000 --> 01:58:36,639
CP or in the move commands uh stage of
3166
01:58:34,960 --> 01:58:38,159
this uh demonstration. I want to
3167
01:58:36,639 --> 01:58:39,920
continue and I want to show you this
3168
01:58:38,159 --> 01:58:41,679
also. Okay. I want to just get finished
3169
01:58:39,920 --> 01:58:43,679
with this part. So you will get an idea
3170
01:58:41,679 --> 01:58:46,639
of what I'm saying when you see me do
3171
01:58:43,679 --> 01:58:48,639
this. Uh so here we have these four
3172
01:58:46,639 --> 01:58:50,880
files. So first let's use the copy
3173
01:58:48,639 --> 01:58:52,400
command. So if I want to copy all the
3174
01:58:50,880 --> 01:58:54,880
files which are in the form of a file.
3175
01:58:52,400 --> 01:58:56,960
Okay. So they are all in the txt format.
3176
01:58:54,880 --> 01:59:01,440
Right. So what I can do is I can uh just
3177
01:58:56,960 --> 01:59:05,840
do a cb I can uh click on dot or rather
3178
01:59:01,440 --> 01:59:08,080
asterric dot txt. Okay. Now what this
3179
01:59:05,840 --> 01:59:10,480
essentially does is instead of uh
3180
01:59:08,080 --> 01:59:12,000
searching for the text file by its name
3181
01:59:10,480 --> 01:59:15,199
and you specify an asterric it searches
3182
01:59:12,000 --> 01:59:16,960
for all the files with the uh txt. Okay
3183
01:59:15,199 --> 01:59:19,760
which is ending with a txt. So that's
3184
01:59:16,960 --> 01:59:22,960
what this would do. And when we say cp
3185
01:59:19,760 --> 01:59:25,599
followed by asterric txt, it means copy
3186
01:59:22,960 --> 01:59:28,159
all the files that are ending with txt.
3187
01:59:25,599 --> 01:59:32,400
So in our case we have automobiles.txt,
3188
01:59:28,159 --> 01:59:33,840
file 1.txt and file 2.txt. Right? So
3189
01:59:32,400 --> 01:59:35,599
what this command would do is it would
3190
01:59:33,840 --> 01:59:37,840
copy these things and put it in the path
3191
01:59:35,599 --> 01:59:39,920
where I suggest here. So let's say I
3192
01:59:37,840 --> 01:59:43,760
want to put it in another folder. Okay.
3193
01:59:39,920 --> 01:59:46,239
Let me start off from the root home eda.
3194
01:59:43,760 --> 01:59:47,679
Then here I think we have you know we
3195
01:59:46,239 --> 01:59:50,000
have these options right? Okay this is
3196
01:59:47,679 --> 01:59:52,000
the documents. So in the edrica we have
3197
01:59:50,000 --> 01:59:54,159
okay we have the music folder we have
3198
01:59:52,000 --> 01:59:55,440
downloads pictures. Okay downloads of
3199
01:59:54,159 --> 01:59:56,800
course I've already copied something in
3200
01:59:55,440 --> 01:59:59,280
there. So what I'll do is I'll move that
3201
01:59:56,800 --> 02:00:01,679
to the music folder. Okay. So the music
3202
01:59:59,280 --> 02:00:04,560
directory. So I'm going to say this and
3203
02:00:01,679 --> 02:00:06,320
give enter. So your copying has been
3204
02:00:04,560 --> 02:00:08,159
successful. So if you go back to the uh
3205
02:00:06,320 --> 02:00:10,159
music directory you'll see that there
3206
02:00:08,159 --> 02:00:11,520
are three new files. One is automobiles,
3207
02:00:10,159 --> 02:00:14,480
the other one is file one and the other
3208
02:00:11,520 --> 02:00:16,800
one is file two. Okay. Now, uh the same
3209
02:00:14,480 --> 02:00:19,119
thing can be done for even move, right?
3210
02:00:16,800 --> 02:00:21,199
Uh the same way we executed a copy, we
3211
02:00:19,119 --> 02:00:22,880
can also execute the move command. Move
3212
02:00:21,199 --> 02:00:24,719
is going to completely move it. It's
3213
02:00:22,880 --> 02:00:27,040
more like cut pasting. Okay? Similar to
3214
02:00:24,719 --> 02:00:28,800
how you remember from Windows. Let's
3215
02:00:27,040 --> 02:00:30,800
move it to pictures. Okay. So, currently
3216
02:00:28,800 --> 02:00:32,239
in pictures, there's nothing. And in uh
3217
02:00:30,800 --> 02:00:33,920
music, we have these three. So, when I
3218
02:00:32,239 --> 02:00:35,760
execute the move command, this folder
3219
02:00:33,920 --> 02:00:38,639
should become empty. And they should all
3220
02:00:35,760 --> 02:00:42,080
go to the pictures uh folder. All right.
3221
02:00:38,639 --> 02:00:44,080
So, move. Okay. But we have a problem
3222
02:00:42,080 --> 02:00:47,440
for that. What we need to do is we got
3223
02:00:44,080 --> 02:00:50,000
to move to our uh music folder, right?
3224
02:00:47,440 --> 02:00:52,880
So it would this would probably show an
3225
02:00:50,000 --> 02:00:55,840
error. So I'm going to first uh go back
3226
02:00:52,880 --> 02:00:57,679
or rather go to music folder. Okay, we
3227
02:00:55,840 --> 02:01:02,000
are in documents, right? So what we're
3228
02:00:57,679 --> 02:01:04,239
going to do is uh cd music. All right.
3229
02:01:02,000 --> 02:01:06,639
And I have my commands here. Right. So
3230
02:01:04,239 --> 02:01:08,400
here I'll execute that move command. So
3231
02:01:06,639 --> 02:01:13,520
it was this one. And I'm just going to
3232
02:01:08,400 --> 02:01:15,360
replace CP with MV. Okay. So from my uh
3233
02:01:13,520 --> 02:01:17,440
music directory, it's going to move all
3234
02:01:15,360 --> 02:01:19,360
the folders or files which will have the
3235
02:01:17,440 --> 02:01:21,440
.txt format. Okay. All the files, not
3236
02:01:19,360 --> 02:01:24,320
folders. It will move all the files with
3237
02:01:21,440 --> 02:01:26,800
the .txt format. And it will move it to
3238
02:01:24,320 --> 02:01:28,800
home/ora/
3239
02:01:26,800 --> 02:01:32,800
let's move it to pictures. What do you
3240
02:01:28,800 --> 02:01:34,800
say? Okay. So when I give enter, that
3241
02:01:32,800 --> 02:01:36,960
would have moved. So let's go back to
3242
02:01:34,800 --> 02:01:40,080
our folders. Music. There's nothing
3243
02:01:36,960 --> 02:01:42,639
here. This has been cut pasted to the
3244
02:01:40,080 --> 02:01:44,159
pictures directory. All right. So this
3245
02:01:42,639 --> 02:01:45,440
is what I want to show you. Okay. This
3246
02:01:44,159 --> 02:01:47,360
is what I missed showing you earlier
3247
02:01:45,440 --> 02:01:50,000
while executing the cp command. But
3248
02:01:47,360 --> 02:01:52,080
yeah, here we are. I've done this. And
3249
02:01:50,000 --> 02:01:54,000
similarly, if you want to go also uh you
3250
02:01:52,080 --> 02:01:55,599
know, if you're from the music directory
3251
02:01:54,000 --> 02:01:56,960
and if you want to move something to the
3252
02:01:55,599 --> 02:01:59,599
uh present working directory, even that
3253
02:01:56,960 --> 02:02:01,199
is possible. Okay. So another
3254
02:01:59,599 --> 02:02:04,960
possibility which I would like to show
3255
02:02:01,199 --> 02:02:08,159
you is that uh of going back going to
3256
02:02:04,960 --> 02:02:09,520
pictures and then we have all this here
3257
02:02:08,159 --> 02:02:12,480
right I'm going to clear the screen ls
3258
02:02:09,520 --> 02:02:17,040
again we have automobiles file one txt
3259
02:02:12,480 --> 02:02:21,880
and file 2 txt right so uh we can do a
3260
02:02:17,040 --> 02:02:21,880
move command and u
3261
02:02:22,880 --> 02:02:28,639
so right now we are in the u so let me
3262
02:02:26,480 --> 02:02:30,560
clear the screen
3263
02:02:28,639 --> 02:02:33,520
So I'm going to do a CD. I'm going to
3264
02:02:30,560 --> 02:02:35,840
clear the screen. And uh currently I'm
3265
02:02:33,520 --> 02:02:37,040
going to do an ls. So some of our items
3266
02:02:35,840 --> 02:02:39,360
are present in pictures. So what I'm
3267
02:02:37,040 --> 02:02:42,880
going to do is I'm going to uh move back
3268
02:02:39,360 --> 02:02:46,239
to music. If I do an ls, there's nothing
3269
02:02:42,880 --> 02:02:47,840
over here. So what I'll do is I'll say
3270
02:02:46,239 --> 02:02:50,800
move
3271
02:02:47,840 --> 02:02:52,320
slashhome/reka
3272
02:02:50,800 --> 02:02:58,800
slash
3273
02:02:52,320 --> 02:03:00,400
pictures dot okay asterric first dot txt
3274
02:02:58,800 --> 02:03:03,199
and I want to move it to the current
3275
02:03:00,400 --> 02:03:04,800
directory. So when I do this again from
3276
02:03:03,199 --> 02:03:08,639
the pictures everything would have moved
3277
02:03:04,800 --> 02:03:11,520
back to music. All right. So that is the
3278
02:03:08,639 --> 02:03:13,599
other uh thing that I want to show you.
3279
02:03:11,520 --> 02:03:15,840
Okay. So similarly it works for even the
3280
02:03:13,599 --> 02:03:17,599
copy command. I'm pretty sure you'll
3281
02:03:15,840 --> 02:03:20,480
understand how it works. So I'm not
3282
02:03:17,599 --> 02:03:22,880
going to waste too much time on that.
3283
02:03:20,480 --> 02:03:25,280
Okay, I've cleared my screen and now
3284
02:03:22,880 --> 02:03:27,280
let's uh start with the next topic.
3285
02:03:25,280 --> 02:03:30,320
Okay, I'm going to go back to my slides
3286
02:03:27,280 --> 02:03:32,719
and yeah, the next topic is uh make
3287
02:03:30,320 --> 02:03:34,880
directory commands. Okay, so the next
3288
02:03:32,719 --> 02:03:38,320
topic is uh make directory. Okay, that's
3289
02:03:34,880 --> 02:03:41,119
what mkdir stands for make directory.
3290
02:03:38,320 --> 02:03:42,719
All right. So it's simple again if it's
3291
02:03:41,119 --> 02:03:45,760
all about creating a new directory or
3292
02:03:42,719 --> 02:03:47,520
creating a new folder. Okay. So uh to
3293
02:03:45,760 --> 02:03:51,119
create a new directory you just specify
3294
02:03:47,520 --> 02:03:53,760
mkdir and uh the path. Okay the
3295
02:03:51,119 --> 02:03:56,080
directory path. Okay. That would create
3296
02:03:53,760 --> 02:03:59,119
a new subdirectory in that path. Okay
3297
02:03:56,080 --> 02:04:01,360
guys so currently we are in the uh
3298
02:03:59,119 --> 02:04:03,679
documents right. So I'm going to do an
3299
02:04:01,360 --> 02:04:07,199
ls. I have these many uh things. So I'm
3300
02:04:03,679 --> 02:04:09,360
going to do a mkdir and create a new
3301
02:04:07,199 --> 02:04:12,320
folder over here. So that folder name is
3302
02:04:09,360 --> 02:04:15,360
going to be uh let's say
3303
02:04:12,320 --> 02:04:16,880
folder one. Okay. When I do this a new
3304
02:04:15,360 --> 02:04:18,880
folder is created. So when I do the ls
3305
02:04:16,880 --> 02:04:21,119
command again so you can see that the
3306
02:04:18,880 --> 02:04:22,560
folder one is extra. Okay. It was not
3307
02:04:21,119 --> 02:04:25,520
there the previous time that we executed
3308
02:04:22,560 --> 02:04:27,679
the ls command. Okay. So that's how you
3309
02:04:25,520 --> 02:04:30,320
create a new folder. So it's pretty
3310
02:04:27,679 --> 02:04:34,320
simple. Now comes the other question.
3311
02:04:30,320 --> 02:04:35,679
Okay. I can go into uh the folder one.
3312
02:04:34,320 --> 02:04:38,400
Okay, of course there'll be nothing
3313
02:04:35,679 --> 02:04:40,719
inside. Now what if I want to create
3314
02:04:38,400 --> 02:04:42,880
multiple folders okay and uh parent
3315
02:04:40,719 --> 02:04:44,480
directories. Let's say something like I
3316
02:04:42,880 --> 02:04:45,920
want to create folder one inside which I
3317
02:04:44,480 --> 02:04:50,159
want to create a folder two and create a
3318
02:04:45,920 --> 02:04:51,760
folder three. Is that possible? Okay. So
3319
02:04:50,159 --> 02:04:54,000
I'm going to try doing that and show you
3320
02:04:51,760 --> 02:04:58,239
if it's possible or not. Okay. So I'm
3321
02:04:54,000 --> 02:05:00,159
going to say make directory folder one/
3322
02:04:58,239 --> 02:05:01,520
folder two. Okay. This would be folder
3323
02:05:00,159 --> 02:05:05,440
two because I'm already inside folder
3324
02:05:01,520 --> 02:05:07,920
one. This would be folder three and
3325
02:05:05,440 --> 02:05:09,199
folder four. Okay. So this basically
3326
02:05:07,920 --> 02:05:11,040
will run the make directory command
3327
02:05:09,199 --> 02:05:14,960
inside folder one and it will make a
3328
02:05:11,040 --> 02:05:17,199
directory 2 3 and four. Now when I give
3329
02:05:14,960 --> 02:05:19,599
enter these folders should be created.
3330
02:05:17,199 --> 02:05:21,760
Ideally they should be created. Okay.
3331
02:05:19,599 --> 02:05:23,440
Ideally speaking. So let me just verify
3332
02:05:21,760 --> 02:05:25,280
everything once and show it to you. So
3333
02:05:23,440 --> 02:05:26,960
it was documents. This was a new folder
3334
02:05:25,280 --> 02:05:29,760
I created. Folder one. There is nothing
3335
02:05:26,960 --> 02:05:33,440
inside. Okay. Now uh from the terminal
3336
02:05:29,760 --> 02:05:35,840
if I click enter it says make directory
3337
02:05:33,440 --> 02:05:37,599
cannot create directory folder 2 3 and
3338
02:05:35,840 --> 02:05:39,760
four okay because there's no such file
3339
02:05:37,599 --> 02:05:42,880
or directory okay do you know why that
3340
02:05:39,760 --> 02:05:45,599
is I as you specifically can we do it
3341
02:05:42,880 --> 02:05:48,800
that is because when we try to enter one
3342
02:05:45,599 --> 02:05:51,040
directory it's possible okay when like
3343
02:05:48,800 --> 02:05:52,480
in this case we specified just one one
3344
02:05:51,040 --> 02:05:54,400
directory right just folder one so it
3345
02:05:52,480 --> 02:05:56,239
created the directory once but in this
3346
02:05:54,400 --> 02:05:58,159
case there are too many directories that
3347
02:05:56,239 --> 02:06:00,320
we need to create okay it's like two
3348
02:05:58,159 --> 02:06:02,719
three and four. How can make directory
3349
02:06:00,320 --> 02:06:04,000
create so many folders? Because this is
3350
02:06:02,719 --> 02:06:06,080
going to be in the form of a parent,
3351
02:06:04,000 --> 02:06:07,280
child or a subdirectory, right? We are
3352
02:06:06,080 --> 02:06:08,719
creating folder two inside which there's
3353
02:06:07,280 --> 02:06:11,360
a folder three inside which there's a
3354
02:06:08,719 --> 02:06:12,800
folder four. So in this case, MKD is not
3355
02:06:11,360 --> 02:06:14,960
enough. So this is when we need to use
3356
02:06:12,800 --> 02:06:17,040
another flag called the hyphen P flag
3357
02:06:14,960 --> 02:06:19,040
that stands for parent. Okay, let me go
3358
02:06:17,040 --> 02:06:21,199
to my slides and just cover that aspect
3359
02:06:19,040 --> 02:06:23,119
once. So as you can see here, there's a
3360
02:06:21,199 --> 02:06:25,040
flag called hyphen P. Okay, and what it
3361
02:06:23,119 --> 02:06:27,599
does is it creates both a new parent
3362
02:06:25,040 --> 02:06:29,040
directory and a subdirectory. And it's
3363
02:06:27,599 --> 02:06:31,119
essentially used only when you're
3364
02:06:29,040 --> 02:06:32,560
creating like two three directories and
3365
02:06:31,119 --> 02:06:33,920
I mean you're creating one directory and
3366
02:06:32,560 --> 02:06:35,520
a couple of subdirectories under that
3367
02:06:33,920 --> 02:06:37,520
directory. Okay. So that's when you use
3368
02:06:35,520 --> 02:06:40,639
this. Uh alternatively you can also use
3369
02:06:37,520 --> 02:06:42,320
this hyphen parents. All right. And uh
3370
02:06:40,639 --> 02:06:44,079
if you want to create one parent
3371
02:06:42,320 --> 02:06:45,840
directory and multiple subdirectories
3372
02:06:44,079 --> 02:06:47,440
inside that directory then you can use
3373
02:06:45,840 --> 02:06:49,040
these flower brackets. Okay. Inside the
3374
02:06:47,440 --> 02:06:51,760
flower brackets you can have the
3375
02:06:49,040 --> 02:06:53,119
different folder names. Okay. So let me
3376
02:06:51,760 --> 02:06:56,800
just quickly go to the terminal and show
3377
02:06:53,119 --> 02:06:58,639
you that aspect. So make directory these
3378
02:06:56,800 --> 02:07:01,119
were there and now I'm going to give
3379
02:06:58,639 --> 02:07:03,599
minus p and when I execute this
3380
02:07:01,119 --> 02:07:08,079
everything would have been created. So
3381
02:07:03,599 --> 02:07:10,719
let me do a cd folder 2. Now do an ls
3382
02:07:08,079 --> 02:07:13,040
there's a folder three. Now let me do
3383
02:07:10,719 --> 02:07:14,560
this and enter and let me do an ls
3384
02:07:13,040 --> 02:07:17,040
again. There's a folder four. Of course
3385
02:07:14,560 --> 02:07:19,040
here there would be nothing. Right? So
3386
02:07:17,040 --> 02:07:20,320
let me uh enter this folder four and
3387
02:07:19,040 --> 02:07:21,840
here there would be nothing. Folder
3388
02:07:20,320 --> 02:07:24,560
four. So that's what I was talking
3389
02:07:21,840 --> 02:07:26,480
about. Okay. Uh let me also verify that
3390
02:07:24,560 --> 02:07:28,079
once from the terminal folder one we
3391
02:07:26,480 --> 02:07:29,520
created a folder two inside which
3392
02:07:28,079 --> 02:07:32,800
there's a folder three and there's a
3393
02:07:29,520 --> 02:07:35,119
folder four. Okay guys so this is what
3394
02:07:32,800 --> 02:07:38,960
we just created. So what I'm going to do
3395
02:07:35,119 --> 02:07:43,679
is uh I'm going to just go back to my
3396
02:07:38,960 --> 02:07:45,599
folder one here. Okay. In fact yeah okay
3397
02:07:43,679 --> 02:07:47,599
folder one should be good. Now I want to
3398
02:07:45,599 --> 02:07:49,119
show you executing the same command with
3399
02:07:47,599 --> 02:07:50,719
the flower bracket. Right. Right? I told
3400
02:07:49,119 --> 02:07:52,000
you that creating a flower bracket will
3401
02:07:50,719 --> 02:07:54,400
let you create multiple directories
3402
02:07:52,000 --> 02:07:57,360
inside that directory. So if I'm going
3403
02:07:54,400 --> 02:07:59,360
to say make directory
3404
02:07:57,360 --> 02:08:02,079
folder uh because it's inside folder
3405
02:07:59,360 --> 02:08:06,320
one, I can create one here. Folder two,
3406
02:08:02,079 --> 02:08:10,079
I can say comma folder 3,
3407
02:08:06,320 --> 02:08:12,480
folder 4. Okay. And if I close this
3408
02:08:10,079 --> 02:08:14,239
flower bracket, then these three sub
3409
02:08:12,480 --> 02:08:17,760
directories or folders would be created
3410
02:08:14,239 --> 02:08:20,400
inside my folder one. All right. So I've
3411
02:08:17,760 --> 02:08:23,840
given enter here. If I go back to my
3412
02:08:20,400 --> 02:08:25,920
GUI. So I go inside folder one. So
3413
02:08:23,840 --> 02:08:28,239
initially there was one folder two.
3414
02:08:25,920 --> 02:08:30,639
Okay. That was the folder two which I
3415
02:08:28,239 --> 02:08:32,960
created earlier. Okay. And now I created
3416
02:08:30,639 --> 02:08:35,040
folder two. All in small small F, small
3417
02:08:32,960 --> 02:08:36,400
F and small F here. So folder two,
3418
02:08:35,040 --> 02:08:39,360
folder three, folder four was created.
3419
02:08:36,400 --> 02:08:43,520
Now folder this one was created earlier.
3420
02:08:39,360 --> 02:08:45,440
Okay guys. So that's how uh you know you
3421
02:08:43,520 --> 02:08:48,239
make directories. In fact, you can even
3422
02:08:45,440 --> 02:08:50,719
append this with a parent. Say you're
3423
02:08:48,239 --> 02:08:53,679
supposeding you're now in folder uh one,
3424
02:08:50,719 --> 02:08:56,719
right? You can say make directory. You
3425
02:08:53,679 --> 02:08:58,639
can say f_sub_2 put a slash and then
3426
02:08:56,719 --> 02:09:00,480
inside this f2 folder, these
3427
02:08:58,639 --> 02:09:02,719
subdirectories will be created. Okay.
3428
02:09:00,480 --> 02:09:04,880
Now, if I give enter, I know what the
3429
02:09:02,719 --> 02:09:07,760
problem here is. Uh it says because f2
3430
02:09:04,880 --> 02:09:10,079
is not created right now. Correct. This
3431
02:09:07,760 --> 02:09:13,040
is the time when you got to use the uh
3432
02:09:10,079 --> 02:09:16,239
hyphen p command, parents command,
3433
02:09:13,040 --> 02:09:18,239
right? So which I showed you earlier. So
3434
02:09:16,239 --> 02:09:20,159
now that I've used the minus P. So the
3435
02:09:18,239 --> 02:09:22,159
parent is created and the uh children
3436
02:09:20,159 --> 02:09:24,480
are also created. So if I go back to
3437
02:09:22,159 --> 02:09:26,800
folder one, this was F2 is what I
3438
02:09:24,480 --> 02:09:28,719
created recently. All right. So inside
3439
02:09:26,800 --> 02:09:32,320
F2, there should be folder 2, folder 3,
3440
02:09:28,719 --> 02:09:34,800
folder 4. All right. So this is uh what
3441
02:09:32,320 --> 02:09:37,360
we can do with respect to make directory
3442
02:09:34,800 --> 02:09:40,560
commands. All right. So let me close
3443
02:09:37,360 --> 02:09:43,599
this and go back to my slides. Okay. And
3444
02:09:40,560 --> 02:09:46,639
uh go to the next topic. Okay. So uh
3445
02:09:43,599 --> 02:09:48,719
next up is the uh rmdir and the rm
3446
02:09:46,639 --> 02:09:50,480
commands. Okay. So this is the remove
3447
02:09:48,719 --> 02:09:51,760
and this stands for remove directory.
3448
02:09:50,480 --> 02:09:54,719
Now there's a subtle difference between
3449
02:09:51,760 --> 02:09:56,000
the two. Okay. Now uh when you say okay
3450
02:09:54,719 --> 02:09:57,440
the basic difference between the two is
3451
02:09:56,000 --> 02:09:58,960
that when you say remove directory it'll
3452
02:09:57,440 --> 02:10:01,040
only remove that particular directory.
3453
02:09:58,960 --> 02:10:02,800
But when you say remove it can also
3454
02:10:01,040 --> 02:10:04,480
remove the subdirectories or the child
3455
02:10:02,800 --> 02:10:05,920
directories inside that one. So let me
3456
02:10:04,480 --> 02:10:09,119
just go to my terminal and show you how
3457
02:10:05,920 --> 02:10:13,040
these are executed. Okay. I'm going to
3458
02:10:09,119 --> 02:10:17,199
go to my terminal. So currently I am in
3459
02:10:13,040 --> 02:10:22,320
my folder one right. So let's go to
3460
02:10:17,199 --> 02:10:26,320
folder two and then do an ls cd folder 3
3461
02:10:22,320 --> 02:10:27,840
ls cd folder
3462
02:10:26,320 --> 02:10:31,360
folder 4. Okay. Of course there's
3463
02:10:27,840 --> 02:10:35,520
nothing here. So what I can do is I'm in
3464
02:10:31,360 --> 02:10:37,679
folder three now. Okay. LS again. Yes
3465
02:10:35,520 --> 02:10:40,239
I'm in folder three. And I if I want to
3466
02:10:37,679 --> 02:10:42,239
remove this folder then I can do uh
3467
02:10:40,239 --> 02:10:45,040
remove directory
3468
02:10:42,239 --> 02:10:46,880
folder 4. All right. So when I do this
3469
02:10:45,040 --> 02:10:50,000
this particular folder would have been
3470
02:10:46,880 --> 02:10:51,599
deleted. Now from folder two I can uh
3471
02:10:50,000 --> 02:10:53,920
again remove folder three. Okay. Similar
3472
02:10:51,599 --> 02:10:56,560
to how I removed folder four. But how
3473
02:10:53,920 --> 02:11:00,239
about I go one more path back. Okay. So
3474
02:10:56,560 --> 02:11:02,159
right now I'm in ls. Okay. So if I do a
3475
02:11:00,239 --> 02:11:04,880
pwd you'll find that I'm in folder one.
3476
02:11:02,159 --> 02:11:07,679
Okay. And when I do an ls I have f2
3477
02:11:04,880 --> 02:11:09,920
folder 2. I have a capital folder two.
3478
02:11:07,679 --> 02:11:12,880
This is where my folder three and folder
3479
02:11:09,920 --> 02:11:14,880
four is present. Okay. So I have that
3480
02:11:12,880 --> 02:11:18,000
and then I have folder three and I have
3481
02:11:14,880 --> 02:11:20,560
four and four. Now however if I try
3482
02:11:18,000 --> 02:11:23,599
doing a remove directory and if I try to
3483
02:11:20,560 --> 02:11:26,320
remove folder two right it will not
3484
02:11:23,599 --> 02:11:28,159
work. It failed because the folder two
3485
02:11:26,320 --> 02:11:29,840
which we are trying to delete right from
3486
02:11:28,159 --> 02:11:31,920
inside folder one we are trying to
3487
02:11:29,840 --> 02:11:33,840
delete the folder two. This is that
3488
02:11:31,920 --> 02:11:35,760
folder two. And inside this folder two,
3489
02:11:33,840 --> 02:11:38,159
there's another folder that is folder
3490
02:11:35,760 --> 02:11:39,760
three. Let me just uh show it to you
3491
02:11:38,159 --> 02:11:43,760
once so that I can remove your
3492
02:11:39,760 --> 02:11:46,560
confusion. So inside this uh folder two,
3493
02:11:43,760 --> 02:11:48,960
I have folder three. Okay. And because
3494
02:11:46,560 --> 02:11:50,480
I'm trying to delete this uh folder two,
3495
02:11:48,960 --> 02:11:51,920
it's not able to delete because there is
3496
02:11:50,480 --> 02:11:54,719
already a folder three inside this
3497
02:11:51,920 --> 02:11:56,480
folder. That is a problem with remove
3498
02:11:54,719 --> 02:11:58,639
directory. So guys, I'll just clear the
3499
02:11:56,480 --> 02:12:00,400
screen and let me just do an ls again.
3500
02:11:58,639 --> 02:12:02,239
So now I'm going to show you how to
3501
02:12:00,400 --> 02:12:04,719
remove these folders. I showed you
3502
02:12:02,239 --> 02:12:06,719
removing folder four. Okay. So inside
3503
02:12:04,719 --> 02:12:08,800
this folder three, I went and I removed
3504
02:12:06,719 --> 02:12:10,880
folder four. Okay. Now I'm going to show
3505
02:12:08,800 --> 02:12:13,920
you how to remove multiple folders.
3506
02:12:10,880 --> 02:12:15,679
Okay. At the same time. Now let's say
3507
02:12:13,920 --> 02:12:18,239
I'm running the same remove directory
3508
02:12:15,679 --> 02:12:21,920
again. So I'm going to say remove folder
3509
02:12:18,239 --> 02:12:24,079
2. And u when I give enter, it says
3510
02:12:21,920 --> 02:12:26,880
failed to remove folder 2 because the
3511
02:12:24,079 --> 02:12:28,880
directory is not empty. Okay. Uh do you
3512
02:12:26,880 --> 02:12:30,159
know what the problem is? it's uh
3513
02:12:28,880 --> 02:12:32,159
telling right because the directory is
3514
02:12:30,159 --> 02:12:33,920
not empty it's not able to delete. So
3515
02:12:32,159 --> 02:12:35,520
because folder 3 is contained inside
3516
02:12:33,920 --> 02:12:37,440
folder two it's not able to delete this
3517
02:12:35,520 --> 02:12:39,920
folder. So if I want to delete folder
3518
02:12:37,440 --> 02:12:41,440
two also then what I got to do is you
3519
02:12:39,920 --> 02:12:43,360
know I got to first delete the folder
3520
02:12:41,440 --> 02:12:44,960
three and then delete the folder four.
3521
02:12:43,360 --> 02:12:47,520
So I have to provide the absolute path
3522
02:12:44,960 --> 02:12:50,159
of the child directory. Okay. So I'm
3523
02:12:47,520 --> 02:12:52,159
going to say remove directory. Okay.
3524
02:12:50,159 --> 02:12:55,920
Same like before I'm going to say folder
3525
02:12:52,159 --> 02:12:58,079
2/ folder 3. when I run this command
3526
02:12:55,920 --> 02:13:00,320
then my folder three will get deleted.
3527
02:12:58,079 --> 02:13:02,639
Okay, the child will get deleted but the
3528
02:13:00,320 --> 02:13:05,599
parent will still be uh active. Folder
3529
02:13:02,639 --> 02:13:08,480
two will be active. Okay, because uh
3530
02:13:05,599 --> 02:13:09,840
when I use the rmdir with folder two and
3531
02:13:08,480 --> 02:13:12,639
folder three only folder three will get
3532
02:13:09,840 --> 02:13:14,880
deleted. Let me show you why that's the
3533
02:13:12,639 --> 02:13:16,239
case. When I give enter when I do an ls
3534
02:13:14,880 --> 02:13:17,840
folder two should be available. See
3535
02:13:16,239 --> 02:13:21,679
folder two is available but when I do a
3536
02:13:17,840 --> 02:13:24,639
folder uh two there's nothing in here.
3537
02:13:21,679 --> 02:13:26,079
Okay, there's nothing in here. So if you
3538
02:13:24,639 --> 02:13:27,599
want to do that, if you want to delete
3539
02:13:26,079 --> 02:13:29,199
both the parent and the child at the
3540
02:13:27,599 --> 02:13:32,400
same time, you got to use a minus p
3541
02:13:29,199 --> 02:13:35,440
flag. So let me show you to use a minus
3542
02:13:32,400 --> 02:13:37,760
p flag. Okay. So I'm just going to make
3543
02:13:35,440 --> 02:13:39,360
the folder three now. And I'm going to
3544
02:13:37,760 --> 02:13:42,079
show you how to use a p flag. So similar
3545
02:13:39,360 --> 02:13:45,280
to how we use while creating a folder,
3546
02:13:42,079 --> 02:13:50,000
we got to use the same remove directory.
3547
02:13:45,280 --> 02:13:51,760
Okay. Rmdir with the uh hyphen p and
3548
02:13:50,000 --> 02:13:53,840
folder 2 and folder three. Folder 2/
3549
02:13:51,760 --> 02:13:55,760
folder 3. So in this case both the
3550
02:13:53,840 --> 02:13:58,639
folder two and the parent and the child
3551
02:13:55,760 --> 02:14:00,960
will get deleted. Okay. Enter. When I do
3552
02:13:58,639 --> 02:14:02,719
an ls I don't have a folder two here.
3553
02:14:00,960 --> 02:14:05,840
Okay. This one is also deleted. So
3554
02:14:02,719 --> 02:14:08,320
that's what a minus p flag does. Now let
3555
02:14:05,840 --> 02:14:10,400
me just create make a new directory. And
3556
02:14:08,320 --> 02:14:13,280
uh what I want to show you is the
3557
02:14:10,400 --> 02:14:15,599
verbos. Okay. So I'm going to make
3558
02:14:13,280 --> 02:14:17,360
directory. So again the the ones which I
3559
02:14:15,599 --> 02:14:19,360
deleted have come back again would have
3560
02:14:17,360 --> 02:14:21,760
been created again. So I want to show
3561
02:14:19,360 --> 02:14:24,960
you the usage of the verbos directory.
3562
02:14:21,760 --> 02:14:27,599
when I add a V here as for the slides it
3563
02:14:24,960 --> 02:14:30,560
said right verbose. So when I add a v
3564
02:14:27,599 --> 02:14:32,320
here and when I hit enter, okay, I've
3565
02:14:30,560 --> 02:14:34,239
done the make directory again. So I have
3566
02:14:32,320 --> 02:14:36,000
to actually remove the directory now.
3567
02:14:34,239 --> 02:14:38,719
Okay. Now when I say remove directory
3568
02:14:36,000 --> 02:14:40,400
and when I uh try to print the uh
3569
02:14:38,719 --> 02:14:42,800
verbosph
3570
02:14:40,400 --> 02:14:45,360
so it says first it's deleted the folder
3571
02:14:42,800 --> 02:14:47,280
3. Okay, which is inside folder two
3572
02:14:45,360 --> 02:14:49,280
after deleting that it has come and
3573
02:14:47,280 --> 02:14:51,040
deleted folder two. Okay, so that's what
3574
02:14:49,280 --> 02:14:52,400
this is all about. This is what uh you
3575
02:14:51,040 --> 02:14:54,960
know you need to know about the remove
3576
02:14:52,400 --> 02:14:56,400
directory commands. Now uh let me just
3577
02:14:54,960 --> 02:14:59,760
clear the screen.
3578
02:14:56,400 --> 02:15:02,880
So guys uh now let's uh see how the rm
3579
02:14:59,760 --> 02:15:05,119
command works. Okay. Now uh the rm
3580
02:15:02,880 --> 02:15:07,280
command here as it says from the slides
3581
02:15:05,119 --> 02:15:09,199
it can be used to remove even non- empty
3582
02:15:07,280 --> 02:15:12,320
directories. Okay. If we use the rm with
3583
02:15:09,199 --> 02:15:14,159
the r flag and if we use the r and p
3584
02:15:12,320 --> 02:15:16,560
flags together then it removes the
3585
02:15:14,159 --> 02:15:19,920
non-mpt directories including the parent
3586
02:15:16,560 --> 02:15:22,000
and the uh sub directories. Okay. So the
3587
02:15:19,920 --> 02:15:24,320
one limitation that we had with rmdir
3588
02:15:22,000 --> 02:15:25,920
command was that we could not remove uh
3589
02:15:24,320 --> 02:15:28,079
non-mp directories. we had to first
3590
02:15:25,920 --> 02:15:30,159
empty them and then only delete them.
3591
02:15:28,079 --> 02:15:32,480
Okay, otherwise we had to specify the
3592
02:15:30,159 --> 02:15:34,400
entire path and then uh you know use the
3593
02:15:32,480 --> 02:15:37,040
p flag to remove all the parents and all
3594
02:15:34,400 --> 02:15:38,880
the child subdirectories in that path.
3595
02:15:37,040 --> 02:15:40,880
Right? That was the limitation that we
3596
02:15:38,880 --> 02:15:43,119
had with remove directory. But in RM we
3597
02:15:40,880 --> 02:15:45,840
don't have that problem because uh let's
3598
02:15:43,119 --> 02:15:48,880
see okay in ls we have so many folders
3599
02:15:45,840 --> 02:15:50,400
okay so if I try going to f2 okay and I
3600
02:15:48,880 --> 02:15:51,599
do an ls here then I have three
3601
02:15:50,400 --> 02:15:53,920
different folders folder two folder
3602
02:15:51,599 --> 02:15:56,400
three folder four okay now if it's an
3603
02:15:53,920 --> 02:15:58,560
rmdir command it cannot technically
3604
02:15:56,400 --> 02:16:00,560
delete this folder called f_sub_2
3605
02:15:58,560 --> 02:16:02,159
f_sub_2 is basically a non-mpy directory
3606
02:16:00,560 --> 02:16:04,960
inside f_sub_2 there are other
3607
02:16:02,159 --> 02:16:06,719
directories like folder 2 3 and four so
3608
02:16:04,960 --> 02:16:08,800
let me just uh show to you once so
3609
02:16:06,719 --> 02:16:11,760
inside f_sub_2 we have three folders
3610
02:16:08,800 --> 02:16:14,400
folder 2 folder 3 and folder four. So
3611
02:16:11,760 --> 02:16:16,960
with the uh rd diir command we cannot
3612
02:16:14,400 --> 02:16:19,040
definitely remove but with f2 we have a
3613
02:16:16,960 --> 02:16:21,520
chance of removing it. Okay that's
3614
02:16:19,040 --> 02:16:24,320
because uh we can make use of the r flag
3615
02:16:21,520 --> 02:16:26,880
here. Okay but however this will also it
3616
02:16:24,320 --> 02:16:29,440
will delete f2 and its subfolders. Okay
3617
02:16:26,880 --> 02:16:31,760
so let me do an ls and uh if you can see
3618
02:16:29,440 --> 02:16:34,960
here initially under folder one we had
3619
02:16:31,760 --> 02:16:37,120
f_sub_2 and these three. Okay but now we
3620
02:16:34,960 --> 02:16:39,200
don't have that under f2 because that
3621
02:16:37,120 --> 02:16:41,760
whole f2 folder is missing. If I go back
3622
02:16:39,200 --> 02:16:44,240
to my folder one here, you'll see that
3623
02:16:41,760 --> 02:16:46,639
the F2 is uh missing over here too.
3624
02:16:44,240 --> 02:16:49,040
That's because on the remove, right, it
3625
02:16:46,639 --> 02:16:51,760
uh removed the whole F2 folder in spite
3626
02:16:49,040 --> 02:16:53,920
of it containing some folders. Okay, and
3627
02:16:51,760 --> 02:16:56,559
that's what the R flag does. That's the
3628
02:16:53,920 --> 02:16:58,800
advantage of using the R flag. Okay, so
3629
02:16:56,559 --> 02:17:01,599
if the same thing if we use the R flag
3630
02:16:58,800 --> 02:17:03,280
with the V flag, then it'll print the uh
3631
02:17:01,599 --> 02:17:04,800
status also. It's like the verbose,
3632
02:17:03,280 --> 02:17:06,479
right? It'll print it'll tell you what
3633
02:17:04,800 --> 02:17:08,719
all has been deleted and how it has been
3634
02:17:06,479 --> 02:17:12,479
deleted. So that's the advantage with
3635
02:17:08,719 --> 02:17:14,880
using RM over uh RMDR. Okay. At times
3636
02:17:12,479 --> 02:17:16,800
this is more beneficial. So I'm just
3637
02:17:14,880 --> 02:17:19,439
going to clear the screen and uh getting
3638
02:17:16,800 --> 02:17:22,000
back to my presentation. I'm done with
3639
02:17:19,439 --> 02:17:25,439
all the concepts in this slide. So let
3640
02:17:22,000 --> 02:17:27,439
me go on to the next topic. Okay. So the
3641
02:17:25,439 --> 02:17:29,920
next topic is going to be that of uh
3642
02:17:27,439 --> 02:17:31,359
working with user permissions. Okay.
3643
02:17:29,920 --> 02:17:33,439
It's very important for a Linux
3644
02:17:31,359 --> 02:17:35,760
administrator to know what these uh user
3645
02:17:33,439 --> 02:17:37,519
permissions are. Okay. because uh the
3646
02:17:35,760 --> 02:17:38,960
different files will be there, different
3647
02:17:37,519 --> 02:17:40,880
directories will be there and he has to
3648
02:17:38,960 --> 02:17:44,080
determine what kind of access will be
3649
02:17:40,880 --> 02:17:47,359
available for which user right so that's
3650
02:17:44,080 --> 02:17:49,519
what is control here so uh the different
3651
02:17:47,359 --> 02:17:52,399
permissions are basically read write and
3652
02:17:49,519 --> 02:17:57,280
execute okay R stands for read W stands
3653
02:17:52,399 --> 02:17:59,760
for write and uh execute is X okay so uh
3654
02:17:57,280 --> 02:18:01,439
initially you'll get this kind of an
3655
02:17:59,760 --> 02:18:02,719
output okay you know what let me go to
3656
02:18:01,439 --> 02:18:04,960
my terminal and show you what happens
3657
02:18:02,719 --> 02:18:06,559
when you run an ls ns ls minus L command
3658
02:18:04,960 --> 02:18:08,080
because user permissions is something
3659
02:18:06,559 --> 02:18:11,599
which will appear and which you can
3660
02:18:08,080 --> 02:18:13,120
control via the ls-l command right
3661
02:18:11,599 --> 02:18:14,719
because when you do that all the
3662
02:18:13,120 --> 02:18:16,880
different file contents whether it's a
3663
02:18:14,719 --> 02:18:18,719
directory or whether it's another file
3664
02:18:16,880 --> 02:18:20,319
all those things along with their uh
3665
02:18:18,719 --> 02:18:22,880
permissions will be visible in long
3666
02:18:20,319 --> 02:18:26,800
format right so let me go to my terminal
3667
02:18:22,880 --> 02:18:29,200
first and uh go to cd all right now when
3668
02:18:26,800 --> 02:18:31,280
I do an ls I have a list of all these uh
3669
02:18:29,200 --> 02:18:32,800
documents okay but however when I do an
3670
02:18:31,280 --> 02:18:36,000
ls-l
3671
02:18:32,800 --> 02:18:37,920
I get it in long form for okay so I get
3672
02:18:36,000 --> 02:18:40,000
it something like this so for each
3673
02:18:37,920 --> 02:18:42,800
folder I have the permission set so for
3674
02:18:40,000 --> 02:18:44,559
desktop I have the permission sets and
3675
02:18:42,800 --> 02:18:46,399
then I have the other components okay
3676
02:18:44,559 --> 02:18:48,800
I'm going to explain what this entire
3677
02:18:46,399 --> 02:18:50,559
component what the entire row means so
3678
02:18:48,800 --> 02:18:52,639
to not let you get too complicated first
3679
02:18:50,559 --> 02:18:56,319
I'm going to explain only this part okay
3680
02:18:52,639 --> 02:18:58,399
the first 10 characters if you see here
3681
02:18:56,319 --> 02:19:00,160
the first 10 characters are these and I
3682
02:18:58,399 --> 02:19:02,479
will explain this part first and then
3683
02:19:00,160 --> 02:19:03,679
I'll explain this set these three blocks
3684
02:19:02,479 --> 02:19:06,240
and then I'll explain the remaining
3685
02:19:03,679 --> 02:19:09,200
blocks blocks. Okay, so getting back to
3686
02:19:06,240 --> 02:19:11,040
this uh first block in my slides, you
3687
02:19:09,200 --> 02:19:13,040
can see that the first block it
3688
02:19:11,040 --> 02:19:14,960
determines what is the file type. Okay,
3689
02:19:13,040 --> 02:19:17,760
it's either the file or directory type.
3690
02:19:14,960 --> 02:19:19,519
In fact, if that is a directory, then it
3691
02:19:17,760 --> 02:19:21,359
would be represented by D. Okay, if you
3692
02:19:19,519 --> 02:19:23,439
have a D as the first character over
3693
02:19:21,359 --> 02:19:25,280
here, then that's a directory. Okay, as
3694
02:19:23,439 --> 02:19:26,800
it says, but it can also be any other
3695
02:19:25,280 --> 02:19:29,040
thing. If it's a hyphen like this, then
3696
02:19:26,800 --> 02:19:31,519
it means that it's a normal file. Okay,
3697
02:19:29,040 --> 02:19:32,559
buth in the first letter, if it's a C,
3698
02:19:31,519 --> 02:19:35,200
then it means that it's a character
3699
02:19:32,559 --> 02:19:36,960
special file. And uh if there is B over
3700
02:19:35,200 --> 02:19:39,120
here in this part of the first letter
3701
02:19:36,960 --> 02:19:40,800
then it's a binary special file. So
3702
02:19:39,120 --> 02:19:42,240
basically there can be four different
3703
02:19:40,800 --> 02:19:45,439
letters over here. It can be either a
3704
02:19:42,240 --> 02:19:48,160
hyphen or D, B or C representing four
3705
02:19:45,439 --> 02:19:49,680
different aspects. Okay. So uh that is
3706
02:19:48,160 --> 02:19:52,000
the first information that you have
3707
02:19:49,680 --> 02:19:54,399
about that particular file. And then you
3708
02:19:52,000 --> 02:19:56,080
have three different blocks. Okay. So
3709
02:19:54,399 --> 02:19:58,319
the next nine letters are going to
3710
02:19:56,080 --> 02:20:00,080
determine the user permissions. Okay.
3711
02:19:58,319 --> 02:20:02,000
And those nine are divided into three
3712
02:20:00,080 --> 02:20:04,000
three. Okay. So the first three
3713
02:20:02,000 --> 02:20:07,040
represent the user permissions. Okay.
3714
02:20:04,000 --> 02:20:08,960
The second block having three uh RWX
3715
02:20:07,040 --> 02:20:10,640
representatives are those of group
3716
02:20:08,960 --> 02:20:12,960
permissions and the final block
3717
02:20:10,640 --> 02:20:15,600
represents other permissions. Okay, this
3718
02:20:12,960 --> 02:20:17,040
means other users. Now this user is the
3719
02:20:15,600 --> 02:20:18,880
actual user who is logged into the
3720
02:20:17,040 --> 02:20:20,240
system. Okay, that particular user. So
3721
02:20:18,880 --> 02:20:21,920
this is the user permissions. This is
3722
02:20:20,240 --> 02:20:24,160
the group permissions which the user
3723
02:20:21,920 --> 02:20:26,479
belong to and what the other group can
3724
02:20:24,160 --> 02:20:28,800
view. And this is with respect to the
3725
02:20:26,479 --> 02:20:32,319
other users. Okay, that's what is meant
3726
02:20:28,800 --> 02:20:35,680
by this others. So if we have uh and the
3727
02:20:32,319 --> 02:20:38,800
order always goes by RWX and RWX and
3728
02:20:35,680 --> 02:20:40,479
here also it'll be RW and X. Okay. So
3729
02:20:38,800 --> 02:20:42,640
that is the order read, write and
3730
02:20:40,479 --> 02:20:45,840
execute. So if the first three blocks
3731
02:20:42,640 --> 02:20:47,680
are all R, W and X then it means that
3732
02:20:45,840 --> 02:20:50,240
the user has all the three permissions
3733
02:20:47,680 --> 02:20:52,560
or the owner of the file or the user has
3734
02:20:50,240 --> 02:20:55,520
uh the read, write and the execute
3735
02:20:52,560 --> 02:20:57,840
permissions. Okay. And in this place if
3736
02:20:55,520 --> 02:20:59,600
there are three characters right, W and
3737
02:20:57,840 --> 02:21:01,840
X in this order it means that the owner
3738
02:20:59,600 --> 02:21:04,000
or the user has the permissions to read,
3739
02:21:01,840 --> 02:21:06,720
write and execute that particular file.
3740
02:21:04,000 --> 02:21:10,080
Okay. And if there is R, W and X in the
3741
02:21:06,720 --> 02:21:12,080
next block, then it means that the group
3742
02:21:10,080 --> 02:21:14,479
has the read, write and execute
3743
02:21:12,080 --> 02:21:16,319
permissions on that particular file. So
3744
02:21:14,479 --> 02:21:17,920
every file that's created, right, it
3745
02:21:16,319 --> 02:21:20,080
will have a user and it will also have a
3746
02:21:17,920 --> 02:21:22,960
default group that it will be assigned
3747
02:21:20,080 --> 02:21:24,800
to. So all the users a part of uh that
3748
02:21:22,960 --> 02:21:26,720
group will have the read, write and
3749
02:21:24,800 --> 02:21:28,399
execute permissions. Okay. But whereas
3750
02:21:26,720 --> 02:21:30,160
the last three here it stands for other
3751
02:21:28,399 --> 02:21:31,760
users permission. So there can be
3752
02:21:30,160 --> 02:21:33,920
multiple users, right? The same system
3753
02:21:31,760 --> 02:21:35,520
can have multiple users. One of course
3754
02:21:33,920 --> 02:21:38,399
will be the root user. The other will be
3755
02:21:35,520 --> 02:21:40,000
the owner or you and besides you there
3756
02:21:38,399 --> 02:21:42,080
can be any number of users. It can be
3757
02:21:40,000 --> 02:21:43,760
your friends, your colleagues or uh you
3758
02:21:42,080 --> 02:21:46,560
know other people. So this others
3759
02:21:43,760 --> 02:21:48,640
represents that. And uh if you have a
3760
02:21:46,560 --> 02:21:50,800
blank in any place okay so in this case
3761
02:21:48,640 --> 02:21:52,479
there's a blank over here in place of w
3762
02:21:50,800 --> 02:21:54,240
there's a blank it means that this
3763
02:21:52,479 --> 02:21:55,760
others they don't have the right access
3764
02:21:54,240 --> 02:21:59,040
they only have the read access and the
3765
02:21:55,760 --> 02:22:02,240
execute access all right and similarly
3766
02:21:59,040 --> 02:22:05,040
if you go back to the terminal okay and
3767
02:22:02,240 --> 02:22:07,120
if you see here take the example of this
3768
02:22:05,040 --> 02:22:09,520
particular file desktop okay desktop
3769
02:22:07,120 --> 02:22:12,319
folder is where we were executing a lot
3770
02:22:09,520 --> 02:22:14,160
of commands right it is under the folder
3771
02:22:12,319 --> 02:22:16,479
so yeah this was the folder that we are
3772
02:22:14,160 --> 02:22:18,880
talking code the desktop right now it's
3773
02:22:16,479 --> 02:22:21,040
a directory basically okay that you all
3774
02:22:18,880 --> 02:22:23,439
agree with then these three characters
3775
02:22:21,040 --> 02:22:26,160
represent that the person who's using it
3776
02:22:23,439 --> 02:22:27,840
okay right now the person who's using it
3777
02:22:26,160 --> 02:22:30,399
uh because I'm logged in right now and
3778
02:22:27,840 --> 02:22:33,359
I've logged in with this username right
3779
02:22:30,399 --> 02:22:36,319
sorry for that guys yeah and I've logged
3780
02:22:33,359 --> 02:22:38,160
in with this username right Eda so uh me
3781
02:22:36,319 --> 02:22:40,880
being the owner and me being the user I
3782
02:22:38,160 --> 02:22:43,359
have the read write and execute
3783
02:22:40,880 --> 02:22:46,240
permissions okay but the group that I
3784
02:22:43,359 --> 02:22:48,479
belong through. Okay, that group does
3785
02:22:46,240 --> 02:22:52,240
not have the read, write and execute
3786
02:22:48,479 --> 02:22:54,720
permissions and the group that uh this
3787
02:22:52,240 --> 02:22:57,600
file belongs to. Now, because uh this
3788
02:22:54,720 --> 02:22:59,359
file is either owned or used by me,
3789
02:22:57,600 --> 02:23:01,200
okay, now because I'm the user, I have
3790
02:22:59,359 --> 02:23:02,560
this access and then this file will also
3791
02:23:01,200 --> 02:23:04,399
belong to a group, right? So, whenever
3792
02:23:02,560 --> 02:23:06,000
you create this file, it'll be assigned
3793
02:23:04,399 --> 02:23:07,680
to that particular user creating it and
3794
02:23:06,000 --> 02:23:09,600
it'll be assigned to a default group.
3795
02:23:07,680 --> 02:23:11,359
So, we're talking about that group here.
3796
02:23:09,600 --> 02:23:12,960
Okay? And that particular group does not
3797
02:23:11,359 --> 02:23:14,399
have all three rights. It has only the
3798
02:23:12,960 --> 02:23:15,600
read permission and the execute
3799
02:23:14,399 --> 02:23:17,520
permission. It doesn't have the right
3800
02:23:15,600 --> 02:23:19,600
permission. Okay. And the same thing can
3801
02:23:17,520 --> 02:23:21,200
be said for uh even the other users. So
3802
02:23:19,600 --> 02:23:23,359
the other users in that system who'll be
3803
02:23:21,200 --> 02:23:25,600
using that system, they'll only have the
3804
02:23:23,359 --> 02:23:28,160
read and execute access on the uh
3805
02:23:25,600 --> 02:23:30,800
desktop. Okay. But whereas if you take
3806
02:23:28,160 --> 02:23:32,720
the example of this file one.txt, right,
3807
02:23:30,800 --> 02:23:34,560
which I created sometime back uh during
3808
02:23:32,720 --> 02:23:36,399
this session, this one if you see the
3809
02:23:34,560 --> 02:23:38,800
permissions are such that the first one
3810
02:23:36,399 --> 02:23:40,960
is a hyphen. Okay, what hyphen
3811
02:23:38,800 --> 02:23:43,280
technically means is it's a normal file.
3812
02:23:40,960 --> 02:23:45,120
Okay, I explained that hyphen is normal.
3813
02:23:43,280 --> 02:23:47,120
B stands for binary special file and C
3814
02:23:45,120 --> 02:23:48,960
stands for character special file. So of
3815
02:23:47,120 --> 02:23:51,040
course we don't have uh those options
3816
02:23:48,960 --> 02:23:52,880
here. We don't have the B and C options.
3817
02:23:51,040 --> 02:23:55,280
But what you got to understand is uh is
3818
02:23:52,880 --> 02:23:57,120
that this is a normal file and this is a
3819
02:23:55,280 --> 02:23:59,280
directory. Okay, wherever there is D. So
3820
02:23:57,120 --> 02:24:01,359
since this is a file and the access for
3821
02:23:59,280 --> 02:24:03,600
the user is such that I have the read
3822
02:24:01,359 --> 02:24:05,439
and write access. Okay, but I can't
3823
02:24:03,600 --> 02:24:07,280
execute it. The user can't execute it.
3824
02:24:05,439 --> 02:24:09,439
And when it comes to the group, even the
3825
02:24:07,280 --> 02:24:11,520
group has the read and write access, but
3826
02:24:09,439 --> 02:24:13,280
it cannot execute it. The other users,
3827
02:24:11,520 --> 02:24:14,960
however, they have only the read access
3828
02:24:13,280 --> 02:24:17,520
and they cannot execute this particular
3829
02:24:14,960 --> 02:24:19,840
file, right? So they cannot execute or
3830
02:24:17,520 --> 02:24:22,080
they cannot write this particular file.
3831
02:24:19,840 --> 02:24:24,240
So that's what these group permissions
3832
02:24:22,080 --> 02:24:25,840
mean. And if you go forward from group
3833
02:24:24,240 --> 02:24:27,439
permissions, there are more other
3834
02:24:25,840 --> 02:24:29,439
blocks, right? So let's go back to the
3835
02:24:27,439 --> 02:24:30,880
slides and see what they stand for. So
3836
02:24:29,439 --> 02:24:33,200
in this slide, let's talk about the next
3837
02:24:30,880 --> 02:24:34,720
three blocks. Okay, so the next block is
3838
02:24:33,200 --> 02:24:36,479
that of a number. Okay, you have a
3839
02:24:34,720 --> 02:24:38,560
number over here and that represents the
3840
02:24:36,479 --> 02:24:41,040
symbolic links. All right, the block
3841
02:24:38,560 --> 02:24:43,280
after that is the one that represents
3842
02:24:41,040 --> 02:24:45,760
the owner name and the one followed by
3843
02:24:43,280 --> 02:24:47,280
that represents the group name. Okay, so
3844
02:24:45,760 --> 02:24:49,840
that is with respect to these three
3845
02:24:47,280 --> 02:24:51,520
blocks. All right, and then after that
3846
02:24:49,840 --> 02:24:53,359
comes the file size of the particular
3847
02:24:51,520 --> 02:24:55,680
file and then you have the time stamp,
3848
02:24:53,359 --> 02:24:57,520
the time when the file was created, the
3849
02:24:55,680 --> 02:24:59,920
file or the folder was created. This is
3850
02:24:57,520 --> 02:25:01,520
the actual file size of the block. Okay,
3851
02:24:59,920 --> 02:25:03,760
now that's what the user permissions
3852
02:25:01,520 --> 02:25:06,240
here represent. So if I quickly go back
3853
02:25:03,760 --> 02:25:08,240
to the uh terminal and show you this is
3854
02:25:06,240 --> 02:25:10,640
basically the symbolic link. This is the
3855
02:25:08,240 --> 02:25:12,960
uh owner name. This is the group name of
3856
02:25:10,640 --> 02:25:15,040
the file. This is the uh block size.
3857
02:25:12,960 --> 02:25:17,680
Okay. And this is all in kilobytes.
3858
02:25:15,040 --> 02:25:19,600
Okay. And uh this is the time stamp and
3859
02:25:17,680 --> 02:25:21,280
this is of course the name of the file.
3860
02:25:19,600 --> 02:25:23,359
Right? So we have the name of the file
3861
02:25:21,280 --> 02:25:24,960
and that file will have first be the
3862
02:25:23,359 --> 02:25:26,960
file type then user permissions then
3863
02:25:24,960 --> 02:25:29,439
symbolic links then the owner name then
3864
02:25:26,960 --> 02:25:31,680
group name then the file size then comes
3865
02:25:29,439 --> 02:25:33,600
the time stamp at the end. So that's
3866
02:25:31,680 --> 02:25:35,840
what the different file permissions are.
3867
02:25:33,600 --> 02:25:37,920
The read, write, and execute. And if you
3868
02:25:35,840 --> 02:25:39,840
want to modify any of these file
3869
02:25:37,920 --> 02:25:41,600
permissions, then it's also possible.
3870
02:25:39,840 --> 02:25:43,120
Okay. Now, let me go to my slides and
3871
02:25:41,600 --> 02:25:45,439
show you how that's possible. Let me
3872
02:25:43,120 --> 02:25:46,960
show you some theory first. Okay. So,
3873
02:25:45,439 --> 02:25:49,359
first of all, if you want to change the
3874
02:25:46,960 --> 02:25:51,600
permissions, then you can use the chod
3875
02:25:49,359 --> 02:25:53,520
command. Okay. You can use the chod
3876
02:25:51,600 --> 02:25:54,720
command as shown over here. And uh you
3877
02:25:53,520 --> 02:25:56,560
can use it to change the access
3878
02:25:54,720 --> 02:25:58,319
permission of both the files and the
3879
02:25:56,560 --> 02:26:00,479
directories. If you want to change the
3880
02:25:58,319 --> 02:26:02,080
owner of the particular file, okay,
3881
02:26:00,479 --> 02:26:03,760
change the owner of that particular file
3882
02:26:02,080 --> 02:26:05,200
or directory, then you can use the ch
3883
02:26:03,760 --> 02:26:06,960
own command. And then if you want to
3884
02:26:05,200 --> 02:26:10,240
change the group ownership of that file,
3885
02:26:06,960 --> 02:26:12,240
then you can use a chb. Okay, so when
3886
02:26:10,240 --> 02:26:13,680
you use the chod command, you got to
3887
02:26:12,240 --> 02:26:15,359
specify whom are you referring to? Are
3888
02:26:13,680 --> 02:26:16,800
you referring to the uh the user, are
3889
02:26:15,359 --> 02:26:18,319
you referring to the group or are you
3890
02:26:16,800 --> 02:26:20,560
referring to the other people? Okay, the
3891
02:26:18,319 --> 02:26:22,080
other users, you got to say that and
3892
02:26:20,560 --> 02:26:24,080
then you got to use either a plus symbol
3893
02:26:22,080 --> 02:26:25,760
or a minus symbol. Okay, when you use
3894
02:26:24,080 --> 02:26:27,920
plus, it means that you're adding these
3895
02:26:25,760 --> 02:26:30,319
two rights. Uh so in this case when
3896
02:26:27,920 --> 02:26:32,800
you're saying G plus WX so G stands for
3897
02:26:30,319 --> 02:26:35,040
group right so as you can see from uh
3898
02:26:32,800 --> 02:26:38,160
this particular slide G stands for group
3899
02:26:35,040 --> 02:26:40,960
U stands for users and others stands for
3900
02:26:38,160 --> 02:26:43,760
O okay and all stands for A okay so as
3901
02:26:40,960 --> 02:26:45,760
for this if you're using G over here
3902
02:26:43,760 --> 02:26:48,399
then it means that you're talking about
3903
02:26:45,760 --> 02:26:51,200
the group and you're adding the W that
3904
02:26:48,399 --> 02:26:53,439
is a write and the execute permissions
3905
02:26:51,200 --> 02:26:54,880
that means you're giving them the W and
3906
02:26:53,439 --> 02:26:56,479
the right and the execute permissions
3907
02:26:54,880 --> 02:26:58,800
okay and after you got to specify file
3908
02:26:56,479 --> 02:27:00,560
name. So this means it will modify the
3909
02:26:58,800 --> 02:27:02,720
permissions to this for this particular
3910
02:27:00,560 --> 02:27:04,960
file and similarly you can use the equal
3911
02:27:02,720 --> 02:27:06,880
to symbol and also the minus symbol. So
3912
02:27:04,960 --> 02:27:08,720
when you use the equal to symbol then
3913
02:27:06,880 --> 02:27:10,240
whatever rights you have initially that
3914
02:27:08,720 --> 02:27:13,760
will be overwritten. So when you say
3915
02:27:10,240 --> 02:27:15,520
chod u is equal to rwx and then uh it
3916
02:27:13,760 --> 02:27:17,600
doesn't matter what the previous set of
3917
02:27:15,520 --> 02:27:19,040
permissions were then the the previous
3918
02:27:17,600 --> 02:27:21,200
set of permissions will be replaced by
3919
02:27:19,040 --> 02:27:22,880
whatever you specify here. So you'll be
3920
02:27:21,200 --> 02:27:24,880
setting that particular user to have the
3921
02:27:22,880 --> 02:27:28,080
read write and execute access for that
3922
02:27:24,880 --> 02:27:30,640
file. Okay. And then um you can in fact
3923
02:27:28,080 --> 02:27:32,479
specify uh you know uh you can set
3924
02:27:30,640 --> 02:27:34,880
access control for multiple people. You
3925
02:27:32,479 --> 02:27:36,399
can set it for uh groups users all at
3926
02:27:34,880 --> 02:27:38,960
the same time. So in this place this
3927
02:27:36,399 --> 02:27:40,399
command we've set it for the users. Here
3928
02:27:38,960 --> 02:27:42,319
we are setting it read, write and
3929
02:27:40,399 --> 02:27:44,319
execute for users. And then after that
3930
02:27:42,319 --> 02:27:46,080
we are setting it for the other people.
3931
02:27:44,319 --> 02:27:47,760
Okay, for the other users we are
3932
02:27:46,080 --> 02:27:50,240
removing the write and the execute
3933
02:27:47,760 --> 02:27:52,560
access. Okay, the execute permissions.
3934
02:27:50,240 --> 02:27:55,920
So let me just quickly go to my uh
3935
02:27:52,560 --> 02:27:57,840
terminal and show you that. So currently
3936
02:27:55,920 --> 02:28:00,160
uh let's take the example of this
3937
02:27:57,840 --> 02:28:02,319
pictures okay let's take an example of
3938
02:28:00,160 --> 02:28:04,479
this particular folder the user that is
3939
02:28:02,319 --> 02:28:07,439
me I have the read write and execute
3940
02:28:04,479 --> 02:28:10,720
permissions the group has read and
3941
02:28:07,439 --> 02:28:12,720
execute only okay and uh they of course
3942
02:28:10,720 --> 02:28:14,399
the other users they also have only the
3943
02:28:12,720 --> 02:28:17,120
read and execute now what I'm going to
3944
02:28:14,399 --> 02:28:19,359
do is I'm going to say chmod uh I don't
3945
02:28:17,120 --> 02:28:21,600
want to change my permissions okay so I
3946
02:28:19,359 --> 02:28:24,640
would rather uh change the permissions
3947
02:28:21,600 --> 02:28:27,920
that my group has so I would say G is
3948
02:28:24,640 --> 02:28:31,040
equal to read and W. Okay. So if you see
3949
02:28:27,920 --> 02:28:33,439
here right now the group has read and
3950
02:28:31,040 --> 02:28:34,880
execute. Okay. I don't want to give them
3951
02:28:33,439 --> 02:28:37,520
execute. So if I want to remove execute
3952
02:28:34,880 --> 02:28:41,520
I have to do G minus R and then I have
3953
02:28:37,520 --> 02:28:43,120
to give comma G + W. Okay. But uh those
3954
02:28:41,520 --> 02:28:44,720
are two different arguments right? So
3955
02:28:43,120 --> 02:28:46,240
instead of using two different arguments
3956
02:28:44,720 --> 02:28:48,720
I can just give an equal to which would
3957
02:28:46,240 --> 02:28:50,479
replace this entire list with the uh
3958
02:28:48,720 --> 02:28:52,800
current arguments. So instead of having
3959
02:28:50,479 --> 02:28:54,880
R and X I will replace that with R and
3960
02:28:52,800 --> 02:28:57,120
W. read and write. Okay, I'll give a
3961
02:28:54,880 --> 02:28:58,399
command and then we have others here.
3962
02:28:57,120 --> 02:29:00,640
The other users they have read and
3963
02:28:58,399 --> 02:29:04,080
execute again. So what I'll do is I'll
3964
02:29:00,640 --> 02:29:05,840
uh say O minus execute because I want to
3965
02:29:04,080 --> 02:29:07,760
give others only the read access. Okay,
3966
02:29:05,840 --> 02:29:10,479
so in this case when I do this the X
3967
02:29:07,760 --> 02:29:12,800
over here that will become hyphen and
3968
02:29:10,479 --> 02:29:15,280
the hyphen here will become W. Okay,
3969
02:29:12,800 --> 02:29:16,720
I'll be enabling the W for them and
3970
02:29:15,280 --> 02:29:18,399
removing the execute and for these
3971
02:29:16,720 --> 02:29:20,080
people I'll be removing the execute. And
3972
02:29:18,399 --> 02:29:22,479
now that I've specified what are the
3973
02:29:20,080 --> 02:29:24,240
permissions and who are the recipients,
3974
02:29:22,479 --> 02:29:26,880
I'm going to give the file name. So
3975
02:29:24,240 --> 02:29:29,439
let's say pictures. Okay. So I'm going
3976
02:29:26,880 --> 02:29:31,520
to give the ls minusl command again. And
3977
02:29:29,439 --> 02:29:33,840
now you can see that if you go to
3978
02:29:31,520 --> 02:29:35,520
pictures, it's been reset. So the others
3979
02:29:33,840 --> 02:29:39,040
have only the read access. The others
3980
02:29:35,520 --> 02:29:40,800
are blank. Okay. And the uh group have
3981
02:29:39,040 --> 02:29:42,640
the read and write access and this
3982
02:29:40,800 --> 02:29:44,720
execute has been taken away from them.
3983
02:29:42,640 --> 02:29:47,200
So that is with respect to the read,
3984
02:29:44,720 --> 02:29:49,439
write and execute permissions that users
3985
02:29:47,200 --> 02:29:51,040
can have. All right. So I'm just going
3986
02:29:49,439 --> 02:29:53,120
to clear the screen and go back to my
3987
02:29:51,040 --> 02:29:56,240
slides. So similarly you can change even
3988
02:29:53,120 --> 02:29:59,439
the ownership of certain files and uh
3989
02:29:56,240 --> 02:30:02,880
certain groups. Okay. So u if you use a
3990
02:29:59,439 --> 02:30:05,120
ch own, okay, ch ownership with that's
3991
02:30:02,880 --> 02:30:06,880
what it stands for. And when I follow
3992
02:30:05,120 --> 02:30:09,280
that with the username and the file
3993
02:30:06,880 --> 02:30:11,439
name, then this particular file will
3994
02:30:09,280 --> 02:30:13,920
have a new user or will have a new
3995
02:30:11,439 --> 02:30:15,760
owner. And uh this will be the username.
3996
02:30:13,920 --> 02:30:17,760
Okay. And similarly even the group
3997
02:30:15,760 --> 02:30:19,680
command works in the same fashion. So uh
3998
02:30:17,760 --> 02:30:21,600
this is something that you can always uh
3999
02:30:19,680 --> 02:30:24,080
work on and you can figure it out. All
4000
02:30:21,600 --> 02:30:25,840
right guys. So working with Linux
4001
02:30:24,080 --> 02:30:27,680
repositories.
4002
02:30:25,840 --> 02:30:29,359
Okay. And it says that stable versions
4003
02:30:27,680 --> 02:30:30,880
of most softwares will already be
4004
02:30:29,359 --> 02:30:33,520
available in Linux repositories. And the
4005
02:30:30,880 --> 02:30:35,280
command to install them is this. So you
4006
02:30:33,520 --> 02:30:37,040
would have heard me say earlier that
4007
02:30:35,280 --> 02:30:38,880
it's very easy to update software and
4008
02:30:37,040 --> 02:30:41,120
the operating system itself by just
4009
02:30:38,880 --> 02:30:43,920
running one simple command, right? you
4010
02:30:41,120 --> 02:30:45,840
can update the software. So, uh this is
4011
02:30:43,920 --> 02:30:47,760
what I'm talking about. So, you can just
4012
02:30:45,840 --> 02:30:49,359
run one command. So, this is the only
4013
02:30:47,760 --> 02:30:52,319
command that you need to run. Okay? If
4014
02:30:49,359 --> 02:30:54,080
you just give sudo yum install and if
4015
02:30:52,319 --> 02:30:56,080
you give the package name, then that
4016
02:30:54,080 --> 02:30:57,840
particular package will get updated.
4017
02:30:56,080 --> 02:30:59,280
Okay? The pseudo is something that you
4018
02:30:57,840 --> 02:31:01,600
would recognize from what I told you
4019
02:30:59,280 --> 02:31:04,399
earlier. The pseudo is to uh we give it
4020
02:31:01,600 --> 02:31:07,040
to to execute this uh command as a root
4021
02:31:04,399 --> 02:31:08,640
user. Okay? And uh if you see that there
4022
02:31:07,040 --> 02:31:10,399
are two other lines and the only
4023
02:31:08,640 --> 02:31:11,920
difference between these three lines is
4024
02:31:10,399 --> 02:31:14,319
the letter that the word we are using
4025
02:31:11,920 --> 02:31:16,960
here. Okay. So in the first case in case
4026
02:31:14,319 --> 02:31:19,040
of any Red Hat enterprise Linux system
4027
02:31:16,960 --> 02:31:22,640
or uh even CentOS right which falls
4028
02:31:19,040 --> 02:31:25,359
under Red Hat we use Yum. Okay. But if
4029
02:31:22,640 --> 02:31:28,080
it's a Debian based system like Ubuntu
4030
02:31:25,359 --> 02:31:30,080
or Eduntu X Ubuntu or any any other
4031
02:31:28,080 --> 02:31:34,080
Debian Linux system then you would have
4032
02:31:30,080 --> 02:31:35,439
to use apt get. Okay. And then if you're
4033
02:31:34,080 --> 02:31:37,760
using a federal based system then you
4034
02:31:35,439 --> 02:31:39,840
got to use the dnf. Okay. So these are
4035
02:31:37,760 --> 02:31:42,080
the three different commands and these
4036
02:31:39,840 --> 02:31:44,160
are the that's because the repository
4037
02:31:42,080 --> 02:31:46,399
name for real it's called as yum
4038
02:31:44,160 --> 02:31:48,560
repository and the repository name for
4039
02:31:46,399 --> 02:31:50,479
debian is called as the apt repository.
4040
02:31:48,560 --> 02:31:53,520
Okay. And for fedora it's called dnf
4041
02:31:50,479 --> 02:31:55,200
repository. So that's why we say we are
4042
02:31:53,520 --> 02:31:58,080
first we will have to first give the
4043
02:31:55,200 --> 02:32:00,080
sudo uh sudo command which would make
4044
02:31:58,080 --> 02:32:02,160
sure that we execute this command as a
4045
02:32:00,080 --> 02:32:03,760
root user. And from the command
4046
02:32:02,160 --> 02:32:06,399
perspective, the first part would be
4047
02:32:03,760 --> 02:32:08,640
calling or referring to the repository.
4048
02:32:06,399 --> 02:32:10,479
Okay. So from the CentOS, it would refer
4049
02:32:08,640 --> 02:32:12,560
to the yum repository or from the Ubuntu
4050
02:32:10,479 --> 02:32:15,520
if it is. If I give appget, it would
4051
02:32:12,560 --> 02:32:16,960
refer to the apt repository. And then we
4052
02:32:15,520 --> 02:32:18,479
have something called as install. And
4053
02:32:16,960 --> 02:32:20,399
when we say install and then follow that
4054
02:32:18,479 --> 02:32:22,319
by package name, then that particular
4055
02:32:20,399 --> 02:32:24,479
package will get installed. So for
4056
02:32:22,319 --> 02:32:26,000
example over here it is Java, right? I'm
4057
02:32:24,479 --> 02:32:28,000
trying to show how to install Java on
4058
02:32:26,000 --> 02:32:30,560
your system. So in this case if you
4059
02:32:28,000 --> 02:32:32,720
first give yum update then it will uh
4060
02:32:30,560 --> 02:32:34,880
first of all update your links to your
4061
02:32:32,720 --> 02:32:37,600
repositories okay it would update the
4062
02:32:34,880 --> 02:32:39,359
yum command and the links that you have
4063
02:32:37,600 --> 02:32:40,960
between the repository and yourself so
4064
02:32:39,359 --> 02:32:42,800
it's not something related to
4065
02:32:40,960 --> 02:32:44,880
installation of java okay this is just
4066
02:32:42,800 --> 02:32:47,280
another command that you specify if any
4067
02:32:44,880 --> 02:32:48,800
of your installation fails okay so this
4068
02:32:47,280 --> 02:32:50,800
is not a compulsory command that you
4069
02:32:48,800 --> 02:32:55,439
need to run but besides that what you
4070
02:32:50,800 --> 02:32:57,920
have is uh yum install java 1.8.0- 0 -
4071
02:32:55,439 --> 02:32:59,520
open JDK. Now the package name that you
4072
02:32:57,920 --> 02:33:01,280
see here right that is Java. So if I
4073
02:32:59,520 --> 02:33:03,600
want to install Java then I would just
4074
02:33:01,280 --> 02:33:05,520
give this particular package name and I
4075
02:33:03,600 --> 02:33:07,120
would say install. Okay because the
4076
02:33:05,520 --> 02:33:09,040
package name of Java that's present in
4077
02:33:07,120 --> 02:33:12,640
the Linux repository that is called as
4078
02:33:09,040 --> 02:33:14,160
Java 1.8.0 open JDK. And similarly, if
4079
02:33:12,640 --> 02:33:16,080
you want to install any other uh
4080
02:33:14,160 --> 02:33:18,399
software, right? If you want to install
4081
02:33:16,080 --> 02:33:20,880
any other technology like Hadoop, then
4082
02:33:18,399 --> 02:33:22,080
you can just give one such uh package
4083
02:33:20,880 --> 02:33:23,520
name. You just got to find out what is
4084
02:33:22,080 --> 02:33:25,600
the name of the package that they have
4085
02:33:23,520 --> 02:33:27,920
in the repository. You can just simply
4086
02:33:25,600 --> 02:33:30,000
Google it and uh it will give you the
4087
02:33:27,920 --> 02:33:31,920
package name and you can just say yum
4088
02:33:30,000 --> 02:33:34,479
install or pseudo yum install followed
4089
02:33:31,920 --> 02:33:37,359
by package name followed by Hadoop - 2.0
4090
02:33:34,479 --> 02:33:39,680
or 2.3.0 or very soon Hadoop 3.0 is
4091
02:33:37,359 --> 02:33:41,520
coming. So you can say Hadoop 3.0
4092
02:33:39,680 --> 02:33:42,960
something like that. And yeah, if it's
4093
02:33:41,520 --> 02:33:45,120
uh if you want to install Docker, then
4094
02:33:42,960 --> 02:33:47,439
again you can say sudo yum install
4095
02:33:45,120 --> 02:33:49,200
docker and uh probably the version name.
4096
02:33:47,439 --> 02:33:51,600
I don't think docker needs a version
4097
02:33:49,200 --> 02:33:54,240
though. And uh for installing docker you
4098
02:33:51,600 --> 02:33:56,720
can uh do it also through Ubuntu. Okay.
4099
02:33:54,240 --> 02:33:58,319
So when I installed docker in my other
4100
02:33:56,720 --> 02:34:00,880
Ubuntu VM right which I showed you
4101
02:33:58,319 --> 02:34:03,200
earlier. So that VM has docker installed
4102
02:34:00,880 --> 02:34:06,240
and uh the uh command that I ran that
4103
02:34:03,200 --> 02:34:08,479
time was sudo app get install docker and
4104
02:34:06,240 --> 02:34:10,479
uh that downloaded and installed the
4105
02:34:08,479 --> 02:34:13,359
latest version of docker that was
4106
02:34:10,479 --> 02:34:15,359
available in the uh repository. Okay.
4107
02:34:13,359 --> 02:34:16,479
Yeah. So that is it and once you're done
4108
02:34:15,359 --> 02:34:18,240
with the installation it would take
4109
02:34:16,479 --> 02:34:19,840
quite some time to install and once when
4110
02:34:18,240 --> 02:34:21,439
everything is done then you'll have to
4111
02:34:19,840 --> 02:34:22,960
just you know update your environment
4112
02:34:21,439 --> 02:34:24,560
variables. Okay. Here you have to set
4113
02:34:22,960 --> 02:34:27,359
the environment variables over here in
4114
02:34:24,560 --> 02:34:29,600
your dot bash rc file and once you set
4115
02:34:27,359 --> 02:34:31,280
the environment path over there then you
4116
02:34:29,600 --> 02:34:34,240
can just do source and then your
4117
02:34:31,280 --> 02:34:35,600
software is ready it's installed okay
4118
02:34:34,240 --> 02:34:37,359
now this was another step which I
4119
02:34:35,600 --> 02:34:39,680
skipped out because this is not really
4120
02:34:37,359 --> 02:34:41,840
necessary for you to uh execute this
4121
02:34:39,680 --> 02:34:45,120
okay I'll tell you why because uh this
4122
02:34:41,840 --> 02:34:47,520
command which is update alternatives -
4123
02:34:45,120 --> 02:34:49,680
config java it is only to select a
4124
02:34:47,520 --> 02:34:52,479
particular version of java now let's say
4125
02:34:49,680 --> 02:34:54,000
that you're new to Linux okay and uh
4126
02:34:52,479 --> 02:34:55,840
you're downloading Java for the first
4127
02:34:54,000 --> 02:34:57,359
time then you just need to run this
4128
02:34:55,840 --> 02:34:59,600
command. So after running this command
4129
02:34:57,359 --> 02:35:01,200
you can straight away just uh you know
4130
02:34:59,600 --> 02:35:03,680
probably when you're done with this Java
4131
02:35:01,200 --> 02:35:06,000
is installed basically okay but it's
4132
02:35:03,680 --> 02:35:07,680
just that you need to go to your pseudo
4133
02:35:06,000 --> 02:35:09,680
you should do pseudo gedit go to your
4134
02:35:07,680 --> 02:35:11,280
bash rc file and update the path where
4135
02:35:09,680 --> 02:35:13,439
java is installed okay you got to
4136
02:35:11,280 --> 02:35:15,520
specify to your uh environment variables
4137
02:35:13,439 --> 02:35:16,960
to your runtime engine that java has
4138
02:35:15,520 --> 02:35:19,280
been installed in this path so you have
4139
02:35:16,960 --> 02:35:21,120
to just copy the path of your java and
4140
02:35:19,280 --> 02:35:23,200
paste it in the environment variables
4141
02:35:21,120 --> 02:35:25,040
over here and then you have to source
4142
02:35:23,200 --> 02:35:26,640
that particular bash rc. So when you're
4143
02:35:25,040 --> 02:35:28,960
done with these two things, your Java is
4144
02:35:26,640 --> 02:35:31,040
installed. Okay. But if you already have
4145
02:35:28,960 --> 02:35:32,800
a Java package installed, okay, so in my
4146
02:35:31,040 --> 02:35:35,600
case when I'll be showing you this now,
4147
02:35:32,800 --> 02:35:38,560
I already have a Java 1.7 package. Okay.
4148
02:35:35,600 --> 02:35:41,840
So now if I do a pseudo yum install Java
4149
02:35:38,560 --> 02:35:43,359
1.8.0 open JDK, then I'll have multiple
4150
02:35:41,840 --> 02:35:44,880
versions of Java. Okay. And my
4151
02:35:43,359 --> 02:35:47,359
environment variables would be currently
4152
02:35:44,880 --> 02:35:49,520
set to Java 1.7 because that's what I
4153
02:35:47,359 --> 02:35:51,280
already have. But uh since you have you
4154
02:35:49,520 --> 02:35:52,800
know multiple versions of Java and since
4155
02:35:51,280 --> 02:35:55,280
there are different packages you can
4156
02:35:52,800 --> 02:35:57,840
have multiple packages of Java installed
4157
02:35:55,280 --> 02:36:00,080
but you can only run one of them. Okay.
4158
02:35:57,840 --> 02:36:01,920
So you set which one you want to run
4159
02:36:00,080 --> 02:36:04,080
right? That one you set over here
4160
02:36:01,920 --> 02:36:05,280
whether I want to choose to execute
4161
02:36:04,080 --> 02:36:07,680
seven or whether I want to choose to
4162
02:36:05,280 --> 02:36:09,600
execute eight that I can choose by
4163
02:36:07,680 --> 02:36:12,240
updating over here. So I'll show you
4164
02:36:09,600 --> 02:36:13,680
this command also. Okay. So that is what
4165
02:36:12,240 --> 02:36:16,160
I want to show you with respect to Linux
4166
02:36:13,680 --> 02:36:18,560
repositories. So similarly you can even
4167
02:36:16,160 --> 02:36:20,640
uh you know you can do a pseudo yum
4168
02:36:18,560 --> 02:36:22,960
install PHP if you want to install a PHP
4169
02:36:20,640 --> 02:36:24,240
server you can just say PHP MySQL server
4170
02:36:22,960 --> 02:36:27,200
if you want to install any other
4171
02:36:24,240 --> 02:36:28,880
software like wget you can do that also.
4172
02:36:27,200 --> 02:36:31,120
So this is what we are saying you know
4173
02:36:28,880 --> 02:36:32,399
it's very simple to install software. So
4174
02:36:31,120 --> 02:36:33,680
if you're doing it with the GUI then
4175
02:36:32,399 --> 02:36:34,960
you'll have a lot of steps that you need
4176
02:36:33,680 --> 02:36:36,720
to do. You need to go to the website
4177
02:36:34,960 --> 02:36:39,040
download the appropriate package then
4178
02:36:36,720 --> 02:36:40,960
extract them then install them all those
4179
02:36:39,040 --> 02:36:44,160
things. So instead this is just simpler
4180
02:36:40,960 --> 02:36:46,880
and it's uh much faster. Okay, now let
4181
02:36:44,160 --> 02:36:49,040
me go back to my terminal and show you
4182
02:36:46,880 --> 02:36:54,880
how that is done. Okay, so I'm going to
4183
02:36:49,040 --> 02:36:57,520
go to my uh CD and the command is sudo
4184
02:36:54,880 --> 02:36:59,760
yum install and uh now would come the
4185
02:36:57,520 --> 02:37:03,280
Java package. So the package I'm going
4186
02:36:59,760 --> 02:37:05,840
to install is Java 1.8.0. Okay. Uh
4187
02:37:03,280 --> 02:37:07,359
that's because Java 8 is uh plays with
4188
02:37:05,840 --> 02:37:09,520
this name. Okay. Okay. So the package
4189
02:37:07,359 --> 02:37:14,800
name of Java 8 in uh the Linux
4190
02:37:09,520 --> 02:37:17,520
repositories is uh Java - 1.8.0
4191
02:37:14,800 --> 02:37:19,520
- Open JDK.
4192
02:37:17,520 --> 02:37:22,479
Now when I hit enter, it asks for the
4193
02:37:19,520 --> 02:37:24,800
password because uh this particular uh
4194
02:37:22,479 --> 02:37:26,319
sorry for that guys when I use pseudo to
4195
02:37:24,800 --> 02:37:27,520
execute this particular command then it
4196
02:37:26,319 --> 02:37:30,640
asks for a password because I'm
4197
02:37:27,520 --> 02:37:33,359
executing this as a root user. So that's
4198
02:37:30,640 --> 02:37:35,200
why if I try executing this as a local
4199
02:37:33,359 --> 02:37:37,280
user, as my own user, then it wouldn't
4200
02:37:35,200 --> 02:37:39,040
be possible to execute this command.
4201
02:37:37,280 --> 02:37:41,680
Okay, I have to execute this as a root
4202
02:37:39,040 --> 02:37:43,600
user and uh root user is the one that
4203
02:37:41,680 --> 02:37:44,800
has the ultimate privileges, the
4204
02:37:43,600 --> 02:37:46,720
ultimate access. He has access to
4205
02:37:44,800 --> 02:37:48,880
everything. So you just enter the
4206
02:37:46,720 --> 02:37:51,280
password and put enter. Then
4207
02:37:48,880 --> 02:37:53,840
automatically your packages will get
4208
02:37:51,280 --> 02:37:55,680
downloaded and uh it'll get installed.
4209
02:37:53,840 --> 02:37:58,399
So uh now it says you know total
4210
02:37:55,680 --> 02:38:00,880
download size is 33 MB and uh it asks is
4211
02:37:58,399 --> 02:38:03,760
it okay to download it. Y stands for yes
4212
02:38:00,880 --> 02:38:05,280
and N stands for no. Now if it's uh you
4213
02:38:03,760 --> 02:38:07,280
when you're trying to download Java when
4214
02:38:05,280 --> 02:38:09,280
you give this command you got to say why
4215
02:38:07,280 --> 02:38:11,760
and hit enter because that would
4216
02:38:09,280 --> 02:38:14,160
download the 33 MB package and install
4217
02:38:11,760 --> 02:38:16,240
in your Linux machine. Okay. But however
4218
02:38:14,160 --> 02:38:18,000
I have already downloaded Java and since
4219
02:38:16,240 --> 02:38:20,000
I've done it already so I don't need to.
4220
02:38:18,000 --> 02:38:21,280
Okay. I don't want to waste my time here
4221
02:38:20,000 --> 02:38:22,800
because uh this is a session right? I
4222
02:38:21,280 --> 02:38:24,080
don't want to waste your precious time.
4223
02:38:22,800 --> 02:38:26,240
So what I'm going to do is I'm just
4224
02:38:24,080 --> 02:38:29,600
going to click on end and give enter. Is
4225
02:38:26,240 --> 02:38:31,760
it fine? Uh Sedat Hmon all you guys who
4226
02:38:29,600 --> 02:38:33,120
are in the session is it fine because I
4227
02:38:31,760 --> 02:38:34,560
want to save some time here by hitting
4228
02:38:33,120 --> 02:38:36,080
N. Okay. Because otherwise it would take
4229
02:38:34,560 --> 02:38:38,240
some time to set up the installation
4230
02:38:36,080 --> 02:38:40,720
process. So okay fine. Yeah I'm getting
4231
02:38:38,240 --> 02:38:42,479
a yes from uh you both. All right. So
4232
02:38:40,720 --> 02:38:45,120
I'm just going to click on no. Okay. So
4233
02:38:42,479 --> 02:38:47,040
it says uh exiting on the user command.
4234
02:38:45,120 --> 02:38:48,640
Great. Uh yeah. So the the only thing
4235
02:38:47,040 --> 02:38:50,800
you got to note is that instead of n if
4236
02:38:48,640 --> 02:38:52,240
you put y and if you hit enter it would
4237
02:38:50,800 --> 02:38:54,640
download for you and it would complete
4238
02:38:52,240 --> 02:38:55,840
the installation. All right and uh
4239
02:38:54,640 --> 02:38:58,240
there's one more thing that I would
4240
02:38:55,840 --> 02:39:00,800
actually like to add to this. Supposing
4241
02:38:58,240 --> 02:39:02,800
while uh installing the same package
4242
02:39:00,800 --> 02:39:05,200
right while uh doing the pseudo yum
4243
02:39:02,800 --> 02:39:07,359
install java this package when you're
4244
02:39:05,200 --> 02:39:09,680
trying to run this command if you want
4245
02:39:07,359 --> 02:39:11,680
this y option to be chosen automatically
4246
02:39:09,680 --> 02:39:13,520
okay because right now it entered into
4247
02:39:11,680 --> 02:39:15,439
the interactive mode. Okay, interractor
4248
02:39:13,520 --> 02:39:17,040
mode is when the colonel was asking you
4249
02:39:15,439 --> 02:39:18,880
should you download this and do you want
4250
02:39:17,040 --> 02:39:21,040
to download this and execute it later
4251
02:39:18,880 --> 02:39:23,120
and I had to press N and get out of it.
4252
02:39:21,040 --> 02:39:24,960
Okay, but however you might not want to.
4253
02:39:23,120 --> 02:39:27,359
Okay, so so there may be times when you
4254
02:39:24,960 --> 02:39:29,680
might want to by default just click on
4255
02:39:27,359 --> 02:39:32,240
yes. So what you can do at that time is
4256
02:39:29,680 --> 02:39:34,720
you can just uh go back here sodom you
4257
02:39:32,240 --> 02:39:37,760
have a flag here you can just put hyphen
4258
02:39:34,720 --> 02:39:39,040
y and if you uh then install it then it
4259
02:39:37,760 --> 02:39:40,880
will not ask you it will not get into
4260
02:39:39,040 --> 02:39:43,760
this interactor mode. So it will take
4261
02:39:40,880 --> 02:39:46,000
this y flag y option automatically and
4262
02:39:43,760 --> 02:39:48,319
it will uh you know install the java
4263
02:39:46,000 --> 02:39:49,359
package. So that is what I wanted to
4264
02:39:48,319 --> 02:39:52,000
show you. That's what I want to tell
4265
02:39:49,359 --> 02:39:54,319
you. So that's how you install uh java.
4266
02:39:52,000 --> 02:39:56,880
Okay. So now I've just cleared the
4267
02:39:54,319 --> 02:39:59,200
screen guys. Okay. So the when you
4268
02:39:56,880 --> 02:40:00,800
execute this command in your Linux
4269
02:39:59,200 --> 02:40:02,399
machine and when you finished
4270
02:40:00,800 --> 02:40:04,479
downloading and installation of your uh
4271
02:40:02,399 --> 02:40:06,640
Java, what you got to do is you got to
4272
02:40:04,479 --> 02:40:08,560
set your environment variables. Okay. So
4273
02:40:06,640 --> 02:40:11,040
as it was written in the slide, you got
4274
02:40:08,560 --> 02:40:13,040
to give the pseudo gedit bash rc to
4275
02:40:11,040 --> 02:40:14,960
enter into the bash rc file and set the
4276
02:40:13,040 --> 02:40:17,840
enment variables here the path to where
4277
02:40:14,960 --> 02:40:19,520
your java is installed. Okay. So uh what
4278
02:40:17,840 --> 02:40:21,840
I'm going to do is uh I'm going to do
4279
02:40:19,520 --> 02:40:23,120
the same to and your bash rc is
4280
02:40:21,840 --> 02:40:25,120
something that will be present only in
4281
02:40:23,120 --> 02:40:28,080
your home directory. Okay. So you got to
4282
02:40:25,120 --> 02:40:31,760
remember to uh go to cd and from cd you
4283
02:40:28,080 --> 02:40:36,000
got to access that. You got to say sudo
4284
02:40:31,760 --> 02:40:37,680
gedit space dot bash rc. When you do
4285
02:40:36,000 --> 02:40:38,880
this, it'll ask you for the password.
4286
02:40:37,680 --> 02:40:40,640
But of course, I've entered the password
4287
02:40:38,880 --> 02:40:42,800
previously, so it didn't ask me. But
4288
02:40:40,640 --> 02:40:45,520
yeah, when you do that, you will open
4289
02:40:42,800 --> 02:40:48,479
this uh bash rc file. Okay, so right now
4290
02:40:45,520 --> 02:40:50,479
my java path is set to this. Okay, so
4291
02:40:48,479 --> 02:40:52,960
this means when during runtime when any
4292
02:40:50,479 --> 02:40:56,240
application is using or requesting for
4293
02:40:52,960 --> 02:40:58,560
java, then it will look for Java in uh
4294
02:40:56,240 --> 02:41:00,000
this path. So you just need to find out
4295
02:40:58,560 --> 02:41:01,840
where your Java has been installed in
4296
02:41:00,000 --> 02:41:04,560
your system. So it would most probably
4297
02:41:01,840 --> 02:41:06,640
be in your user/lib/jvm
4298
02:41:04,560 --> 02:41:08,640
folder. Okay. So let me uh go to the
4299
02:41:06,640 --> 02:41:12,000
same. So it'll be there under your root
4300
02:41:08,640 --> 02:41:14,160
directory. So uh if you uh go to your my
4301
02:41:12,000 --> 02:41:17,280
computer from your file system under the
4302
02:41:14,160 --> 02:41:18,560
lib folder we have various uh packages
4303
02:41:17,280 --> 02:41:20,160
that will all be installed over here.
4304
02:41:18,560 --> 02:41:23,120
Okay. So in my system it's all installed
4305
02:41:20,160 --> 02:41:24,800
over here. So this is the JVM folder and
4306
02:41:23,120 --> 02:41:26,800
inside here I have all the different
4307
02:41:24,800 --> 02:41:29,200
Java packages which I have downloaded
4308
02:41:26,800 --> 02:41:31,280
over a period of time. So guys uh in
4309
02:41:29,200 --> 02:41:34,160
this case supposing see I have Java
4310
02:41:31,280 --> 02:41:37,120
1.7.0 open JDK installed. Okay. Now in
4311
02:41:34,160 --> 02:41:39,359
your case you will have a Java 1 8.0
4312
02:41:37,120 --> 02:41:40,800
open JDK installed. So what you got to
4313
02:41:39,359 --> 02:41:42,640
do is you got to just right click on
4314
02:41:40,800 --> 02:41:43,680
that folder. Okay. Similar to what I'm
4315
02:41:42,640 --> 02:41:46,640
doing now. Okay. I'm going to right
4316
02:41:43,680 --> 02:41:50,479
click and just click on copy and go here
4317
02:41:46,640 --> 02:41:52,640
and paste the path over here. Okay. If
4318
02:41:50,479 --> 02:41:55,920
anything is existing already then remove
4319
02:41:52,640 --> 02:41:58,160
that and paste the new path. So the path
4320
02:41:55,920 --> 02:42:00,640
is nothing but where your JVM is located
4321
02:41:58,160 --> 02:42:02,560
from your root. So it's in root usr
4322
02:42:00,640 --> 02:42:04,240
library folder and then inside library
4323
02:42:02,560 --> 02:42:05,680
it's in JVM and here it's this is the
4324
02:42:04,240 --> 02:42:07,280
folder it's present in. Okay. And then
4325
02:42:05,680 --> 02:42:10,479
you got to also additionally give the
4326
02:42:07,280 --> 02:42:11,760
path to your bin directory. Okay. So you
4327
02:42:10,479 --> 02:42:13,600
have this is your bin directory. So what
4328
02:42:11,760 --> 02:42:16,640
you do is you right click on bin again
4329
02:42:13,600 --> 02:42:19,200
copy go to your dot bash rc. Okay. You
4330
02:42:16,640 --> 02:42:21,439
got to uh paste it over here. All right.
4331
02:42:19,200 --> 02:42:23,760
So this is how uh this is what you do.
4332
02:42:21,439 --> 02:42:25,840
This is how simple it is. So when you do
4333
02:42:23,760 --> 02:42:28,319
it, you just got to save it. And you got
4334
02:42:25,840 --> 02:42:30,560
to, you know, close this uh dot bash rc
4335
02:42:28,319 --> 02:42:32,240
file. And when you're done with uh
4336
02:42:30,560 --> 02:42:34,080
saving and closing it, just go back to
4337
02:42:32,240 --> 02:42:36,000
your terminal and you got to run this
4338
02:42:34,080 --> 02:42:40,080
command
4339
02:42:36,000 --> 02:42:41,840
source dot bash rc. Okay. So when you do
4340
02:42:40,080 --> 02:42:43,359
this, then your terminal will get synced
4341
02:42:41,840 --> 02:42:44,880
with the updated environment variables.
4342
02:42:43,359 --> 02:42:46,479
Otherwise, even if you don't run it,
4343
02:42:44,880 --> 02:42:48,000
it's fine. You can just start executing
4344
02:42:46,479 --> 02:42:49,439
your commands from a new terminal. Then
4345
02:42:48,000 --> 02:42:51,200
it would all be fine. But yeah, the
4346
02:42:49,439 --> 02:42:52,560
source.bass back is only to sync your
4347
02:42:51,200 --> 02:42:54,880
environment variables with this
4348
02:42:52,560 --> 02:42:58,080
particular terminal that is uh opened.
4349
02:42:54,880 --> 02:43:01,520
Okay, so that's how you install Java in
4350
02:42:58,080 --> 02:43:03,600
your uh system. Okay guys, so u I'm just
4351
02:43:01,520 --> 02:43:05,680
going to clear the screen now. Okay, and
4352
02:43:03,600 --> 02:43:07,359
I'm going to go back to my slides. Okay,
4353
02:43:05,680 --> 02:43:09,920
so I'm done with showing you how to work
4354
02:43:07,359 --> 02:43:11,600
with Linux repositories and uh the next
4355
02:43:09,920 --> 02:43:14,800
topic that I'm going to talk about is
4356
02:43:11,600 --> 02:43:17,520
that of uh tar files. So what are tar
4357
02:43:14,800 --> 02:43:19,600
files? Okay, so all of you Windows users
4358
02:43:17,520 --> 02:43:21,760
might be aware of uh this software
4359
02:43:19,600 --> 02:43:23,439
called Vinszip or VRA. Okay, what are
4360
02:43:21,760 --> 02:43:25,920
they? What do they do? They are
4361
02:43:23,439 --> 02:43:27,200
basically to extract your files, right?
4362
02:43:25,920 --> 02:43:29,120
So they'll be in compressed form and
4363
02:43:27,200 --> 02:43:30,880
you'll have to extract them. So uh in
4364
02:43:29,120 --> 02:43:33,120
Linux we have an equivalent format. So
4365
02:43:30,880 --> 02:43:36,160
in Linux it is either the tar file or
4366
02:43:33,120 --> 02:43:37,680
the gzip and the gunzip files. Okay, so
4367
02:43:36,160 --> 02:43:39,040
tar is the preferred option. So I'm
4368
02:43:37,680 --> 02:43:41,359
going to show you how to compress and
4369
02:43:39,040 --> 02:43:43,359
decompress a file with tar format. But
4370
02:43:41,359 --> 02:43:44,880
however even gzip and gunzip is
4371
02:43:43,359 --> 02:43:47,520
something that can be used if you want
4372
02:43:44,880 --> 02:43:49,600
to compress a files with the gz format
4373
02:43:47,520 --> 02:43:51,040
okay then you got to use this command
4374
02:43:49,600 --> 02:43:52,880
but however if you are going to
4375
02:43:51,040 --> 02:43:56,000
decompress it then you got to give guns
4376
02:43:52,880 --> 02:43:58,000
okay and the syntax is here okay but
4377
02:43:56,000 --> 02:44:00,080
however with tar you for both
4378
02:43:58,000 --> 02:44:01,840
compressing and decompressing you'll use
4379
02:44:00,080 --> 02:44:03,680
the same tar command itself so you'll
4380
02:44:01,840 --> 02:44:05,520
just have tar and in the arguments
4381
02:44:03,680 --> 02:44:07,279
there'll be a minor change so when
4382
02:44:05,520 --> 02:44:10,880
you're compressing the file you'll have
4383
02:44:07,279 --> 02:44:12,479
to specify hyphen c okay and when you're
4384
02:44:10,880 --> 02:44:15,520
decompressing the file, you'll have to
4385
02:44:12,479 --> 02:44:17,680
give the uh flag minus x otherwise it's
4386
02:44:15,520 --> 02:44:20,800
all fine. Uh the vi here stands for
4387
02:44:17,680 --> 02:44:22,800
verbos and the f here indicates that you
4388
02:44:20,800 --> 02:44:25,120
want to compress the file that is
4389
02:44:22,800 --> 02:44:27,600
mentioned followed by uh the command
4390
02:44:25,120 --> 02:44:29,120
here. Okay, so this f just basically
4391
02:44:27,600 --> 02:44:31,600
indicates that you got to compress this
4392
02:44:29,120 --> 02:44:33,359
particular file otherwise the uh colonel
4393
02:44:31,600 --> 02:44:35,520
will be wondering which file to compress
4394
02:44:33,359 --> 02:44:39,200
and it will throw an error to you later.
4395
02:44:35,520 --> 02:44:40,640
Okay, so that is what the xvf stand for.
4396
02:44:39,200 --> 02:44:43,200
These are the different flags that are
4397
02:44:40,640 --> 02:44:44,960
available with the star command. Okay.
4398
02:44:43,200 --> 02:44:46,479
Okay. Before I go and show you how to do
4399
02:44:44,960 --> 02:44:48,880
the start, let me show you a place where
4400
02:44:46,479 --> 02:44:50,479
tar files will be present. So in Linux,
4401
02:44:48,880 --> 02:44:51,520
right? So no matter what kind of
4402
02:44:50,479 --> 02:44:53,439
software you're downloading, whether
4403
02:44:51,520 --> 02:44:54,960
it's a Java package or if it's a Hadoop
4404
02:44:53,439 --> 02:44:57,200
package, if you're downloading them
4405
02:44:54,960 --> 02:44:59,680
manually from the internet, okay, then
4406
02:44:57,200 --> 02:45:02,399
you would get them in the tar format.
4407
02:44:59,680 --> 02:45:05,200
Okay? Or you might find them in uh TGZ
4408
02:45:02,399 --> 02:45:07,200
format. Okay? So tar is something the
4409
02:45:05,200 --> 02:45:09,200
most I mean I would prefer a few people
4410
02:45:07,200 --> 02:45:11,120
download tar because that's the easiest
4411
02:45:09,200 --> 02:45:12,720
uh it's easiest to extract and you know
4412
02:45:11,120 --> 02:45:14,479
also compress them. So I can just
4413
02:45:12,720 --> 02:45:16,160
download the tar file. It's very common
4414
02:45:14,479 --> 02:45:18,000
and you can just by just running this
4415
02:45:16,160 --> 02:45:19,600
one command you can compress the file.
4416
02:45:18,000 --> 02:45:21,920
So the Hadoop packages that are
4417
02:45:19,600 --> 02:45:24,560
available on Apache's website right that
4418
02:45:21,920 --> 02:45:26,800
would almost be around 2 to 3 GB but you
4419
02:45:24,560 --> 02:45:29,120
the compress format will only be around
4420
02:45:26,800 --> 02:45:31,200
100 or 200 MB. Okay. So same thing can
4421
02:45:29,120 --> 02:45:32,880
be said for uh something like Tomcat if
4422
02:45:31,200 --> 02:45:35,439
you're you know downloading the Tomcat
4423
02:45:32,880 --> 02:45:37,680
package or Nagios. So anything like
4424
02:45:35,439 --> 02:45:40,319
that. So those packages would have a lot
4425
02:45:37,680 --> 02:45:41,840
of MB and uh to download them you'll
4426
02:45:40,319 --> 02:45:43,920
need to compress them right. So because
4427
02:45:41,840 --> 02:45:46,160
the lesser you download the more uh you
4428
02:45:43,920 --> 02:45:48,399
save on bandwidth. So it's also easier
4429
02:45:46,160 --> 02:45:50,720
to transfer them in a compressed format.
4430
02:45:48,399 --> 02:45:52,560
So for transferring especially you use
4431
02:45:50,720 --> 02:45:54,479
the tar files. Okay, you compress them
4432
02:45:52,560 --> 02:45:56,319
into tar format and then later when
4433
02:45:54,479 --> 02:45:57,760
you're done downloading, you can extract
4434
02:45:56,319 --> 02:45:59,439
them and bring them to regular file
4435
02:45:57,760 --> 02:46:01,920
format. So, I'll show you how that is
4436
02:45:59,439 --> 02:46:04,800
done. So, uh first of all, let me go to
4437
02:46:01,920 --> 02:46:08,000
my terminal and uh let's go to the
4438
02:46:04,800 --> 02:46:10,720
documents folder. Okay. Um here I'm
4439
02:46:08,000 --> 02:46:12,560
doing an ls. We have this. So, what I'm
4440
02:46:10,720 --> 02:46:14,080
going to do now is I'm going to say
4441
02:46:12,560 --> 02:46:17,120
ls-l.
4442
02:46:14,080 --> 02:46:19,760
Okay. When I run this, you can see the
4443
02:46:17,120 --> 02:46:22,160
different files and the size. Okay. You
4444
02:46:19,760 --> 02:46:24,800
can see that the uh LMS folder right the
4445
02:46:22,160 --> 02:46:28,000
LMS folder here it has it's the highest
4446
02:46:24,800 --> 02:46:29,439
okay it's it's showing it's 4 40 496 MB.
4447
02:46:28,000 --> 02:46:31,840
So what we can do is I'm going to show
4448
02:46:29,439 --> 02:46:34,399
you how to compress this and convert it
4449
02:46:31,840 --> 02:46:39,120
into a tar file. So to convert it into a
4450
02:46:34,399 --> 02:46:41,040
tar file you got to say tar - cvf. Okay
4451
02:46:39,120 --> 02:46:42,479
x is when you're trying to decompress it
4452
02:46:41,040 --> 02:46:44,640
but uh cvf is when you're trying to
4453
02:46:42,479 --> 02:46:48,399
compress it. So you're going to say tar
4454
02:46:44,640 --> 02:46:50,000
- cvf and then here comes the uh tar
4455
02:46:48,399 --> 02:46:51,920
file name. So what you want to be the
4456
02:46:50,000 --> 02:46:55,520
name of the tar file. Okay. So I just
4457
02:46:51,920 --> 02:46:56,800
want to have it as lms do tar. Okay. So
4458
02:46:55,520 --> 02:46:58,960
this is the name of the file I want to
4459
02:46:56,800 --> 02:47:00,800
keep. So I will put that here. And then
4460
02:46:58,960 --> 02:47:02,319
you got to specify the file which you
4461
02:47:00,800 --> 02:47:03,520
want to compress whether it's LMS or
4462
02:47:02,319 --> 02:47:06,560
whether it's any other folder. So I want
4463
02:47:03,520 --> 02:47:09,120
to do it for LMS. So I can just say LMS.
4464
02:47:06,560 --> 02:47:11,040
Okay. And when I run this command then
4465
02:47:09,120 --> 02:47:12,960
this particular document would have been
4466
02:47:11,040 --> 02:47:14,960
compressed and it's present. Okay. So if
4467
02:47:12,960 --> 02:47:17,439
I do an ls now you can see that there's
4468
02:47:14,960 --> 02:47:18,880
an LMS folder and an LMS star file.
4469
02:47:17,439 --> 02:47:21,520
Okay. So this is the compressed version
4470
02:47:18,880 --> 02:47:24,000
of this folder. Now when I do an l ls
4471
02:47:21,520 --> 02:47:25,439
minus l command, you'll see that there's
4472
02:47:24,000 --> 02:47:27,840
a new tar file that's created. Okay,
4473
02:47:25,439 --> 02:47:30,319
lms.tar. And then you have this folder
4474
02:47:27,840 --> 02:47:32,319
whose tar file this one is. So that's
4475
02:47:30,319 --> 02:47:34,479
how uh simple it is guys. And uh what
4476
02:47:32,319 --> 02:47:37,120
you can uh do now is if you uh you can
4477
02:47:34,479 --> 02:47:39,760
just transfer this file over FTP or via
4478
02:47:37,120 --> 02:47:41,200
SSH or you know just upload this to your
4479
02:47:39,760 --> 02:47:42,720
internet and let people download this
4480
02:47:41,200 --> 02:47:46,000
because this is a smaller file compared
4481
02:47:42,720 --> 02:47:48,479
to this proper folder. Right now uh in
4482
02:47:46,000 --> 02:47:50,399
case you want to uh extract a file. So
4483
02:47:48,479 --> 02:47:52,319
in case you have downloaded this kind of
4484
02:47:50,399 --> 02:47:54,399
a tar file, okay, from the internet, how
4485
02:47:52,319 --> 02:47:57,520
will you untar it? What is the package
4486
02:47:54,399 --> 02:47:59,200
to uh know decompress it? So uh to
4487
02:47:57,520 --> 02:48:02,640
answer that question, I can we can give
4488
02:47:59,200 --> 02:48:05,120
the command tar- xvf and the package
4489
02:48:02,640 --> 02:48:06,800
name. So in my case, it's lms.tar. So
4490
02:48:05,120 --> 02:48:09,200
when I just do this and when I hit
4491
02:48:06,800 --> 02:48:12,399
enter, then that package would get
4492
02:48:09,200 --> 02:48:14,560
extracted. So now if I do an ls command
4493
02:48:12,399 --> 02:48:16,240
you can see that this particular tar
4494
02:48:14,560 --> 02:48:18,479
file has been extracted but you can't
4495
02:48:16,240 --> 02:48:20,399
see two different folders because uh the
4496
02:48:18,479 --> 02:48:24,000
existing LMS folder has been uh
4497
02:48:20,399 --> 02:48:25,760
rewritten okay so it has been uh well
4498
02:48:24,000 --> 02:48:26,880
let's just say it has been overwritten
4499
02:48:25,760 --> 02:48:28,960
and that's why you can't see two
4500
02:48:26,880 --> 02:48:31,680
different files but yeah as you can see
4501
02:48:28,960 --> 02:48:35,520
this was the process which was taken to
4502
02:48:31,680 --> 02:48:38,080
untar the LMS package okay so that's it
4503
02:48:35,520 --> 02:48:40,560
with respect to the compressing and
4504
02:48:38,080 --> 02:48:42,319
decompressing of files So uh let me
4505
02:48:40,560 --> 02:48:45,279
quickly go to the next topic in my
4506
02:48:42,319 --> 02:48:47,439
slide. Okay. So the next topic is that
4507
02:48:45,279 --> 02:48:49,120
of environment variables. So what are
4508
02:48:47,439 --> 02:48:50,560
environment variables? I told you that
4509
02:48:49,120 --> 02:48:52,319
we had to set the environment variables
4510
02:48:50,560 --> 02:48:54,560
in the bashrc file, right? While
4511
02:48:52,319 --> 02:48:56,319
installing Java. So what are they? As
4512
02:48:54,560 --> 02:48:58,000
the definition says here, environment
4513
02:48:56,319 --> 02:49:00,399
variables control the behavior of the
4514
02:48:58,000 --> 02:49:02,399
software packages installed in Linux.
4515
02:49:00,399 --> 02:49:04,080
Okay. The path where the packages have
4516
02:49:02,399 --> 02:49:06,240
been installed will be specified in the
4517
02:49:04,080 --> 02:49:08,319
environment variables. So if you're
4518
02:49:06,240 --> 02:49:10,720
installing Java okay and if there is
4519
02:49:08,319 --> 02:49:13,439
some other application which needs Java
4520
02:49:10,720 --> 02:49:15,120
let's take the example of Hadoop okay so
4521
02:49:13,439 --> 02:49:16,880
Hadoop is basically a Java framework
4522
02:49:15,120 --> 02:49:18,960
okay so the map produce concepts it's
4523
02:49:16,880 --> 02:49:20,640
all Java related and you need Java to
4524
02:49:18,960 --> 02:49:23,359
run Hadoop otherwise it will not run
4525
02:49:20,640 --> 02:49:25,040
Hadoop so by just downloading uh the
4526
02:49:23,359 --> 02:49:26,880
Hadoop tar file from the internet and
4527
02:49:25,040 --> 02:49:29,040
extracting that tar file is not enough
4528
02:49:26,880 --> 02:49:31,439
okay what you got to do is you got to
4529
02:49:29,040 --> 02:49:33,600
download Java also and uh set the
4530
02:49:31,439 --> 02:49:36,399
environment variables for both Java and
4531
02:49:33,600 --> 02:49:37,840
for Hadoop so In our case when Hadoop is
4532
02:49:36,399 --> 02:49:40,319
running because it's based on the Java
4533
02:49:37,840 --> 02:49:41,760
framework it would need Java to work
4534
02:49:40,319 --> 02:49:43,200
right. So at times it will ask the
4535
02:49:41,760 --> 02:49:45,040
runtime engine where is Java installed
4536
02:49:43,200 --> 02:49:46,960
so that I need some commands to be run
4537
02:49:45,040 --> 02:49:48,479
on Java. So at that time when the
4538
02:49:46,960 --> 02:49:49,680
runtime engine is asked that kind of a
4539
02:49:48,479 --> 02:49:51,600
question it will go to the environment
4540
02:49:49,680 --> 02:49:53,439
variables and it will look for the path
4541
02:49:51,600 --> 02:49:54,640
over there. Okay. So that was the
4542
02:49:53,439 --> 02:49:56,880
environment variables I was talking
4543
02:49:54,640 --> 02:49:58,720
about earlier. Okay. You go and set your
4544
02:49:56,880 --> 02:50:01,600
environment variables in your dot bash
4545
02:49:58,720 --> 02:50:04,080
rc file. And your dot bash rc file can
4546
02:50:01,600 --> 02:50:05,760
be uh accessed by going to your home
4547
02:50:04,080 --> 02:50:10,560
directory. From your home directory just
4548
02:50:05,760 --> 02:50:12,560
run gedit dot bash rc. Okay. And here
4549
02:50:10,560 --> 02:50:14,720
you can set your path. So if you've
4550
02:50:12,560 --> 02:50:16,000
installed Hadoop recently then you can
4551
02:50:14,720 --> 02:50:17,279
just set the path of Hadoop over here.
4552
02:50:16,000 --> 02:50:19,600
And if you've installed Java then you
4553
02:50:17,279 --> 02:50:21,359
can set the path of Java over here. So
4554
02:50:19,600 --> 02:50:24,000
basically whenever any other application
4555
02:50:21,359 --> 02:50:26,319
wants access to uh some program right?
4556
02:50:24,000 --> 02:50:29,040
So it can uh get access by looking at
4557
02:50:26,319 --> 02:50:31,040
its path from here. So that's what the
4558
02:50:29,040 --> 02:50:32,479
uh bash rc file is all about. Okay,
4559
02:50:31,040 --> 02:50:34,560
that's what the enamement variables are
4560
02:50:32,479 --> 02:50:36,640
all about. So uh that was about the
4561
02:50:34,560 --> 02:50:38,000
enamement variables and we have some of
4562
02:50:36,640 --> 02:50:40,560
the most common environment variables
4563
02:50:38,000 --> 02:50:42,960
are these. Okay, print env. So this will
4564
02:50:40,560 --> 02:50:45,200
basically list or prints the list of all
4565
02:50:42,960 --> 02:50:46,479
the enamement variables. Okay, all or
4566
02:50:45,200 --> 02:50:48,080
almost all the enamment variables.
4567
02:50:46,479 --> 02:50:50,399
That's what this will do. And then when
4568
02:50:48,080 --> 02:50:51,840
you say echo, you know, dollar home,
4569
02:50:50,399 --> 02:50:54,240
this will print the path of the home
4570
02:50:51,840 --> 02:50:55,680
directory of the user. So this uh hom
4571
02:50:54,240 --> 02:50:57,840
that you see here this is a variable
4572
02:50:55,680 --> 02:50:59,359
okay and uh the path of your home
4573
02:50:57,840 --> 02:51:00,880
directory has been specified over here.
4574
02:50:59,359 --> 02:51:03,359
So whenever you press cd on your
4575
02:51:00,880 --> 02:51:05,359
terminal right so it goes to the home
4576
02:51:03,359 --> 02:51:06,399
directory correct so that is the home
4577
02:51:05,359 --> 02:51:08,960
directory I'm talking about over here
4578
02:51:06,399 --> 02:51:11,760
and the path of that is what is set over
4579
02:51:08,960 --> 02:51:13,040
here. So when you say echo dollar home
4580
02:51:11,760 --> 02:51:14,960
like I told you earlier I showed you
4581
02:51:13,040 --> 02:51:16,160
that echo will basically print whatever
4582
02:51:14,960 --> 02:51:18,160
arguments you give it will print it to
4583
02:51:16,160 --> 02:51:20,880
standard output right. So when you say
4584
02:51:18,160 --> 02:51:22,640
echo dollar home it will print the path
4585
02:51:20,880 --> 02:51:25,680
of your home whatever stored in this
4586
02:51:22,640 --> 02:51:27,920
variable and similarly when you give
4587
02:51:25,680 --> 02:51:30,080
echo dollar path then it will print the
4588
02:51:27,920 --> 02:51:32,000
list of all the directories in which the
4589
02:51:30,080 --> 02:51:34,560
shell looks for commands. Okay. And all
4590
02:51:32,000 --> 02:51:36,240
those directories will be separated by
4591
02:51:34,560 --> 02:51:38,319
colon. Okay. So you'll have multiple
4592
02:51:36,240 --> 02:51:39,840
directories which you'll get as a result
4593
02:51:38,319 --> 02:51:42,479
and they will all be separated by a
4594
02:51:39,840 --> 02:51:44,399
colon. Okay. And similarly for host name
4595
02:51:42,479 --> 02:51:46,000
whatever is the name of your host of
4596
02:51:44,399 --> 02:51:47,760
your system. Right? That will be printed
4597
02:51:46,000 --> 02:51:49,760
when you give this because this again is
4598
02:51:47,760 --> 02:51:51,600
a variable and this uh is all set as
4599
02:51:49,760 --> 02:51:53,600
environment variables. Okay. And then
4600
02:51:51,600 --> 02:51:55,439
you have username your username will be
4601
02:51:53,600 --> 02:51:58,160
printed. So and when we say language
4602
02:51:55,439 --> 02:52:00,560
it's basically the uh the language right
4603
02:51:58,160 --> 02:52:01,840
in which the whole uh system works. It
4604
02:52:00,560 --> 02:52:03,439
can be either Chinese or it can be
4605
02:52:01,840 --> 02:52:05,439
English. So in our case, it will all be
4606
02:52:03,439 --> 02:52:07,600
English, right? So because we are all uh
4607
02:52:05,439 --> 02:52:09,680
working on English. So it'll all print
4608
02:52:07,600 --> 02:52:11,279
either US English or UK English,
4609
02:52:09,680 --> 02:52:12,960
something like that. And when you say
4610
02:52:11,279 --> 02:52:15,359
echo bash version, this will print the
4611
02:52:12,960 --> 02:52:17,279
version of uh this instance of bash. So
4612
02:52:15,359 --> 02:52:20,080
let's just go ahead and execute some of
4613
02:52:17,279 --> 02:52:21,680
these uh environment variables. Okay,
4614
02:52:20,080 --> 02:52:24,560
I'm just going to clear the screen and
4615
02:52:21,680 --> 02:52:28,479
go to cd. Clear the screen. And first of
4616
02:52:24,560 --> 02:52:30,560
all, let's uh put dollar or let's say
4617
02:52:28,479 --> 02:52:32,640
echo. when you give echo you have
4618
02:52:30,560 --> 02:52:36,080
nothing. Okay, I showed you earlier that
4619
02:52:32,640 --> 02:52:38,720
when you just put in echo and uh when
4620
02:52:36,080 --> 02:52:40,880
you say hi you will get high as return
4621
02:52:38,720 --> 02:52:44,399
the output will be high. So similarly
4622
02:52:40,880 --> 02:52:47,040
when you say echo dollar x right I set
4623
02:52:44,399 --> 02:52:49,600
the path of x to to 100 earlier. So when
4624
02:52:47,040 --> 02:52:51,680
when I say this right x I will get the
4625
02:52:49,600 --> 02:52:54,160
value of 100 now and similarly the path
4626
02:52:51,680 --> 02:53:01,040
of home will already be set. So if I
4627
02:52:54,160 --> 02:53:02,880
just give uh echo and u dollar path then
4628
02:53:01,040 --> 02:53:04,960
all the directories where the shell will
4629
02:53:02,880 --> 02:53:07,279
look for to execute commands those paths
4630
02:53:04,960 --> 02:53:09,279
will be present here. So scope is
4631
02:53:07,279 --> 02:53:11,200
located over here in this uh bin path
4632
02:53:09,279 --> 02:53:12,960
and separated by a colon we have the
4633
02:53:11,200 --> 02:53:15,279
next thing. So I have installed pig in
4634
02:53:12,960 --> 02:53:17,520
my system. So pig is installed here. Ui
4635
02:53:15,279 --> 02:53:20,560
is installed here. H is installed here.
4636
02:53:17,520 --> 02:53:23,279
Okay. And similarly uh if you see java
4637
02:53:20,560 --> 02:53:26,800
java is installed here. Okay. and Hadoop
4638
02:53:23,279 --> 02:53:28,880
2.2.0 Z that's installed over here right
4639
02:53:26,800 --> 02:53:31,200
and uh similarly there are all the
4640
02:53:28,880 --> 02:53:33,439
directories where your shell will look
4641
02:53:31,200 --> 02:53:35,359
for right they will all be specified in
4642
02:53:33,439 --> 02:53:38,160
uh this path so similarly you have
4643
02:53:35,359 --> 02:53:39,920
another command that is for uh home this
4644
02:53:38,160 --> 02:53:42,240
will print the home directory and my
4645
02:53:39,920 --> 02:53:44,560
home directory is home/reka
4646
02:53:42,240 --> 02:53:47,520
you can also alternatively
4647
02:53:44,560 --> 02:53:50,560
print your host name right so my host
4648
02:53:47,520 --> 02:53:53,279
name is localhost dot localadmin okay so
4649
02:53:50,560 --> 02:53:54,960
this is my host name right so my uh
4650
02:53:53,279 --> 02:53:56,880
basically My host name is local host. So
4651
02:53:54,960 --> 02:54:00,240
that's what's being printed here. And
4652
02:53:56,880 --> 02:54:03,279
when I say echo and follow that with
4653
02:54:00,240 --> 02:54:05,680
language, okay, with a dollar, then it
4654
02:54:03,279 --> 02:54:08,560
would print the language. So this is uh
4655
02:54:05,680 --> 02:54:10,319
using English, US English, okay, UTF -
4656
02:54:08,560 --> 02:54:11,840
8. So that's what this means. And in
4657
02:54:10,319 --> 02:54:14,000
case if you want to print the list of
4658
02:54:11,840 --> 02:54:17,520
all the uh enamement variables, then you
4659
02:54:14,000 --> 02:54:19,920
can just run this command print env.
4660
02:54:17,520 --> 02:54:21,520
So all the enamement variables uh that
4661
02:54:19,920 --> 02:54:24,479
are there in your system, they will all
4662
02:54:21,520 --> 02:54:26,160
be displayed here. Okay, so u that's it
4663
02:54:24,479 --> 02:54:28,800
with respect to environment variables.
4664
02:54:26,160 --> 02:54:31,040
Let me get back to my slides now and
4665
02:54:28,800 --> 02:54:32,960
continue with my session. So going on to
4666
02:54:31,040 --> 02:54:35,680
the next slide now I'm going to talk
4667
02:54:32,960 --> 02:54:37,920
about regular expressions. Okay, so
4668
02:54:35,680 --> 02:54:40,000
regular expressions or reg x they are
4669
02:54:37,920 --> 02:54:41,520
used to search through data. It can be
4670
02:54:40,000 --> 02:54:44,240
piped along with the grip command to
4671
02:54:41,520 --> 02:54:46,800
find patterns of text in the file. Okay,
4672
02:54:44,240 --> 02:54:49,840
now what this means is that you'll have
4673
02:54:46,800 --> 02:54:51,680
multiple different files or you know
4674
02:54:49,840 --> 02:54:53,760
multiple a lot of data in probably even
4675
02:54:51,680 --> 02:54:55,520
one file. Okay. Uh with the help of
4676
02:54:53,760 --> 02:54:57,279
regular expression, what you can do is
4677
02:54:55,520 --> 02:54:59,200
you can search for patterns of that
4678
02:54:57,279 --> 02:55:01,439
data. So you can use the GP to search
4679
02:54:59,200 --> 02:55:03,200
through data and you can uh use the
4680
02:55:01,439 --> 02:55:04,479
regular expressions to search through
4681
02:55:03,200 --> 02:55:06,000
patterns of data. That kind of a
4682
02:55:04,479 --> 02:55:08,080
pattern. Supposing you have a spelling
4683
02:55:06,000 --> 02:55:11,520
mistake in the middle. Okay. Supposing
4684
02:55:08,080 --> 02:55:13,600
the spelling of apple is a ple e. Okay.
4685
02:55:11,520 --> 02:55:15,200
And uh you know you might have made a
4686
02:55:13,600 --> 02:55:18,000
mistake in one of the files you have
4687
02:55:15,200 --> 02:55:20,319
saved it as a okay. and you're not able
4688
02:55:18,000 --> 02:55:22,319
to find when and when you're using Apple
4689
02:55:20,319 --> 02:55:24,560
AB you're not able to find that actual
4690
02:55:22,319 --> 02:55:25,920
string okay then it's uh you'll be
4691
02:55:24,560 --> 02:55:27,680
wondering why you're not able to find it
4692
02:55:25,920 --> 02:55:29,520
okay then you'll realize that okay it
4693
02:55:27,680 --> 02:55:30,960
may be because the spelling that I would
4694
02:55:29,520 --> 02:55:32,800
have entered in the file it's uh that
4695
02:55:30,960 --> 02:55:35,200
might be wrong by mistake I would have
4696
02:55:32,800 --> 02:55:37,439
entered a so in that kind of a situation
4697
02:55:35,200 --> 02:55:39,840
you can use regular expressions to find
4698
02:55:37,439 --> 02:55:42,160
patterns of text in the file so you're
4699
02:55:39,840 --> 02:55:45,279
all aware of uh the pipe I spoke about
4700
02:55:42,160 --> 02:55:47,520
earlier right you can use the pipe to
4701
02:55:45,279 --> 02:55:49,600
use one operations output as the input
4702
02:55:47,520 --> 02:55:51,439
to another operation, right? So you can
4703
02:55:49,600 --> 02:55:53,840
use that and you can use the regular
4704
02:55:51,439 --> 02:55:55,520
expressions with the combination of GP.
4705
02:55:53,840 --> 02:55:58,160
Okay, with the combination of GP
4706
02:55:55,520 --> 02:56:00,399
command. So you have uh a lot of regular
4707
02:55:58,160 --> 02:56:03,359
expressions and uh the most common of
4708
02:56:00,399 --> 02:56:05,200
them are these. Okay, so the dot here it
4709
02:56:03,359 --> 02:56:06,800
basically means it can replace any
4710
02:56:05,200 --> 02:56:09,359
character. Okay, it can mean any
4711
02:56:06,800 --> 02:56:11,200
character the dot. So and then you have
4712
02:56:09,359 --> 02:56:13,920
the carrot symbol here. So the carrot
4713
02:56:11,200 --> 02:56:15,760
symbol here, it basically uh matches the
4714
02:56:13,920 --> 02:56:17,520
start of the string. Okay. Now what that
4715
02:56:15,760 --> 02:56:19,840
means is let me give you an example.
4716
02:56:17,520 --> 02:56:21,439
Supposing you're doing a cat file.xt.
4717
02:56:19,840 --> 02:56:23,439
You're looking for some kind of data
4718
02:56:21,439 --> 02:56:25,920
inside this filone.xt and you're using
4719
02:56:23,439 --> 02:56:28,160
the gp command to search this data. Cat
4720
02:56:25,920 --> 02:56:30,960
will basically list down all the uh file
4721
02:56:28,160 --> 02:56:32,720
contents. GP will search that data. And
4722
02:56:30,960 --> 02:56:34,720
how will it search? When you give a, it
4723
02:56:32,720 --> 02:56:37,200
will just display you know all the lines
4724
02:56:34,720 --> 02:56:39,120
or all the words where a is present. But
4725
02:56:37,200 --> 02:56:41,279
when you give carrot a, it means that
4726
02:56:39,120 --> 02:56:43,359
the starting of the string starts with
4727
02:56:41,279 --> 02:56:45,439
a. Supposing I have uh three different
4728
02:56:43,359 --> 02:56:47,600
lines or three different strings in my
4729
02:56:45,439 --> 02:56:52,000
uh document in my file 1.txt. Okay.
4730
02:56:47,600 --> 02:56:56,080
Supposing I have uh abc uh a fg and uh a
4731
02:56:52,000 --> 02:56:57,920
df. Okay. And if I uh give character a
4732
02:56:56,080 --> 02:56:59,840
then the result that will be out would
4733
02:56:57,920 --> 02:57:01,520
be uh given given back to me is those
4734
02:56:59,840 --> 02:57:03,359
three lines because those three lines
4735
02:57:01,520 --> 02:57:05,040
are starting with the character a. So
4736
02:57:03,359 --> 02:57:07,040
that's what this character means. It
4737
02:57:05,040 --> 02:57:09,040
matches the start of the string. Okay.
4738
02:57:07,040 --> 02:57:10,880
So that's about carrot. And similarly,
4739
02:57:09,040 --> 02:57:12,240
if you want to match something with the
4740
02:57:10,880 --> 02:57:14,080
end of the string, you can use the
4741
02:57:12,240 --> 02:57:15,920
dollar symbol. And supposing you know
4742
02:57:14,080 --> 02:57:18,080
that this particular word or string that
4743
02:57:15,920 --> 02:57:20,960
you're searching for, it ends with XT.
4744
02:57:18,080 --> 02:57:23,359
Okay, in that case, you can uh put XT
4745
02:57:20,960 --> 02:57:25,279
and then you can uh suffix that with a
4746
02:57:23,359 --> 02:57:27,439
dollar. Then all the strings in that
4747
02:57:25,279 --> 02:57:28,960
particular file uh you know which are uh
4748
02:57:27,439 --> 02:57:30,960
all the all the strings in that file
4749
02:57:28,960 --> 02:57:33,120
which are ending with XT, they will be
4750
02:57:30,960 --> 02:57:35,600
displayed. Okay, so that's how you can
4751
02:57:33,120 --> 02:57:37,840
search for data. And uh similarly if you
4752
02:57:35,600 --> 02:57:40,240
give asterk uh asteric basically means
4753
02:57:37,840 --> 02:57:42,800
that the character that is uh you know
4754
02:57:40,240 --> 02:57:44,880
preceding the preceding character is it
4755
02:57:42,800 --> 02:57:47,040
matches zero or more times. So let's
4756
02:57:44,880 --> 02:57:50,080
take an example of this. Okay. Now in
4757
02:57:47,040 --> 02:57:52,399
this case we have u in front of the
4758
02:57:50,080 --> 02:57:53,920
asterk. Okay. So the asterk basically
4759
02:57:52,399 --> 02:57:56,080
means preceding character matches zero
4760
02:57:53,920 --> 02:57:58,560
or more times. Supposing I have two
4761
02:57:56,080 --> 02:58:01,600
different strings in my file. Okay. One
4762
02:57:58,560 --> 02:58:04,080
string is abc and the second string is
4763
02:58:01,600 --> 02:58:05,760
uh d e f. So then comes the asterk.
4764
02:58:04,080 --> 02:58:07,600
Okay. So when you give asterk, it
4765
02:58:05,760 --> 02:58:10,319
basically means that the uh preceding
4766
02:58:07,600 --> 02:58:12,319
character it occurs zero or more times.
4767
02:58:10,319 --> 02:58:14,319
But uh however if you give a question
4768
02:58:12,319 --> 02:58:16,479
mark it means that the character that
4769
02:58:14,319 --> 02:58:19,760
that comes preceding before the question
4770
02:58:16,479 --> 02:58:22,160
mark that appears exactly one or it can
4771
02:58:19,760 --> 02:58:24,240
appear more times. Okay. And then you
4772
02:58:22,160 --> 02:58:26,800
have uh you know these brackets here
4773
02:58:24,240 --> 02:58:28,399
which can be used to group these regular
4774
02:58:26,800 --> 02:58:29,600
expressions. Supposing you have you know
4775
02:58:28,399 --> 02:58:31,279
more than one or two regular
4776
02:58:29,600 --> 02:58:34,240
expressions, you can use them to group
4777
02:58:31,279 --> 02:58:36,640
them. And uh again the uh backslash here
4778
02:58:34,240 --> 02:58:38,960
it represents special characters. Okay.
4779
02:58:36,640 --> 02:58:42,560
So let me uh just run a couple of
4780
02:58:38,960 --> 02:58:45,680
examples of uh this for you. Okay
4781
02:58:42,560 --> 02:58:47,120
let me go to my terminal and go to my
4782
02:58:45,680 --> 02:58:50,160
home directory. I'm going to clear the
4783
02:58:47,120 --> 02:58:52,880
screen. I'll go to
4784
02:58:50,160 --> 02:58:54,240
documents. Okay. So in here I have my
4785
02:58:52,880 --> 02:58:57,600
three different text documents.
4786
02:58:54,240 --> 02:59:02,319
Automobiles file one and file two. So if
4787
02:58:57,600 --> 02:59:05,520
I uh do cat and automobiles txt then I
4788
02:59:02,319 --> 02:59:07,520
have a list of uh all these uh strings
4789
02:59:05,520 --> 02:59:09,359
right I have a list of all the cars and
4790
02:59:07,520 --> 02:59:11,600
bikes and the different uh automobile
4791
02:59:09,359 --> 02:59:15,359
companies. So what I'm going to do is uh
4792
02:59:11,600 --> 02:59:17,200
I'm going to say cat automobiles txt and
4793
02:59:15,359 --> 02:59:20,080
I'm going to use a pipe. I'm going to
4794
02:59:17,200 --> 02:59:23,359
use a grip command to search for strings
4795
02:59:20,080 --> 02:59:25,680
starting with the letter a. Okay. So if
4796
02:59:23,359 --> 02:59:27,840
I give a then all the strings where
4797
02:59:25,680 --> 02:59:30,000
there is a present that will appear.
4798
02:59:27,840 --> 02:59:32,399
Okay. Now first let me show you without
4799
02:59:30,000 --> 02:59:34,240
the regular expression. So when I give a
4800
02:59:32,399 --> 02:59:38,880
then these are the strings where a is
4801
02:59:34,240 --> 02:59:40,880
present. Okay. Uh however if I uh give
4802
02:59:38,880 --> 02:59:42,880
rep
4803
02:59:40,880 --> 02:59:45,439
then it will list down those strings
4804
02:59:42,880 --> 02:59:47,520
where a is not present. Okay. So you
4805
02:59:45,439 --> 02:59:50,080
might see a present in these two things.
4806
02:59:47,520 --> 02:59:51,920
But the truth is it's looking for small
4807
02:59:50,080 --> 02:59:53,840
a. Okay. If you want case insensitive
4808
02:59:51,920 --> 02:59:56,399
searching then you can just use uh I
4809
02:59:53,840 --> 02:59:59,200
also all right so uh you can see as you
4810
02:59:56,399 --> 03:00:02,960
can see from here in these four strings
4811
02:59:59,200 --> 03:00:05,680
a is not present right so that kind of
4812
03:00:02,960 --> 03:00:07,600
uh searching is what we need to do so I
4813
03:00:05,680 --> 03:00:09,120
can use a regular expression to search
4814
03:00:07,600 --> 03:00:10,640
for those strings starting with a
4815
03:00:09,120 --> 03:00:13,200
particular character okay by using the
4816
03:00:10,640 --> 03:00:14,800
carrot command so in uh if you take this
4817
03:00:13,200 --> 03:00:17,760
example so these are the list of strings
4818
03:00:14,800 --> 03:00:20,479
in which a is present right so in here
4819
03:00:17,760 --> 03:00:22,800
where is a starting okay so a is
4820
03:00:20,479 --> 03:00:24,960
probably starting only in uh this one
4821
03:00:22,800 --> 03:00:26,960
particular uh string. Okay, but maybe
4822
03:00:24,960 --> 03:00:28,800
also over here but because I haven't
4823
03:00:26,960 --> 03:00:29,760
included the in case insensitive. So
4824
03:00:28,800 --> 03:00:31,920
what I'm going to do is I'm going to
4825
03:00:29,760 --> 03:00:33,840
remove this v once I'm going to print
4826
03:00:31,920 --> 03:00:36,640
it. Okay, I'll just do a control l and
4827
03:00:33,840 --> 03:00:38,399
execute it again. So now if you see uh
4828
03:00:36,640 --> 03:00:40,160
all the strings where a is present
4829
03:00:38,399 --> 03:00:43,200
whether it's a capital a or small a
4830
03:00:40,160 --> 03:00:45,760
those will be listed here. Okay. And now
4831
03:00:43,200 --> 03:00:48,479
I can use a regular expression to uh
4832
03:00:45,760 --> 03:00:51,120
basically filter out those letters or
4833
03:00:48,479 --> 03:00:53,520
those strings which are starting with a.
4834
03:00:51,120 --> 03:00:55,680
Okay. By uh specifying this command.
4835
03:00:53,520 --> 03:00:57,600
Okay. So I have to ideally get the
4836
03:00:55,680 --> 03:01:00,560
answer I should get is Aprilia Audi and
4837
03:00:57,600 --> 03:01:02,240
Amber. Okay. So when I hit enter, okay,
4838
03:01:00,560 --> 03:01:04,880
so uh there's a space here. So that's
4839
03:01:02,240 --> 03:01:06,560
the problem. And as you can see uh it
4840
03:01:04,880 --> 03:01:09,120
says that there is no string that's
4841
03:01:06,560 --> 03:01:11,040
matching with this a. Okay. Now that's
4842
03:01:09,120 --> 03:01:13,279
because I removed the hyphen. Okay. I
4843
03:01:11,040 --> 03:01:14,960
removed the hyphen I which stands for uh
4844
03:01:13,279 --> 03:01:16,640
case insensitive searching. So it
4845
03:01:14,960 --> 03:01:17,920
basically returns that uh it's not
4846
03:01:16,640 --> 03:01:19,920
returning any result here. So that
4847
03:01:17,920 --> 03:01:24,000
basically means the there was no search.
4848
03:01:19,920 --> 03:01:27,520
But however if I add hyphen I okay
4849
03:01:24,000 --> 03:01:29,359
hyphen I and enter then I will get these
4850
03:01:27,520 --> 03:01:31,680
three as my results because I've added
4851
03:01:29,359 --> 03:01:33,840
the case insensitive searching here. So
4852
03:01:31,680 --> 03:01:36,080
did you all guys get this concept here
4853
03:01:33,840 --> 03:01:37,920
of using regular expression of uh you
4854
03:01:36,080 --> 03:01:40,000
know this is carrot. Okay this matches
4855
03:01:37,920 --> 03:01:41,279
the starting of the string. Now I can do
4856
03:01:40,000 --> 03:01:43,120
something similar. I can search for the
4857
03:01:41,279 --> 03:01:44,800
end of the string. Okay. Now let's see
4858
03:01:43,120 --> 03:01:46,160
again if I use a itself and if I give
4859
03:01:44,800 --> 03:01:48,640
dollar then it will look for all the
4860
03:01:46,160 --> 03:01:51,359
strings which are ending with a. Okay.
4861
03:01:48,640 --> 03:01:54,560
So uh that's happening because of uh
4862
03:01:51,359 --> 03:01:56,319
this problem. The whole dollar a should
4863
03:01:54,560 --> 03:01:58,479
come inside brackets. Okay. I should be
4864
03:01:56,319 --> 03:02:00,640
in uh quotation marks. So that's the
4865
03:01:58,479 --> 03:02:04,080
thing. So when I do this I'm not getting
4866
03:02:00,640 --> 03:02:06,319
any result. So u similarly I can uh
4867
03:02:04,080 --> 03:02:07,760
execute another uh command. Okay. So
4868
03:02:06,319 --> 03:02:10,000
another one involving regular
4869
03:02:07,760 --> 03:02:14,160
expressions of asterric. So what I'll do
4870
03:02:10,000 --> 03:02:16,720
is I'll say gp - n let's say I want to
4871
03:02:14,160 --> 03:02:20,640
search for the character a itself. Okay.
4872
03:02:16,720 --> 03:02:22,000
So um when I say a in asterisk so it
4873
03:02:20,640 --> 03:02:23,920
when when I use this asterisk it
4874
03:02:22,000 --> 03:02:25,760
basically means zero or more occurrence
4875
03:02:23,920 --> 03:02:28,640
of a. Correct. So I'm going to search
4876
03:02:25,760 --> 03:02:30,240
for that from uh here and then I have to
4877
03:02:28,640 --> 03:02:31,920
specify the file name over here. So I'm
4878
03:02:30,240 --> 03:02:34,319
not using any cat command and I'm not
4879
03:02:31,920 --> 03:02:35,840
using a pipe to get data in over here.
4880
03:02:34,319 --> 03:02:37,600
Okay. So I'm just going to display the
4881
03:02:35,840 --> 03:02:39,600
number of times that happens by
4882
03:02:37,600 --> 03:02:41,760
specifying the file name here. I'm going
4883
03:02:39,600 --> 03:02:44,240
to say automobiles.txt. When I hit an
4884
03:02:41,760 --> 03:02:47,040
enter, I get all the occurrences where
4885
03:02:44,240 --> 03:02:50,479
zero or more times a is occurring. Okay.
4886
03:02:47,040 --> 03:02:52,080
So that is uh one aspect. And uh the
4887
03:02:50,479 --> 03:02:55,680
other command that I can show you is
4888
03:02:52,080 --> 03:02:57,680
that of respect to echo itself. So I can
4889
03:02:55,680 --> 03:03:01,120
run an echo inside flower brackets. I
4890
03:02:57,680 --> 03:03:03,600
can say a to z. Now when I print this,
4891
03:03:01,120 --> 03:03:05,200
okay, sorry there should be just uh two
4892
03:03:03,600 --> 03:03:06,880
dot symbols. So when we say two dot
4893
03:03:05,200 --> 03:03:09,680
symbols it basically fills the
4894
03:03:06,880 --> 03:03:12,160
characters the sequence of a b c a ab a
4895
03:03:09,680 --> 03:03:14,160
ab a b c e f g h uh you know the entire
4896
03:03:12,160 --> 03:03:16,080
alphabetical sequence that will happen
4897
03:03:14,160 --> 03:03:18,000
as you can see so that's because there
4898
03:03:16,080 --> 03:03:19,680
were just two dots specified but had
4899
03:03:18,000 --> 03:03:22,399
there been three this wouldn't happen
4900
03:03:19,680 --> 03:03:24,640
okay it would just display this whole uh
4901
03:03:22,399 --> 03:03:26,240
thing again so the thing you got to note
4902
03:03:24,640 --> 03:03:29,439
is that the regular expression that we
4903
03:03:26,240 --> 03:03:31,279
are using here is this one two dots okay
4904
03:03:29,439 --> 03:03:34,479
so similarly you can replace it with
4905
03:03:31,279 --> 03:03:38,399
even numbers so we can have 89 9 and you
4906
03:03:34,479 --> 03:03:40,560
can say 33. So from 33 to 89 all the
4907
03:03:38,399 --> 03:03:42,399
numbers will be uh you know the sequence
4908
03:03:40,560 --> 03:03:44,240
of the numbers will be present here. You
4909
03:03:42,399 --> 03:03:48,319
can also have a combinations like you
4910
03:03:44,240 --> 03:03:51,200
know I can have uh say p over here and I
4911
03:03:48,319 --> 03:03:54,000
can have an a over here. Yeah when I do
4912
03:03:51,200 --> 03:03:56,720
this the combination of a with all of
4913
03:03:54,000 --> 03:04:00,399
these uh numbers would be visible. So as
4914
03:03:56,720 --> 03:04:02,000
you can see so a 33 p a 34p so things
4915
03:04:00,399 --> 03:04:03,439
like that right so patterns are also
4916
03:04:02,000 --> 03:04:05,680
being generated. So that is the
4917
03:04:03,439 --> 03:04:07,680
advantage with some of these uh regular
4918
03:04:05,680 --> 03:04:10,240
expressions. Okay. So I'm just going to
4919
03:04:07,680 --> 03:04:12,800
clear the screen now and uh go on to the
4920
03:04:10,240 --> 03:04:15,840
next topic. Okay. So we are done with
4921
03:04:12,800 --> 03:04:18,960
regular expressions now. And uh this
4922
03:04:15,840 --> 03:04:21,359
takes us to the final part of uh this uh
4923
03:04:18,960 --> 03:04:23,359
Linux demonstration. Okay. This Linux
4924
03:04:21,359 --> 03:04:27,040
webinar. And here we're going to talk
4925
03:04:23,359 --> 03:04:29,840
about processes adding users and SSH.
4926
03:04:27,040 --> 03:04:32,720
All right. So let's get started. Okay.
4927
03:04:29,840 --> 03:04:35,520
So um guys processes is something that's
4928
03:04:32,720 --> 03:04:38,080
really important from the administration
4929
03:04:35,520 --> 03:04:39,760
uh perspective of Linux. Okay. Well it's
4930
03:04:38,080 --> 03:04:42,240
I mean it's basically something that's
4931
03:04:39,760 --> 03:04:43,840
necessary not more than you know uh an
4932
03:04:42,240 --> 03:04:45,600
important thing. It's was basically
4933
03:04:43,840 --> 03:04:48,080
necessary. I mean uh you should know
4934
03:04:45,600 --> 03:04:49,760
what this is and when I say processes
4935
03:04:48,080 --> 03:04:51,520
I'm pretty sure that you know that we
4936
03:04:49,760 --> 03:04:54,399
are talking about the programs or
4937
03:04:51,520 --> 03:04:56,000
instances of programs right? So uh
4938
03:04:54,399 --> 03:04:57,439
anything that you start on your uh
4939
03:04:56,000 --> 03:04:59,439
system so whether you're starting a web
4940
03:04:57,439 --> 03:05:01,840
browser or whether you're you're using a
4941
03:04:59,439 --> 03:05:04,000
media player so everything every
4942
03:05:01,840 --> 03:05:06,080
software there it will have a process
4943
03:05:04,000 --> 03:05:08,479
involved okay there can be multiple
4944
03:05:06,080 --> 03:05:10,560
instances of that particular project uh
4945
03:05:08,479 --> 03:05:13,279
supposing I'm viewing a presentation on
4946
03:05:10,560 --> 03:05:14,560
my uh computer okay supposing I'm seeing
4947
03:05:13,279 --> 03:05:16,880
five different presentations at the same
4948
03:05:14,560 --> 03:05:19,120
time I mean I can see only one at a time
4949
03:05:16,880 --> 03:05:21,359
but I can have the remaining open and I
4950
03:05:19,120 --> 03:05:23,200
can put them in the background right so
4951
03:05:21,359 --> 03:05:25,040
uh that's what we mean so the different
4952
03:05:23,200 --> 03:05:27,120
instances of that particular system can
4953
03:05:25,040 --> 03:05:28,720
also be considered as a process. So at
4954
03:05:27,120 --> 03:05:30,160
any point of time only one application
4955
03:05:28,720 --> 03:05:32,560
or only one process will be in the
4956
03:05:30,160 --> 03:05:34,960
foreground. Okay. But many such uh
4957
03:05:32,560 --> 03:05:36,720
instances of many softwares or also of
4958
03:05:34,960 --> 03:05:39,040
that particular software or program can
4959
03:05:36,720 --> 03:05:41,760
be present in the background. Okay. So
4960
03:05:39,040 --> 03:05:43,840
the example of that is uh me opening uh
4961
03:05:41,760 --> 03:05:46,160
two chrome browsers. So I can have two
4962
03:05:43,840 --> 03:05:47,520
different chrome windows and uh you know
4963
03:05:46,160 --> 03:05:49,279
one can be in the background, one can be
4964
03:05:47,520 --> 03:05:52,160
in the foreground. Okay. So similarly
4965
03:05:49,279 --> 03:05:54,160
PPTs or whether it's uh a media player
4966
03:05:52,160 --> 03:05:56,160
anything like that. So that's what a
4967
03:05:54,160 --> 03:05:58,160
process is. Okay. Now going back to
4968
03:05:56,160 --> 03:06:00,479
definition an instance of a program is
4969
03:05:58,160 --> 03:06:02,479
called a process. All right. Any command
4970
03:06:00,479 --> 03:06:04,319
given to the Linux kernel starts a new
4971
03:06:02,479 --> 03:06:06,720
process. And there can be multiple
4972
03:06:04,319 --> 03:06:08,319
processes of the same program. There can
4973
03:06:06,720 --> 03:06:10,560
be multiple processes. When we say
4974
03:06:08,319 --> 03:06:12,240
processes it basically means instances.
4975
03:06:10,560 --> 03:06:14,080
So we can have any number of instances
4976
03:06:12,240 --> 03:06:16,560
of any of your application right of
4977
03:06:14,080 --> 03:06:18,319
chrome or of VC media player of all
4978
03:06:16,560 --> 03:06:20,080
those things. You can have multiple such
4979
03:06:18,319 --> 03:06:22,000
uh instances at the same time and all
4980
03:06:20,080 --> 03:06:24,800
these instances are referred to as
4981
03:06:22,000 --> 03:06:26,880
processes. Okay, official term is
4982
03:06:24,800 --> 03:06:30,800
processes and each of those processes
4983
03:06:26,880 --> 03:06:32,399
have some process ID. Okay, so uh yeah,
4984
03:06:30,800 --> 03:06:34,160
like I told you they'll be divided into
4985
03:06:32,399 --> 03:06:35,840
two different processes. One is the
4986
03:06:34,160 --> 03:06:39,439
foreground processes and the other one
4987
03:06:35,840 --> 03:06:40,720
is the background processes. Okay, so um
4988
03:06:39,439 --> 03:06:42,080
how will you determine what are the
4989
03:06:40,720 --> 03:06:44,880
different processes that are running in
4990
03:06:42,080 --> 03:06:47,120
your uh system in Windows? You can just
4991
03:06:44,880 --> 03:06:48,880
do control altdelete and then you'll uh
4992
03:06:47,120 --> 03:06:50,240
get the list of programs, right? And you
4993
03:06:48,880 --> 03:06:52,080
can even terminate them. You can end the
4994
03:06:50,240 --> 03:06:53,920
programs from there, right? So you have
4995
03:06:52,080 --> 03:06:55,840
different tabs. So let me show you an
4996
03:06:53,920 --> 03:06:57,359
example of that. Okay. So this is my
4997
03:06:55,840 --> 03:06:59,439
Windows system. Okay. And when I do
4998
03:06:57,359 --> 03:07:01,279
control altdelete, it starts my task
4999
03:06:59,439 --> 03:07:02,880
manager and it asks me for applications
5000
03:07:01,279 --> 03:07:04,319
or processes and all these things. So
5001
03:07:02,880 --> 03:07:06,240
this is the process that I'm talking
5002
03:07:04,319 --> 03:07:07,520
about. Okay. You can have any number of
5003
03:07:06,240 --> 03:07:08,880
processes in running in your system.
5004
03:07:07,520 --> 03:07:11,279
Okay. You might not be aware of all of
5005
03:07:08,880 --> 03:07:13,040
those things. So yeah anyways uh some
5006
03:07:11,279 --> 03:07:15,120
may be started by you and some may not
5007
03:07:13,040 --> 03:07:17,439
be started by uh you right some may be
5008
03:07:15,120 --> 03:07:19,439
started uh at system boot and some of
5009
03:07:17,439 --> 03:07:21,359
those uh processes might be started by
5010
03:07:19,439 --> 03:07:23,200
you when you're running some command so
5011
03:07:21,359 --> 03:07:25,279
that's what this is so every time you
5012
03:07:23,200 --> 03:07:28,319
specify uh you know a command in the uh
5013
03:07:25,279 --> 03:07:31,040
terminal or the kernel that will boot a
5014
03:07:28,319 --> 03:07:33,600
program or a software and that will also
5015
03:07:31,040 --> 03:07:34,880
alternatively start a process okay and
5016
03:07:33,600 --> 03:07:36,800
every time you start it you will have a
5017
03:07:34,880 --> 03:07:38,720
new process defined and if you want to
5018
03:07:36,800 --> 03:07:40,240
see the list of all the processes
5019
03:07:38,720 --> 03:07:42,800
running in your system then you can use
5020
03:07:40,240 --> 03:07:44,560
this top command. Okay. And what you get
5021
03:07:42,800 --> 03:07:47,040
followed by that will be the list of
5022
03:07:44,560 --> 03:07:49,520
processes and their P ID their user
5023
03:07:47,040 --> 03:07:50,960
username their uh priority all these
5024
03:07:49,520 --> 03:07:52,479
things. So I will talk about all these
5025
03:07:50,960 --> 03:07:54,240
aspects in sometime. So let me first
5026
03:07:52,479 --> 03:07:57,200
show you the different things and how
5027
03:07:54,240 --> 03:07:59,439
they look in the uh Linux in my VM.
5028
03:07:57,200 --> 03:08:01,439
Okay. So I'm going to run here. I'm
5029
03:07:59,439 --> 03:08:03,439
going to run the top command. And when
5030
03:08:01,439 --> 03:08:05,840
you do that you can see that you have
5031
03:08:03,439 --> 03:08:08,720
something called as P ID. you have user,
5032
03:08:05,840 --> 03:08:10,240
you have uh PR, you have a whole taskbar
5033
03:08:08,720 --> 03:08:11,840
and you have with respect to which
5034
03:08:10,240 --> 03:08:13,120
software is running, which program is
5035
03:08:11,840 --> 03:08:15,040
running, what is the application name
5036
03:08:13,120 --> 03:08:17,120
and all these things. Okay, so right
5037
03:08:15,040 --> 03:08:18,800
here uh you can't probably see anything
5038
03:08:17,120 --> 03:08:20,800
that I have created on my own. Okay,
5039
03:08:18,800 --> 03:08:23,760
except for this uh virtual box client
5040
03:08:20,800 --> 03:08:25,359
and maybe the terminal. Okay, but if you
5041
03:08:23,760 --> 03:08:27,359
want me to create one, then I can also
5042
03:08:25,359 --> 03:08:30,000
create one. So what I'll do is I can
5043
03:08:27,359 --> 03:08:32,800
just uh end this here by pressing Ctrl
5044
03:08:30,000 --> 03:08:35,200
C. I can get out of this uh top and what
5045
03:08:32,800 --> 03:08:36,720
I'll do is I'll create a Firefox
5046
03:08:35,200 --> 03:08:38,800
instance. Okay. So Mozilla Firefox is
5047
03:08:36,720 --> 03:08:42,080
installed in my system and through my uh
5048
03:08:38,800 --> 03:08:44,800
terminal I will start Firefox. Okay.
5049
03:08:42,080 --> 03:08:47,520
When I hit enter my Firefox has been
5050
03:08:44,800 --> 03:08:49,840
initiated. Okay. See now I did not make
5051
03:08:47,520 --> 03:08:51,840
any change. Okay. I did not touch the
5052
03:08:49,840 --> 03:08:53,840
Firefox icon but instead of that on its
5053
03:08:51,840 --> 03:08:55,920
own Mozilla Firefox opened. That is
5054
03:08:53,840 --> 03:08:58,160
because I hit Firefox and I put enter in
5055
03:08:55,920 --> 03:09:00,399
the terminal. So when I did that the uh
5056
03:08:58,160 --> 03:09:02,240
Firefox opened. Okay. Now I can just
5057
03:09:00,399 --> 03:09:03,760
minimize this and if you go back to the
5058
03:09:02,240 --> 03:09:05,520
terminal you'll see that I'm still
5059
03:09:03,760 --> 03:09:06,800
inside uh you know the terminal is
5060
03:09:05,520 --> 03:09:08,560
assuming that I'm still working on
5061
03:09:06,800 --> 03:09:10,479
Firefox. Okay, I've still not ended
5062
03:09:08,560 --> 03:09:12,000
Firefox over there. So when I uh when I
5063
03:09:10,479 --> 03:09:14,000
close Firefox that's when I'll come out
5064
03:09:12,000 --> 03:09:16,720
of the terminal over here. But instead
5065
03:09:14,000 --> 03:09:20,240
of doing all that I can simply do Ctrl Z
5066
03:09:16,720 --> 03:09:21,920
or control W. Okay. When I do Ctrl Z it
5067
03:09:20,240 --> 03:09:24,000
means that I'm stopping my Firefox
5068
03:09:21,920 --> 03:09:26,000
instance. Okay. So whatever Firefox
5069
03:09:24,000 --> 03:09:27,520
browser that was open that is stopped.
5070
03:09:26,000 --> 03:09:28,960
The process however would not be
5071
03:09:27,520 --> 03:09:30,960
stopped. the process would be running in
5072
03:09:28,960 --> 03:09:32,479
the background. Okay, now supposing I
5073
03:09:30,960 --> 03:09:35,120
want to push it, if I want to bring it
5074
03:09:32,479 --> 03:09:38,080
to the foreground, I can just say FG and
5075
03:09:35,120 --> 03:09:40,640
I can give uh Firefox. Okay, this will
5076
03:09:38,080 --> 03:09:42,479
again uh initiate Firefox for me. But
5077
03:09:40,640 --> 03:09:43,920
otherwise, I can just uh you know close
5078
03:09:42,479 --> 03:09:47,040
it and I can push it also to the
5079
03:09:43,920 --> 03:09:49,200
background. I can say bg and I can say
5080
03:09:47,040 --> 03:09:50,960
Firefox and if I give enter then my
5081
03:09:49,200 --> 03:09:53,680
Firefox has been pushed to the
5082
03:09:50,960 --> 03:09:56,080
background. So now uh what I'll do is
5083
03:09:53,680 --> 03:09:58,479
let me run that top command again. And
5084
03:09:56,080 --> 03:10:00,560
if you see over here the Firefox was not
5085
03:09:58,479 --> 03:10:02,240
visible. Okay. But since I started and
5086
03:10:00,560 --> 03:10:04,080
pushed my Firefox to the background and
5087
03:10:02,240 --> 03:10:06,479
all since I've done all these things, my
5088
03:10:04,080 --> 03:10:09,200
Firefox will be visible in this list of
5089
03:10:06,479 --> 03:10:10,560
processes. Okay. Now seems like I've
5090
03:10:09,200 --> 03:10:13,680
sent it to the background, right? So
5091
03:10:10,560 --> 03:10:16,640
that's why it's not coming. So let me uh
5092
03:10:13,680 --> 03:10:18,399
hit Firefox again. And it's opened the
5093
03:10:16,640 --> 03:10:20,080
uh terminal now. And what I'm going to
5094
03:10:18,399 --> 03:10:21,279
do is uh of course it's in the
5095
03:10:20,080 --> 03:10:24,000
background. So I'm going to run the top
5096
03:10:21,279 --> 03:10:26,960
command again and show you that Firefox
5097
03:10:24,000 --> 03:10:28,960
is here. Uh so we have the Firefox here,
5098
03:10:26,960 --> 03:10:31,520
right? As you can see there's a Firefox
5099
03:10:28,960 --> 03:10:33,760
process that of course keeps moving up
5100
03:10:31,520 --> 03:10:37,439
and down and uh it's all sorted by the
5101
03:10:33,760 --> 03:10:40,560
priority that each process has. Okay. So
5102
03:10:37,439 --> 03:10:42,800
u yeah so every single uh instance or
5103
03:10:40,560 --> 03:10:44,560
every single program or application that
5104
03:10:42,800 --> 03:10:46,399
you start right so they will be started
5105
03:10:44,560 --> 03:10:48,000
in this way and they will have a process
5106
03:10:46,399 --> 03:10:49,760
ID associated with them. they will have
5107
03:10:48,000 --> 03:10:50,960
the time for how long they've been
5108
03:10:49,760 --> 03:10:52,560
instantiated. They'll have the CPU
5109
03:10:50,960 --> 03:10:54,240
memory they're using, the virtual memory
5110
03:10:52,560 --> 03:10:56,000
they're using, uh, and all these things.
5111
03:10:54,240 --> 03:10:58,399
Okay, so let me explain each of these
5112
03:10:56,000 --> 03:11:00,479
things by going to my slide first. So if
5113
03:10:58,399 --> 03:11:02,160
I go back to my slides, okay, as you can
5114
03:11:00,479 --> 03:11:04,319
see here, these are the different blocks
5115
03:11:02,160 --> 03:11:06,880
that you saw earlier. Okay, on the uh
5116
03:11:04,319 --> 03:11:08,800
terminal. So the first P ID stands for
5117
03:11:06,880 --> 03:11:10,319
the process ID. So each process that is
5118
03:11:08,800 --> 03:11:12,800
initiated, which will have a unique
5119
03:11:10,319 --> 03:11:14,560
process ID, okay, and the user here is
5120
03:11:12,800 --> 03:11:17,279
uh the name of the user who started that
5121
03:11:14,560 --> 03:11:19,200
process. And PR is uh refers to the
5122
03:11:17,279 --> 03:11:21,760
priority of that process because uh
5123
03:11:19,200 --> 03:11:23,680
every process that is running in your uh
5124
03:11:21,760 --> 03:11:25,200
Linux it'll have a priority associated
5125
03:11:23,680 --> 03:11:26,960
with that. Okay. And the greatest
5126
03:11:25,200 --> 03:11:28,800
priority process is what will be
5127
03:11:26,960 --> 03:11:31,200
executed first and that'll be executed
5128
03:11:28,800 --> 03:11:32,720
at the top. And then so along with the
5129
03:11:31,200 --> 03:11:35,359
priority of that process you have the
5130
03:11:32,720 --> 03:11:37,359
niceness value. So niceness value is
5131
03:11:35,359 --> 03:11:40,080
again you know the value ranges from
5132
03:11:37,359 --> 03:11:42,560
minus 20 to + 20 and even the priority
5133
03:11:40,080 --> 03:11:45,439
value it varies from minus 20 to + 20.
5134
03:11:42,560 --> 03:11:47,359
Okay. So basically the nicest value is
5135
03:11:45,439 --> 03:11:49,279
uh somewhere it's opposite to priority.
5136
03:11:47,359 --> 03:11:51,359
Okay. So the lesser the nice value the
5137
03:11:49,279 --> 03:11:53,600
greater will be the priority of your uh
5138
03:11:51,359 --> 03:11:55,840
process. You can also manually set the
5139
03:11:53,600 --> 03:11:56,880
niceness value of your uh process to
5140
03:11:55,840 --> 03:11:58,960
increase the priority if you want to
5141
03:11:56,880 --> 03:12:01,279
give a particular uh program or a
5142
03:11:58,960 --> 03:12:02,640
particular process more priority. Then
5143
03:12:01,279 --> 03:12:04,880
you can probably decrease the niceness
5144
03:12:02,640 --> 03:12:06,720
value and uh that will lead to the
5145
03:12:04,880 --> 03:12:08,240
increase in priority on its own. So
5146
03:12:06,720 --> 03:12:11,200
that's what this is. And then after that
5147
03:12:08,240 --> 03:12:13,600
you have uh this VRT block. Okay. So VRT
5148
03:12:11,200 --> 03:12:16,160
stands for virtual memory. RS stands for
5149
03:12:13,600 --> 03:12:19,439
the physical memory. SSR stands for the
5150
03:12:16,160 --> 03:12:22,160
shared memory. S is the status of the uh
5151
03:12:19,439 --> 03:12:23,520
process. So that's what S is. So S
5152
03:12:22,160 --> 03:12:25,520
speaks about the status of that
5153
03:12:23,520 --> 03:12:27,520
particular process. Okay. And then
5154
03:12:25,520 --> 03:12:29,840
percentage CPU is it is about the
5155
03:12:27,520 --> 03:12:31,600
percentage of the CPU time. Okay. And
5156
03:12:29,840 --> 03:12:33,920
percentage of the memory of the physical
5157
03:12:31,600 --> 03:12:36,640
memory that's being used. Okay. And then
5158
03:12:33,920 --> 03:12:39,200
you have the time block which uh refers
5159
03:12:36,640 --> 03:12:40,800
to the total CPU time that this process
5160
03:12:39,200 --> 03:12:42,880
has been running for. And then finally
5161
03:12:40,800 --> 03:12:44,080
you have the command. Okay. And then f
5162
03:12:42,880 --> 03:12:46,720
and then after the command you'll have
5163
03:12:44,080 --> 03:12:49,359
the process that is uh actually running.
5164
03:12:46,720 --> 03:12:51,600
Okay. So um let me just quickly go back
5165
03:12:49,359 --> 03:12:53,359
to my thing here. So the command is
5166
03:12:51,600 --> 03:12:56,080
basically the uh application that's
5167
03:12:53,359 --> 03:12:57,520
running. Okay. So yeah that's about the
5168
03:12:56,080 --> 03:13:00,000
different processes. I'm just going to
5169
03:12:57,520 --> 03:13:02,640
end this uh top by giving uh control
5170
03:13:00,000 --> 03:13:04,960
zed. When I give control z uh this stops
5171
03:13:02,640 --> 03:13:08,479
and I can just clear my screen. So
5172
03:13:04,960 --> 03:13:10,399
that's about my processes. Okay. Now uh
5173
03:13:08,479 --> 03:13:11,920
I showed you how the top command works.
5174
03:13:10,399 --> 03:13:14,479
Okay. Now along with that if you want to
5175
03:13:11,920 --> 03:13:17,200
see the list of all the uh processes
5176
03:13:14,479 --> 03:13:19,439
that are running okay then you can see
5177
03:13:17,200 --> 03:13:22,399
that by running this command ps uh
5178
03:13:19,439 --> 03:13:25,359
hyphen uh space ux or uh you can do this
5179
03:13:22,399 --> 03:13:27,120
or you can even run ps- p. So when you
5180
03:13:25,359 --> 03:13:28,960
do that you will only get the list of
5181
03:13:27,120 --> 03:13:30,720
processes that are uh you know being
5182
03:13:28,960 --> 03:13:33,359
started by you. Okay. So you're the user
5183
03:13:30,720 --> 03:13:35,439
I'm the user and my name is Eda right?
5184
03:13:33,359 --> 03:13:37,279
So all the uh processes which I have
5185
03:13:35,439 --> 03:13:39,760
started right. So all my processes will
5186
03:13:37,279 --> 03:13:41,359
be visible. Of course uh uh the other
5187
03:13:39,760 --> 03:13:43,279
user's process will not be visible to
5188
03:13:41,359 --> 03:13:45,920
me. It will be only visible for him.
5189
03:13:43,279 --> 03:13:49,600
Okay. So I can also give uh P ID
5190
03:13:45,920 --> 03:13:51,840
otherwise PS I okay the PS UX it
5191
03:13:49,600 --> 03:13:54,479
basically displays the process that you
5192
03:13:51,840 --> 03:13:55,520
have started. Okay. So you any any
5193
03:13:54,479 --> 03:13:57,520
program or anything that you have
5194
03:13:55,520 --> 03:13:58,720
started that you can uh see it here. You
5195
03:13:57,520 --> 03:13:59,840
can see you know what is the percentage
5196
03:13:58,720 --> 03:14:01,279
of the memory that's being used because
5197
03:13:59,840 --> 03:14:03,279
of that process. What is the process ID
5198
03:14:01,279 --> 03:14:06,479
for that particular process and all
5199
03:14:03,279 --> 03:14:08,800
these things. Okay. So uh similarly if
5200
03:14:06,479 --> 03:14:11,200
you have uh you know anything else. So
5201
03:14:08,800 --> 03:14:12,319
that's what uh this command does. Okay.
5202
03:14:11,200 --> 03:14:14,720
The next thing that I want to tell you
5203
03:14:12,319 --> 03:14:17,200
is that of finding the p of a particular
5204
03:14:14,720 --> 03:14:19,120
uh process. So you know that we've
5205
03:14:17,200 --> 03:14:20,800
started uh a particular process. Okay.
5206
03:14:19,120 --> 03:14:22,800
We started the Firefox process that
5207
03:14:20,800 --> 03:14:24,800
time. And what I can do is I can find
5208
03:14:22,800 --> 03:14:28,160
out the uh P of that particular process
5209
03:14:24,800 --> 03:14:29,520
by giving this command P off and uh what
5210
03:14:28,160 --> 03:14:30,880
is the name of the process? Uh so in my
5211
03:14:29,520 --> 03:14:33,200
case it's Firefox. So I'm just going to
5212
03:14:30,880 --> 03:14:35,120
give P off and Firefox. That will give
5213
03:14:33,200 --> 03:14:37,279
me the P ID of that particular uh
5214
03:14:35,120 --> 03:14:40,880
process 5836.
5215
03:14:37,279 --> 03:14:42,160
Okay, I'm going to clear screen. Okay,
5216
03:14:40,880 --> 03:14:44,479
I'm going to run the process again.
5217
03:14:42,160 --> 03:14:46,960
Okay, I'm going to start Firefox again.
5218
03:14:44,479 --> 03:14:49,040
And when I do this, there is a new
5219
03:14:46,960 --> 03:14:51,040
instance of Firefox that starts. Okay,
5220
03:14:49,040 --> 03:14:54,000
so a new process would have started by
5221
03:14:51,040 --> 03:14:56,720
now. And uh when I just give control Z,
5222
03:14:54,000 --> 03:15:00,239
I'm kind of stopping my process. And uh
5223
03:14:56,720 --> 03:15:02,000
now if I give ps- ux then you can see
5224
03:15:00,239 --> 03:15:04,319
here that there's a new firefox process
5225
03:15:02,000 --> 03:15:07,680
that starts that's running. Okay the ID
5226
03:15:04,319 --> 03:15:11,279
is 660. Okay you can verify that by also
5227
03:15:07,680 --> 03:15:15,120
giving uh by seeing what is the answer
5228
03:15:11,279 --> 03:15:19,120
that I get f P I of Firefox. When I do
5229
03:15:15,120 --> 03:15:21,200
this I get 660. So that is uh what this
5230
03:15:19,120 --> 03:15:23,840
is all about. Okay. And if you see the
5231
03:15:21,200 --> 03:15:25,760
status it's also showing as TL. Okay.
5232
03:15:23,840 --> 03:15:28,640
This means that I've uh terminated that
5233
03:15:25,760 --> 03:15:32,080
process. Okay. So process of Firefox has
5234
03:15:28,640 --> 03:15:34,720
been instantiated. It has a P of 660.
5235
03:15:32,080 --> 03:15:36,960
Okay. And uh you know if I want to kill
5236
03:15:34,720 --> 03:15:40,960
this process then I can give the command
5237
03:15:36,960 --> 03:15:42,479
kill 60060. All right. Great. So that's
5238
03:15:40,960 --> 03:15:44,960
about the different process that I want
5239
03:15:42,479 --> 03:15:47,040
to talk to you about. Okay. So um what's
5240
03:15:44,960 --> 03:15:49,359
next is uh let me go back to the slides
5241
03:15:47,040 --> 03:15:52,560
and talk about the next topic. All
5242
03:15:49,359 --> 03:15:54,160
right. So I spoke about uh processes
5243
03:15:52,560 --> 03:15:57,279
here.
5244
03:15:54,160 --> 03:15:58,960
And uh the next topic is uh this is the
5245
03:15:57,279 --> 03:16:01,840
penalty topic actually and I'm going to
5246
03:15:58,960 --> 03:16:04,000
tell you how to create your own users.
5247
03:16:01,840 --> 03:16:06,960
So you can uh create users by this
5248
03:16:04,000 --> 03:16:08,960
command simply saying uh sudo user ad
5249
03:16:06,960 --> 03:16:10,479
and the username. Okay. If you want to
5250
03:16:08,960 --> 03:16:13,279
set password to that person then you got
5251
03:16:10,479 --> 03:16:14,800
to say password and uh the username of
5252
03:16:13,279 --> 03:16:16,800
that password and then it'll prompt you
5253
03:16:14,800 --> 03:16:17,840
to set a password for that person. And
5254
03:16:16,800 --> 03:16:20,160
similarly if you want to delete that
5255
03:16:17,840 --> 03:16:22,239
particular user you can say user delete
5256
03:16:20,160 --> 03:16:24,720
and then uh the name of that username
5257
03:16:22,239 --> 03:16:26,560
whichever you want to delete. Okay. Uh
5258
03:16:24,720 --> 03:16:28,239
but one thing is that you got to always
5259
03:16:26,560 --> 03:16:29,920
use pseudo before that because uh these
5260
03:16:28,239 --> 03:16:31,920
commands cannot be executed by users
5261
03:16:29,920 --> 03:16:34,000
like us. Okay. We need root access for
5262
03:16:31,920 --> 03:16:36,000
that. We need only root users who have
5263
03:16:34,000 --> 03:16:37,760
super user permissions can do this. So
5264
03:16:36,000 --> 03:16:40,160
that's why we use pseudo and we enter
5265
03:16:37,760 --> 03:16:42,000
the password for it. Okay. Now one thing
5266
03:16:40,160 --> 03:16:44,319
you need to note is that when a user is
5267
03:16:42,000 --> 03:16:46,479
created then by default he's also added
5268
03:16:44,319 --> 03:16:47,920
to a particular group. Okay. There'll be
5269
03:16:46,479 --> 03:16:50,000
sometimes there'll be a default group to
5270
03:16:47,920 --> 03:16:51,680
which that person will be added. And if
5271
03:16:50,000 --> 03:16:53,279
you want to add a user to a particular
5272
03:16:51,680 --> 03:16:55,600
group, then you can uh just do that by
5273
03:16:53,279 --> 03:16:59,120
using the user mod command. Okay, you
5274
03:16:55,600 --> 03:17:00,640
can say user mod G uh G represents the
5275
03:16:59,120 --> 03:17:02,800
group and then you can say the group
5276
03:17:00,640 --> 03:17:04,720
name and the username. So the group name
5277
03:17:02,800 --> 03:17:06,880
that you want to set and followed by the
5278
03:17:04,720 --> 03:17:08,239
username of uh that particular person.
5279
03:17:06,880 --> 03:17:09,680
Suppose you want to add your own groups
5280
03:17:08,239 --> 03:17:11,120
then you can do that by group add and
5281
03:17:09,680 --> 03:17:12,640
group name and then if you want to
5282
03:17:11,120 --> 03:17:14,399
delete them it's again the same thing.
5283
03:17:12,640 --> 03:17:15,920
Okay, after this process then again you
5284
03:17:14,399 --> 03:17:17,520
can uh assign them a different group.
5285
03:17:15,920 --> 03:17:19,760
Okay, so let me just show it to you on
5286
03:17:17,520 --> 03:17:22,080
my terminal. Okay. So the first command
5287
03:17:19,760 --> 03:17:24,000
is adding a user right. So before
5288
03:17:22,080 --> 03:17:27,359
anything let me just go to system go to
5289
03:17:24,000 --> 03:17:30,720
administration and uh user in groups it
5290
03:17:27,359 --> 03:17:32,800
asks for a password. Okay I'm g okay
5291
03:17:30,720 --> 03:17:35,200
when you go there you see that there are
5292
03:17:32,800 --> 03:17:37,040
two users currently. So Edka and Uzi. So
5293
03:17:35,200 --> 03:17:39,359
these are the two users and in groups
5294
03:17:37,040 --> 03:17:41,600
again there are Eda and Uzi. So there
5295
03:17:39,359 --> 03:17:43,120
are two groups here also. Now if I want
5296
03:17:41,600 --> 03:17:44,640
to add users I can add it from here.
5297
03:17:43,120 --> 03:17:46,080
Okay. I can just I can click on add user
5298
03:17:44,640 --> 03:17:47,439
and I can give the username. I can give
5299
03:17:46,080 --> 03:17:49,760
the full name, password and all these
5300
03:17:47,439 --> 03:17:51,760
things from the GUI. But you know the
5301
03:17:49,760 --> 03:17:54,479
CLI is a more simpler version where I
5302
03:17:51,760 --> 03:17:58,239
can just supply a command. Okay. So I'm
5303
03:17:54,479 --> 03:18:00,319
going to say user ad space uh I can give
5304
03:17:58,239 --> 03:18:02,479
the name of the user. So if I want to
5305
03:18:00,319 --> 03:18:05,600
create a user for myself, okay, I can uh
5306
03:18:02,479 --> 03:18:06,880
give this name user user ad B. Okay, but
5307
03:18:05,600 --> 03:18:08,640
of course it's not going to work because
5308
03:18:06,880 --> 03:18:10,319
it would say we need pseudo access
5309
03:18:08,640 --> 03:18:14,080
permission denied. Right? So what I'll
5310
03:18:10,319 --> 03:18:16,479
do is I'll u give pseudo access. It asks
5311
03:18:14,080 --> 03:18:17,600
for the root password and when you give
5312
03:18:16,479 --> 03:18:19,200
the password you don't have any
5313
03:18:17,600 --> 03:18:20,720
arguments. So that means your user has
5314
03:18:19,200 --> 03:18:23,279
been created successfully. So if you go
5315
03:18:20,720 --> 03:18:25,359
back to system and administration and if
5316
03:18:23,279 --> 03:18:27,120
you go to uh user and groups you'll find
5317
03:18:25,359 --> 03:18:30,560
that there's a new user that's added and
5318
03:18:27,120 --> 03:18:32,880
the user ID is 5.2. Okay. Now let me
5319
03:18:30,560 --> 03:18:34,479
just minimize this for now. Uh similarly
5320
03:18:32,880 --> 03:18:36,080
if you want to set a password for this
5321
03:18:34,479 --> 03:18:37,200
user because right now it might not have
5322
03:18:36,080 --> 03:18:38,640
a password and if you want to set a
5323
03:18:37,200 --> 03:18:41,760
password then you got to run this
5324
03:18:38,640 --> 03:18:43,840
command pseudo password and the
5325
03:18:41,760 --> 03:18:46,000
username. username is uh var. So I'm
5326
03:18:43,840 --> 03:18:47,200
going to do this. Hit an enter. It'll
5327
03:18:46,000 --> 03:18:48,960
say changing the new password for the
5328
03:18:47,200 --> 03:18:52,479
user. Okay. And uh let's say the new
5329
03:18:48,960 --> 03:18:54,960
password is uh this. And it'll say
5330
03:18:52,479 --> 03:18:57,840
retype the new password. I can give it
5331
03:18:54,960 --> 03:18:59,840
here. And then the tokens are updated
5332
03:18:57,840 --> 03:19:01,920
successfully. Okay, password is updated
5333
03:18:59,840 --> 03:19:03,840
successfully. So that's what uh this is
5334
03:19:01,920 --> 03:19:06,399
all about. So if I go back to this uh
5335
03:19:03,840 --> 03:19:07,840
user window and if I click on ven then
5336
03:19:06,399 --> 03:19:09,359
you'll know that uh there's a password
5337
03:19:07,840 --> 03:19:11,439
that's been added over here. Okay, this
5338
03:19:09,359 --> 03:19:12,800
is what I added from here. And you'll
5339
03:19:11,439 --> 03:19:13,920
also notice that there's a new home
5340
03:19:12,800 --> 03:19:17,359
directory that's created for that
5341
03:19:13,920 --> 03:19:19,120
person. So all these things right. Uh so
5342
03:19:17,359 --> 03:19:21,359
that's about creating a user. Suppose
5343
03:19:19,120 --> 03:19:24,000
you want to create a new group then uh
5344
03:19:21,359 --> 03:19:27,439
how will you do it? Uh similarly just
5345
03:19:24,000 --> 03:19:30,479
say group
5346
03:19:27,439 --> 03:19:32,720
add. So I'm going to say uh pseudo and
5347
03:19:30,479 --> 03:19:34,880
then enter this. So the group has been
5348
03:19:32,720 --> 03:19:37,279
added successfully. And if I go back to
5349
03:19:34,880 --> 03:19:40,319
it's under system under administration
5350
03:19:37,279 --> 03:19:42,239
under users and groups if I go to groups
5351
03:19:40,319 --> 03:19:44,479
now even inst is something that's
5352
03:19:42,239 --> 03:19:46,800
created. So this van is something that
5353
03:19:44,479 --> 03:19:48,560
got created now because as and when you
5354
03:19:46,800 --> 03:19:50,720
create a new user right when you create
5355
03:19:48,560 --> 03:19:52,720
a user without uh you know by specifying
5356
03:19:50,720 --> 03:19:55,040
any any group then automatically is
5357
03:19:52,720 --> 03:19:56,479
added to a group. So a group is created
5358
03:19:55,040 --> 03:19:58,319
automatically when a user is created and
5359
03:19:56,479 --> 03:20:00,239
it is the same as the username. So
5360
03:19:58,319 --> 03:20:01,920
that's how this got created. But anyways
5361
03:20:00,239 --> 03:20:04,399
this is the new group. So I'm just going
5362
03:20:01,920 --> 03:20:06,399
to do Ctrl L and uh same way if you want
5363
03:20:04,399 --> 03:20:09,120
to delete any users uh it's again a very
5364
03:20:06,399 --> 03:20:11,920
simple process you can just do a pseudo
5365
03:20:09,120 --> 03:20:14,960
and uh user delete and the name of that
5366
03:20:11,920 --> 03:20:17,279
user okay if I want to delete Van then I
5367
03:20:14,960 --> 03:20:18,640
can uh do this yeah so I'm not able to
5368
03:20:17,279 --> 03:20:20,880
delete it right now because Van is
5369
03:20:18,640 --> 03:20:23,520
currently logged in so if I just log off
5370
03:20:20,880 --> 03:20:25,359
from this VM and if I uh log in as van
5371
03:20:23,520 --> 03:20:27,040
and log out from there and then as a
5372
03:20:25,359 --> 03:20:29,359
root if I execute this command then I
5373
03:20:27,040 --> 03:20:31,200
would be able to uh delete this uh user
5374
03:20:29,359 --> 03:20:32,720
and the command is is very simple Simple
5375
03:20:31,200 --> 03:20:35,040
this is the command and you can all try
5376
03:20:32,720 --> 03:20:37,840
it at home. All right. And similarly if
5377
03:20:35,040 --> 03:20:41,200
you want to delete any group u again the
5378
03:20:37,840 --> 03:20:43,600
uh command is uh simple it's uh group
5379
03:20:41,200 --> 03:20:46,880
delete and then the name of the group
5380
03:20:43,600 --> 03:20:48,479
that is uh ins which I created. So if
5381
03:20:46,880 --> 03:20:51,439
you do this the group has been deleted
5382
03:20:48,479 --> 03:20:54,000
now. Okay. Yeah as you can see now inc
5383
03:20:51,439 --> 03:20:55,600
is not visible. Okay. So that was uh the
5384
03:20:54,000 --> 03:20:57,520
previous window I hadn't refreshed it.
5385
03:20:55,600 --> 03:20:58,880
So now if you see inc is deleted. So
5386
03:20:57,520 --> 03:21:00,960
that's how you delete the group and
5387
03:20:58,880 --> 03:21:03,040
that's how you uh delete a user. All
5388
03:21:00,960 --> 03:21:04,960
right. So that's that brings us to an
5389
03:21:03,040 --> 03:21:08,319
end uh to this topic. So I'm just going
5390
03:21:04,960 --> 03:21:10,720
to clear the screen and u what I can do
5391
03:21:08,319 --> 03:21:13,359
is I can just uh go back to my slides
5392
03:21:10,720 --> 03:21:16,080
and get started with this final uh slide
5393
03:21:13,359 --> 03:21:18,399
of mine. So guys uh this is the last
5394
03:21:16,080 --> 03:21:21,359
topic for today that is the the secure
5395
03:21:18,399 --> 03:21:24,239
shell. Okay, it's also called the SSH
5396
03:21:21,359 --> 03:21:26,880
and this is for gaining remote access of
5397
03:21:24,239 --> 03:21:28,640
a system. Okay. So uh you can get access
5398
03:21:26,880 --> 03:21:30,319
to a system which is remotely located.
5399
03:21:28,640 --> 03:21:32,000
So without you physically accessing that
5400
03:21:30,319 --> 03:21:34,800
system you can get access through this
5401
03:21:32,000 --> 03:21:36,479
SSH server. Okay. So that's what the SSH
5402
03:21:34,800 --> 03:21:38,560
does. Okay. It's called secure shell.
5403
03:21:36,479 --> 03:21:41,279
The connection is called uh secure shell
5404
03:21:38,560 --> 03:21:43,120
connection. So uh all the other topics
5405
03:21:41,279 --> 03:21:45,040
in this uh session right today's session
5406
03:21:43,120 --> 03:21:48,000
they were all basic stuff which any user
5407
03:21:45,040 --> 03:21:49,200
could learn. But uh this one this SSH is
5408
03:21:48,000 --> 03:21:51,359
something a little it's a little
5409
03:21:49,200 --> 03:21:53,520
advanced and this is and this is with
5410
03:21:51,359 --> 03:21:54,800
respect to networking. Okay. You know
5411
03:21:53,520 --> 03:21:57,040
it's a thing that people would look
5412
03:21:54,800 --> 03:21:58,640
forward to. Okay. So, if it's uh you
5413
03:21:57,040 --> 03:22:00,160
know, if you guys are waiting for a long
5414
03:21:58,640 --> 03:22:01,520
time and if you're feeling bored in the
5415
03:22:00,160 --> 03:22:03,200
session, then uh this is something
5416
03:22:01,520 --> 03:22:04,319
that's going to be a little more fun.
5417
03:22:03,200 --> 03:22:05,600
You're going to do something real time
5418
03:22:04,319 --> 03:22:07,920
and you're going to see something
5419
03:22:05,600 --> 03:22:10,479
incredible happen here, okay? By pinging
5420
03:22:07,920 --> 03:22:12,319
and accessing some other machine. So,
5421
03:22:10,479 --> 03:22:14,479
first of all, how does secure shell
5422
03:22:12,319 --> 03:22:16,239
work? So, we have two different uh
5423
03:22:14,479 --> 03:22:18,080
systems, right? But in my case, it'll be
5424
03:22:16,239 --> 03:22:19,680
two different VMs. And uh in general,
5425
03:22:18,080 --> 03:22:21,439
it'll be two different uh systems which
5426
03:22:19,680 --> 03:22:24,160
are remotely located. And you can get
5427
03:22:21,439 --> 03:22:26,560
access to them by the help of this SSH.
5428
03:22:24,160 --> 03:22:29,200
And uh how is that possible? By setting
5429
03:22:26,560 --> 03:22:31,600
the IP address and all those things,
5430
03:22:29,200 --> 03:22:33,279
right? You set the IP address and in two
5431
03:22:31,600 --> 03:22:35,040
different places. You set one system as
5432
03:22:33,279 --> 03:22:37,600
the master and you set the other system
5433
03:22:35,040 --> 03:22:39,359
as the slave and uh you basically what
5434
03:22:37,600 --> 03:22:42,080
you do is you have something called as
5435
03:22:39,359 --> 03:22:43,840
the ATC hosts. Okay. So you go to this
5436
03:22:42,080 --> 03:22:45,760
uh file and you set the master and the
5437
03:22:43,840 --> 03:22:48,160
slave IPs over here. Okay. You'll have
5438
03:22:45,760 --> 03:22:50,239
to set up this IP for uh the master and
5439
03:22:48,160 --> 03:22:52,239
this IP for the slave machine. And then
5440
03:22:50,239 --> 03:22:54,399
you can do the if config or the IP adder
5441
03:22:52,239 --> 03:22:56,399
show to list down the uh IP address of
5442
03:22:54,399 --> 03:22:58,080
that particular machine. So if it's uh
5443
03:22:56,399 --> 03:22:59,920
something other than what you want to
5444
03:22:58,080 --> 03:23:01,920
set then you can just uh do that by
5445
03:22:59,920 --> 03:23:04,000
deleting the existing IP table running
5446
03:23:01,920 --> 03:23:05,840
this command in both the machines and
5447
03:23:04,000 --> 03:23:07,600
then to add an IP address to that
5448
03:23:05,840 --> 03:23:10,000
machine you can run this command. So to
5449
03:23:07,600 --> 03:23:12,800
IP adder add and the IP address you want
5450
03:23:10,000 --> 03:23:14,720
to add. Okay. So remember to uh set the
5451
03:23:12,800 --> 03:23:16,479
mask for that and when you enter this
5452
03:23:14,720 --> 03:23:18,080
command this particular IP address will
5453
03:23:16,479 --> 03:23:19,600
be set for that particular node. Okay.
5454
03:23:18,080 --> 03:23:22,319
So that will be the master's node and
5455
03:23:19,600 --> 03:23:24,080
set this IP address for the slave node.
5456
03:23:22,319 --> 03:23:25,600
Okay, the command will be the same but
5457
03:23:24,080 --> 03:23:27,680
before that you got to delete the IP
5458
03:23:25,600 --> 03:23:30,239
address the existing one by this command
5459
03:23:27,680 --> 03:23:32,160
and then add the new IP address uh at
5460
03:23:30,239 --> 03:23:34,720
the slave end with this command and then
5461
03:23:32,160 --> 03:23:37,040
uh simply just type SSH master or SSH
5462
03:23:34,720 --> 03:23:38,560
slave. Okay. So when you do that uh your
5463
03:23:37,040 --> 03:23:40,000
secure connection would be established
5464
03:23:38,560 --> 03:23:41,200
and you if you see the username then
5465
03:23:40,000 --> 03:23:43,520
you'll realize that okay you're logged
5466
03:23:41,200 --> 03:23:45,200
in into the different uh system. Okay.
5467
03:23:43,520 --> 03:23:47,200
Uh that's what I want to show you now
5468
03:23:45,200 --> 03:23:49,120
and that's what I'm going to uh do it.
5469
03:23:47,200 --> 03:23:50,800
But before that you might have uh some
5470
03:23:49,120 --> 03:23:52,960
problems like firewalls and stuff for
5471
03:23:50,800 --> 03:23:54,560
that. Okay, if you have a firewall you
5472
03:23:52,960 --> 03:23:56,479
can still set up an SSH connection.
5473
03:23:54,560 --> 03:23:58,479
Okay, but the problem is you'll have to
5474
03:23:56,479 --> 03:23:59,680
generate RSA key and all. And I don't
5475
03:23:58,479 --> 03:24:01,200
want to do that because it's a little
5476
03:23:59,680 --> 03:24:02,560
more complicated. And since you people
5477
03:24:01,200 --> 03:24:04,640
are beginners, I just want to show you
5478
03:24:02,560 --> 03:24:06,479
by turning the firewall off. Okay, and
5479
03:24:04,640 --> 03:24:08,239
to turn the firewall off, what you got
5480
03:24:06,479 --> 03:24:10,000
to do is you got to drop the IP table.
5481
03:24:08,239 --> 03:24:11,359
Okay, it will just stop your IP table
5482
03:24:10,000 --> 03:24:13,840
and this command will permanently
5483
03:24:11,359 --> 03:24:15,680
disable your IP table. So this is with
5484
03:24:13,840 --> 03:24:17,439
respect to Linux. So when you do these
5485
03:24:15,680 --> 03:24:20,479
two things then you can get started. All
5486
03:24:17,439 --> 03:24:21,520
right. So u let me go to my uh VM and
5487
03:24:20,479 --> 03:24:24,160
show you what are the two different
5488
03:24:21,520 --> 03:24:26,640
machines that I will be pinging to. Okay
5489
03:24:24,160 --> 03:24:29,200
as you can see. So this is uh the VM
5490
03:24:26,640 --> 03:24:30,720
which I was working on. Right. So let's
5491
03:24:29,200 --> 03:24:32,800
say cancel and I'm just going to
5492
03:24:30,720 --> 03:24:34,880
minimize this terminal. Okay. And let me
5493
03:24:32,800 --> 03:24:36,960
just close every other uh file and
5494
03:24:34,880 --> 03:24:39,920
folder. All right. This is my terminal
5495
03:24:36,960 --> 03:24:41,359
that's minimized. So if you can see here
5496
03:24:39,920 --> 03:24:43,439
you have something called as master
5497
03:24:41,359 --> 03:24:46,080
written. Right. So this is the uh master
5498
03:24:43,439 --> 03:24:48,080
machine. And if I go back to my virtual
5499
03:24:46,080 --> 03:24:49,439
box, you can see that this is the
5500
03:24:48,080 --> 03:24:50,800
machine that's already running. Okay.
5501
03:24:49,439 --> 03:24:53,200
Now this is the slave machine which I
5502
03:24:50,800 --> 03:24:55,439
will ping. So I need to instantiate this
5503
03:24:53,200 --> 03:24:57,040
slave machine also. And even when you
5504
03:24:55,439 --> 03:24:58,880
are pinging two different machines, two
5505
03:24:57,040 --> 03:25:01,279
remote machines or two machines in the
5506
03:24:58,880 --> 03:25:02,880
same VM, then what you got to do is uh
5507
03:25:01,279 --> 03:25:04,319
you know you got to turn on both and you
5508
03:25:02,880 --> 03:25:06,160
got to set the IP address in both the
5509
03:25:04,319 --> 03:25:08,720
places and then you got to ping them
5510
03:25:06,160 --> 03:25:11,120
from there. So let's just wait until the
5511
03:25:08,720 --> 03:25:12,560
slave opens. All right. When it's
5512
03:25:11,120 --> 03:25:14,000
launched, we can uh start with our
5513
03:25:12,560 --> 03:25:16,720
commands. But in the meanwhile, I can
5514
03:25:14,000 --> 03:25:17,920
just go to my master terminal and uh I
5515
03:25:16,720 --> 03:25:20,720
can go to the terminal and start
5516
03:25:17,920 --> 03:25:22,239
executing my IP tables. Okay. So, uh let
5517
03:25:20,720 --> 03:25:24,800
me check if my connections are all
5518
03:25:22,239 --> 03:25:26,960
running. Let me click on this. Okay. Now
5519
03:25:24,800 --> 03:25:28,960
that both my uh network connections are
5520
03:25:26,960 --> 03:25:32,399
on. So, what I'm going to do is I'm
5521
03:25:28,960 --> 03:25:34,160
going to say if config. Okay. So, when
5522
03:25:32,399 --> 03:25:37,359
you do an if config, you get this kind
5523
03:25:34,160 --> 03:25:40,000
of an output. Okay. So, your F0 is uh is
5524
03:25:37,359 --> 03:25:42,399
your NAT address is your network address
5525
03:25:40,000 --> 03:25:44,239
translation. Okay. and your F1. In my
5526
03:25:42,399 --> 03:25:45,760
case, it's F1. But uh generally you
5527
03:25:44,239 --> 03:25:48,800
people will not get an F1 because this
5528
03:25:45,760 --> 03:25:50,880
comes when you're running a VM. Okay. So
5529
03:25:48,800 --> 03:25:53,040
I have set up a bridged adapter. Okay.
5530
03:25:50,880 --> 03:25:54,800
Host only adapter actually between my
5531
03:25:53,040 --> 03:25:56,560
two VMs. So I have a master VM and a
5532
03:25:54,800 --> 03:25:58,640
slave VM. Right. Yeah. Since there are
5533
03:25:56,560 --> 03:26:00,960
two VMs in the same machine, I need to
5534
03:25:58,640 --> 03:26:03,600
set different IP addresses for both the
5535
03:26:00,960 --> 03:26:05,920
VMs, right? So that's when F1 comes into
5536
03:26:03,600 --> 03:26:07,520
the picture. Otherwise, in your case, if
5537
03:26:05,920 --> 03:26:09,359
you're running running Linux and if you
5538
03:26:07,520 --> 03:26:11,439
run this if config tab, then you will
5539
03:26:09,359 --> 03:26:12,960
not get F1. you'll only get at 0 or
5540
03:26:11,439 --> 03:26:15,439
you'll just get one option you'll get ln
5541
03:26:12,960 --> 03:26:18,080
not and you'll get at zero. Okay. And uh
5542
03:26:15,439 --> 03:26:22,080
this lnot basically represents the uh
5543
03:26:18,080 --> 03:26:24,000
entity address. Okay. So this 10.0.2.15
5544
03:26:22,080 --> 03:26:26,080
this basically is your IP address which
5545
03:26:24,000 --> 03:26:27,760
you need to use to connect to the
5546
03:26:26,080 --> 03:26:28,960
internet. So if you don't get an address
5547
03:26:27,760 --> 03:26:30,720
over here then it means you're not
5548
03:26:28,960 --> 03:26:32,960
connected to the internet. Okay. So
5549
03:26:30,720 --> 03:26:37,439
that's what uh this means. And right now
5550
03:26:32,960 --> 03:26:39,920
my uh F1 address is 192.160.56.2.
5551
03:26:37,439 --> 03:26:43,120
Okay. And similarly, if I go to my slave
5552
03:26:39,920 --> 03:26:45,680
VM, let me just log in here first. As
5553
03:26:43,120 --> 03:26:48,160
you can see from here, it's a slave VM.
5554
03:26:45,680 --> 03:26:49,439
And if I launch my terminal, what I'm
5555
03:26:48,160 --> 03:26:52,239
going to do here is I'm going to run the
5556
03:26:49,439 --> 03:26:54,880
command if config again. Right? So,
5557
03:26:52,239 --> 03:26:56,880
right now, it says that my uh okay, I
5558
03:26:54,880 --> 03:26:59,040
don't have a NET address. Okay, my uh
5559
03:26:56,880 --> 03:27:03,680
network is not connected. Okay, I have
5560
03:26:59,040 --> 03:27:06,960
F1 connection and that is 192.168.56.2.
5561
03:27:03,680 --> 03:27:08,000
Okay, but my N address is not set. So I
5562
03:27:06,960 --> 03:27:09,279
think I'm disconnected from the
5563
03:27:08,000 --> 03:27:11,520
internet. So what I'm going to do is I'm
5564
03:27:09,279 --> 03:27:13,600
just going to click on system f0. And
5565
03:27:11,520 --> 03:27:15,200
when I do this, I'll be connected to the
5566
03:27:13,600 --> 03:27:18,080
internet now. And I'm going to run this
5567
03:27:15,200 --> 03:27:20,960
command again. And uh now if you see I
5568
03:27:18,080 --> 03:27:24,960
have the uh NAT address. Okay. So this
5569
03:27:20,960 --> 03:27:28,319
is my network address 10.0.2.15.
5570
03:27:24,960 --> 03:27:30,720
And in in case of my master VM 10.0.2.15
5571
03:27:28,319 --> 03:27:33,840
was again the NAT address. Okay. It's
5572
03:27:30,720 --> 03:27:35,279
the same but however the one would have
5573
03:27:33,840 --> 03:27:36,800
to be different. Okay. I mean whether
5574
03:27:35,279 --> 03:27:38,960
it's different or not I need to change
5575
03:27:36,800 --> 03:27:41,120
my uh F1
5576
03:27:38,960 --> 03:27:43,680
but now what matters is I need to ping
5577
03:27:41,120 --> 03:27:46,239
my slave from my master right so I need
5578
03:27:43,680 --> 03:27:48,479
to drop whatever IP address is there
5579
03:27:46,239 --> 03:27:50,560
right now so if this is the IP then I
5580
03:27:48,479 --> 03:27:52,479
have to drop this IP so even in your
5581
03:27:50,560 --> 03:27:54,640
case by default there will be one random
5582
03:27:52,479 --> 03:27:56,399
IP address you can drop that IP address
5583
03:27:54,640 --> 03:27:58,080
by running one of the commands which I
5584
03:27:56,399 --> 03:27:59,920
showed you in my slides I'll show you
5585
03:27:58,080 --> 03:28:01,439
that again similarly you got to do the
5586
03:27:59,920 --> 03:28:04,319
same thing at even your master's end you
5587
03:28:01,439 --> 03:28:06,160
got to drop the IP uh with the F1 IP
5588
03:28:04,319 --> 03:28:08,319
address and when you when you've done
5589
03:28:06,160 --> 03:28:09,760
that you can set your new IP address so
5590
03:28:08,319 --> 03:28:11,600
you will be setting two different IP
5591
03:28:09,760 --> 03:28:13,760
addresses one for your master and one
5592
03:28:11,600 --> 03:28:15,760
for your uh slave okay you'll be setting
5593
03:28:13,760 --> 03:28:17,920
one over here in this VM and you'll be
5594
03:28:15,760 --> 03:28:20,479
setting one over here and uh that
5595
03:28:17,920 --> 03:28:24,880
address will be over here okay so I'll
5596
03:28:20,479 --> 03:28:26,399
make my slave as 192.168.56.3
5597
03:28:24,880 --> 03:28:29,359
okay so I'll drop this one and I'll
5598
03:28:26,399 --> 03:28:32,319
update it as uh3 and in fact master can
5599
03:28:29,359 --> 03:28:34,479
be the same 192.168.562
5600
03:28:32,319 --> 03:28:37,200
can be the you know the IP address of my
5601
03:28:34,479 --> 03:28:39,760
uh master slave. Okay, so I'll use these
5602
03:28:37,200 --> 03:28:42,960
two things and once I add these two IP
5603
03:28:39,760 --> 03:28:44,880
addresses to the ATC/hosts file, then I
5604
03:28:42,960 --> 03:28:46,640
can start pinging them. Okay, I can
5605
03:28:44,880 --> 03:28:48,880
start pinging them and I can get remote
5606
03:28:46,640 --> 03:28:51,359
access to them. All right, so what I'll
5607
03:28:48,880 --> 03:28:52,960
do is I'll first clear the screen and
5608
03:28:51,359 --> 03:28:54,319
I'll go to my slave and again I'll do
5609
03:28:52,960 --> 03:28:57,600
the same thing. I'll I'm going to clear
5610
03:28:54,319 --> 03:29:00,319
the screen now. So going back to my uh
5611
03:28:57,600 --> 03:29:02,479
VM, the first command that uh we got to
5612
03:29:00,319 --> 03:29:04,880
run is we got to drop this particular IP
5613
03:29:02,479 --> 03:29:08,720
address. So to delete the IP address, we
5614
03:29:04,880 --> 03:29:11,120
have this command uh sudo IP adder
5615
03:29:08,720 --> 03:29:13,760
delete and then whatever the IP address
5616
03:29:11,120 --> 03:29:15,920
is. Okay. So here uh this was the IP
5617
03:29:13,760 --> 03:29:17,279
address, right? I want to drop the F1
5618
03:29:15,920 --> 03:29:19,840
address. So what I'm going to do is I'm
5619
03:29:17,279 --> 03:29:23,760
going to put this here. I'm going to say
5620
03:29:19,840 --> 03:29:25,760
dev F1. Now when I hit enter, this
5621
03:29:23,760 --> 03:29:28,720
particular IP address will be dropped.
5622
03:29:25,760 --> 03:29:31,279
Okay. Okay. This is the password. Okay.
5623
03:29:28,720 --> 03:29:33,439
Now if I again run if config you can see
5624
03:29:31,279 --> 03:29:36,239
that I don't have an H1 address. That's
5625
03:29:33,439 --> 03:29:37,680
because I dropped it over here. Correct.
5626
03:29:36,239 --> 03:29:39,120
Let me just show it to you. That's
5627
03:29:37,680 --> 03:29:41,359
because I dropped this particular
5628
03:29:39,120 --> 03:29:43,760
address. Okay. Now similarly let me run
5629
03:29:41,359 --> 03:29:47,840
the same command in my uh slave also.
5630
03:29:43,760 --> 03:29:52,319
The command is IP adder delete. The IP
5631
03:29:47,840 --> 03:29:54,800
address over here is u 192.168.56.2.
5632
03:29:52,319 --> 03:29:57,279
Okay. So this is the same here also. So
5633
03:29:54,800 --> 03:30:00,399
I'm going to just uh paste it here and
5634
03:29:57,279 --> 03:30:03,279
say dev1
5635
03:30:00,399 --> 03:30:04,960
when I give enter. Okay, I need to give
5636
03:30:03,279 --> 03:30:07,760
pseudo. So that is a problem. So I'm
5637
03:30:04,960 --> 03:30:11,200
going to give pseudo IP adder. It asks
5638
03:30:07,760 --> 03:30:14,319
for the password. There you go. And uh
5639
03:30:11,200 --> 03:30:16,479
yeah, my IP address has been uh
5640
03:30:14,319 --> 03:30:18,800
discarded. Okay. Now if I again run the
5641
03:30:16,479 --> 03:30:21,439
if config, you can see that F1 again
5642
03:30:18,800 --> 03:30:22,960
does not have any IP address. Now what I
5643
03:30:21,439 --> 03:30:24,800
need to do is I need to set my own IP
5644
03:30:22,960 --> 03:30:26,880
address over here. So let me first set
5645
03:30:24,800 --> 03:30:31,120
the IP address over here itself in my uh
5646
03:30:26,880 --> 03:30:33,120
this uh slave VM. So to uh add the IP
5647
03:30:31,120 --> 03:30:35,200
address the command is almost the same
5648
03:30:33,120 --> 03:30:38,720
except that instead of delete you'll
5649
03:30:35,200 --> 03:30:40,640
have to put add okay and uh you'll have
5650
03:30:38,720 --> 03:30:45,439
to specify the IP address you want to
5651
03:30:40,640 --> 03:30:47,279
set. So I want to set 192.168.56
5652
03:30:45,439 --> 03:30:49,600
1.2
5653
03:30:47,279 --> 03:30:51,840
okay I'm going to say that 102 and then
5654
03:30:49,600 --> 03:30:53,040
I need to give a mask. So if you
5655
03:30:51,840 --> 03:30:56,319
remember I told you that we need to give
5656
03:30:53,040 --> 03:30:58,640
a mask. So it'll be /24 or let me give
5657
03:30:56,319 --> 03:31:01,439
103 because this is the slave right I
5658
03:30:58,640 --> 03:31:03,040
can give 13 here 103/24
5659
03:31:01,439 --> 03:31:04,960
when I give enter the IP address would
5660
03:31:03,040 --> 03:31:07,760
have been added. So if I do the if
5661
03:31:04,960 --> 03:31:11,279
config now you can see that f1 has this
5662
03:31:07,760 --> 03:31:13,040
address 192.168.56.13.
5663
03:31:11,279 --> 03:31:14,800
This is what I added some time back.
5664
03:31:13,040 --> 03:31:16,880
Right? This is what I added here. Now
5665
03:31:14,800 --> 03:31:20,479
similarly I need to go back to my master
5666
03:31:16,880 --> 03:31:22,160
VM and uh I've deleted the uh IP address
5667
03:31:20,479 --> 03:31:24,640
from here. I need to add the IP address
5668
03:31:22,160 --> 03:31:29,080
here the new one. Okay. So the command
5669
03:31:24,640 --> 03:31:29,080
is add 192.168.56.1.2/
5670
03:31:31,120 --> 03:31:36,640
the mask. That's 24. Give enter. Okay.
5671
03:31:34,479 --> 03:31:39,359
Now let me check the if config. As you
5672
03:31:36,640 --> 03:31:41,120
can see the uh IP address for my F1 is
5673
03:31:39,359 --> 03:31:43,760
there. It's up and running now. It's
5674
03:31:41,120 --> 03:31:46,399
192.168.56.1.2
5675
03:31:43,760 --> 03:31:48,399
do over here in this case. Okay. Now
5676
03:31:46,399 --> 03:31:49,840
I've uh now that I've done this uh
5677
03:31:48,399 --> 03:31:51,359
there's one more important thing that I
5678
03:31:49,840 --> 03:31:54,800
need to do. I need to add my IP
5679
03:31:51,359 --> 03:31:56,720
addresses to the etc/hosts file which
5680
03:31:54,800 --> 03:31:59,040
indicates to both the VMs where the
5681
03:31:56,720 --> 03:32:00,399
master is and what is the IP address of
5682
03:31:59,040 --> 03:32:02,560
the master and what is the IP address of
5683
03:32:00,399 --> 03:32:04,560
the slave. Okay, now that I've added
5684
03:32:02,560 --> 03:32:06,479
this one. So let me just uh copy this
5685
03:32:04,560 --> 03:32:08,560
address. I'm going to copy this and I
5686
03:32:06,479 --> 03:32:10,479
need to set this address of the master
5687
03:32:08,560 --> 03:32:13,439
and similarly the address of the uh
5688
03:32:10,479 --> 03:32:15,920
slave in the etc/hosts file. Okay, how
5689
03:32:13,439 --> 03:32:17,840
will you access the EDC/hosts file? You
5690
03:32:15,920 --> 03:32:19,680
need to first go to your uh home
5691
03:32:17,840 --> 03:32:22,160
directory and from here, okay, let me
5692
03:32:19,680 --> 03:32:25,359
clear the screen. Home directory. So
5693
03:32:22,160 --> 03:32:28,359
here you got to give sudo gedit
5694
03:32:25,359 --> 03:32:28,359
/c/hosts.
5695
03:32:28,479 --> 03:32:32,160
Okay, when you hit enter, you'll open
5696
03:32:30,479 --> 03:32:35,439
this file. Okay, this file is called
5697
03:32:32,160 --> 03:32:38,960
hosts/c file. So in here, you know, I've
5698
03:32:35,439 --> 03:32:41,359
already set my IP addresses. Okay, now I
5699
03:32:38,960 --> 03:32:44,080
can just delete it for names sake and I
5700
03:32:41,359 --> 03:32:47,800
can just copy paste what I had copied.
5701
03:32:44,080 --> 03:32:47,800
So it was 192.168.56.12.
5702
03:32:47,840 --> 03:32:51,840
This is the IP address of the master
5703
03:32:49,520 --> 03:32:53,520
which I wanted to set. Correct? If you
5704
03:32:51,840 --> 03:32:55,200
see here, this is the IP address that I
5705
03:32:53,520 --> 03:32:57,920
added now. And I'm adding this IP
5706
03:32:55,200 --> 03:32:59,680
address 2 to the host. I'm going to add
5707
03:32:57,920 --> 03:33:03,279
that as master. And similarly, if I go
5708
03:32:59,680 --> 03:33:07,840
to the uh slave, the IP address is 192
5709
03:33:03,279 --> 03:33:10,000
168 56 and 193. Okay, now I need to go
5710
03:33:07,840 --> 03:33:11,520
to the EDC file and uh since that is a
5711
03:33:10,000 --> 03:33:13,279
slave, I got to set the IP address for
5712
03:33:11,520 --> 03:33:15,840
the slave. And of course, you the slave
5713
03:33:13,279 --> 03:33:17,520
IP already set, but I'll just uh update
5714
03:33:15,840 --> 03:33:20,319
and save it anyways. I'm going to save
5715
03:33:17,520 --> 03:33:22,960
this and I'm going to close this. Okay.
5716
03:33:20,319 --> 03:33:25,680
Now, uh similarly, I need to go to the
5717
03:33:22,960 --> 03:33:28,080
uh slave VM and set these two IP
5718
03:33:25,680 --> 03:33:35,760
addresses. Okay. Now again the command
5719
03:33:28,080 --> 03:33:38,760
is go to CD and uh go write sudo gedit/
5720
03:33:35,760 --> 03:33:38,760
EDC/hosts.
5721
03:33:40,479 --> 03:33:46,800
Okay. So here also the IP address is set
5722
03:33:43,760 --> 03:33:48,640
to 102 and 103. Okay. Now this is the
5723
03:33:46,800 --> 03:33:51,279
slave VM and the IP address of this
5724
03:33:48,640 --> 03:33:53,520
machine is 103 and the master is 102.
5725
03:33:51,279 --> 03:33:54,479
Okay. That's the other VM. So uh I mean
5726
03:33:53,520 --> 03:33:55,760
it's the same. So I don't need to make
5727
03:33:54,479 --> 03:33:57,920
any changes here. I'm just going to
5728
03:33:55,760 --> 03:33:59,760
close this. Yeah, I can just close it
5729
03:33:57,920 --> 03:34:00,880
without saving. Now, uh now that I've
5730
03:33:59,760 --> 03:34:04,080
done this, I can straight away start
5731
03:34:00,880 --> 03:34:06,800
pinging or get SSH connection. Okay, I
5732
03:34:04,080 --> 03:34:10,640
can just say since this is the slave, I
5733
03:34:06,800 --> 03:34:12,399
can say SSH space master. Now, since
5734
03:34:10,640 --> 03:34:14,399
I've added the IP address of the master
5735
03:34:12,399 --> 03:34:15,680
in the uh host table, I don't need to
5736
03:34:14,399 --> 03:34:17,680
specify the IP address of that
5737
03:34:15,680 --> 03:34:19,680
particular system. I can just say SSH
5738
03:34:17,680 --> 03:34:21,840
master. And if I put enter, then it'll
5739
03:34:19,680 --> 03:34:23,439
ask me for the master's password. And
5740
03:34:21,840 --> 03:34:25,760
the other VM's password is what I'm
5741
03:34:23,439 --> 03:34:28,319
going to put here. And when I put enter
5742
03:34:25,760 --> 03:34:30,080
as you can see I'm logged in now. So the
5743
03:34:28,319 --> 03:34:31,439
password has been entered and uh you can
5744
03:34:30,080 --> 03:34:33,040
see the last login here. Okay. So the
5745
03:34:31,439 --> 03:34:35,600
last time I logged in was on uh this
5746
03:34:33,040 --> 03:34:37,279
date and I had logged in from this slave
5747
03:34:35,600 --> 03:34:40,080
itself. Okay. From this particular VM
5748
03:34:37,279 --> 03:34:42,399
itself. So um to prove that this is the
5749
03:34:40,080 --> 03:34:44,640
actual master what I can do is I can uh
5750
03:34:42,399 --> 03:34:46,560
just go to cd and I can do an ls
5751
03:34:44,640 --> 03:34:49,120
command. Okay. I can go into any of
5752
03:34:46,560 --> 03:34:52,160
these desktop or the downloads or the
5753
03:34:49,120 --> 03:34:53,680
pictures uh folders. Right? because I
5754
03:34:52,160 --> 03:34:55,200
made quite a few changes in my master
5755
03:34:53,680 --> 03:34:57,680
slave. And from the master slave is
5756
03:34:55,200 --> 03:34:59,680
where I showed you the earlier uh files,
5757
03:34:57,680 --> 03:35:03,040
right? I created the automo.txt, the
5758
03:34:59,680 --> 03:35:05,200
file 1.xt, the file 2.txt.
5759
03:35:03,040 --> 03:35:07,040
Okay, if you can remember, then my
5760
03:35:05,200 --> 03:35:09,920
documents has uh these contents. Okay,
5761
03:35:07,040 --> 03:35:12,640
it has folder one, it has automoils. TXT
5762
03:35:09,920 --> 03:35:15,040
and all these things. So I can just add
5763
03:35:12,640 --> 03:35:19,760
the same to my slave. So I can just
5764
03:35:15,040 --> 03:35:22,479
navigate to desktop and if I do an ls I
5765
03:35:19,760 --> 03:35:24,399
get the list of all these things. Okay.
5766
03:35:22,479 --> 03:35:26,960
So as you can see there is uh the
5767
03:35:24,399 --> 03:35:28,720
automo.txt and the readme file in my
5768
03:35:26,960 --> 03:35:31,920
downloads folder. Okay. Now let me go to
5769
03:35:28,720 --> 03:35:34,239
my uh master. So in my master if I go to
5770
03:35:31,920 --> 03:35:36,160
downloads I have these two files. Okay.
5771
03:35:34,239 --> 03:35:38,080
So this is what I mean when I say remote
5772
03:35:36,160 --> 03:35:39,279
access. So these two VMs are
5773
03:35:38,080 --> 03:35:41,600
communicating with each other such that
5774
03:35:39,279 --> 03:35:43,920
the slave is accessing and it's running
5775
03:35:41,600 --> 03:35:45,359
commands inside the master and whatever
5776
03:35:43,920 --> 03:35:48,000
is visible over there I get access to
5777
03:35:45,359 --> 03:35:49,840
here. Supposing you want me to uh you
5778
03:35:48,000 --> 03:35:52,399
know open another file. Okay. So the
5779
03:35:49,840 --> 03:35:54,640
music folder has these three files
5780
03:35:52,399 --> 03:35:58,080
right. So I can access these also. I can
5781
03:35:54,640 --> 03:35:59,920
just say cd and go back one path and say
5782
03:35:58,080 --> 03:36:01,760
I want to smooth change to music. So
5783
03:35:59,920 --> 03:36:03,520
when I go here and I do an ls I have
5784
03:36:01,760 --> 03:36:06,160
automoils.xt
5785
03:36:03,520 --> 03:36:08,319
file 1.xt and file 22.xt. Basically
5786
03:36:06,160 --> 03:36:10,800
these three text files are present in
5787
03:36:08,319 --> 03:36:12,239
the other VM in the other machine. Okay,
5788
03:36:10,800 --> 03:36:13,439
they are present over here. However,
5789
03:36:12,239 --> 03:36:14,640
they're not present in this machine. If
5790
03:36:13,439 --> 03:36:15,920
you want me to prove that they are not
5791
03:36:14,640 --> 03:36:18,560
there in this machine, then I can just
5792
03:36:15,920 --> 03:36:20,239
minimize this. Go to uh in the file
5793
03:36:18,560 --> 03:36:22,000
directory, go to music. Okay, it's
5794
03:36:20,239 --> 03:36:24,720
empty. So this basically means that I'm
5795
03:36:22,000 --> 03:36:26,239
accessing the master VM from this slave
5796
03:36:24,720 --> 03:36:27,439
VM. Okay, alternatively, you can also
5797
03:36:26,239 --> 03:36:30,479
check the downloads folder. There's
5798
03:36:27,439 --> 03:36:32,319
nothing here either. So yeah, that's how
5799
03:36:30,479 --> 03:36:34,880
we log into the remote machine. And in
5800
03:36:32,319 --> 03:36:36,479
my case, I've logged into slave from my
5801
03:36:34,880 --> 03:36:38,880
machine. And I have accessed these
5802
03:36:36,479 --> 03:36:41,120
folders. Okay. I can also view these uh
5803
03:36:38,880 --> 03:36:43,520
contents in this folder by going to cat
5804
03:36:41,120 --> 03:36:45,279
automobiles.txt. And when I hit enter,
5805
03:36:43,520 --> 03:36:46,880
whatever uh data set that I created
5806
03:36:45,279 --> 03:36:48,479
earlier in the session, right, couple of
5807
03:36:46,880 --> 03:36:51,200
hours back. So those are visible over
5808
03:36:48,479 --> 03:36:52,479
here. Okay. So that's it. So another
5809
03:36:51,200 --> 03:36:53,760
thing is that if you want to exit from
5810
03:36:52,479 --> 03:36:55,600
your master's machine, right? If you
5811
03:36:53,760 --> 03:36:57,520
want to exit your SSH shell, then you
5812
03:36:55,600 --> 03:36:59,600
can just hit exit. Okay. When you hit
5813
03:36:57,520 --> 03:37:01,600
exit, it says uh log out. Okay.
5814
03:36:59,600 --> 03:37:03,840
Connection to master is closed. So this
5815
03:37:01,600 --> 03:37:07,680
shows that now we are back to your own
5816
03:37:03,840 --> 03:37:10,399
VM. And now if you uh try going to CD
5817
03:37:07,680 --> 03:37:12,080
and if you go to music or something
5818
03:37:10,399 --> 03:37:14,000
you'll not find any documents or any
5819
03:37:12,080 --> 03:37:15,359
folders in that particular directory.
5820
03:37:14,000 --> 03:37:17,680
That's because this is your VM. This is
5821
03:37:15,359 --> 03:37:20,319
the slave VM. And similarly I can just
5822
03:37:17,680 --> 03:37:22,080
uh you know from my master's VM also I
5823
03:37:20,319 --> 03:37:26,319
can get access to the slave VM by just
5824
03:37:22,080 --> 03:37:28,239
uh typing in SSH and slave. The password
5825
03:37:26,319 --> 03:37:33,439
is uh this and this is the last time
5826
03:37:28,239 --> 03:37:35,439
that I was logged in and u I'm here.
5827
03:37:33,439 --> 03:37:37,680
If I go to CD music and if I do an ls
5828
03:37:35,439 --> 03:37:40,319
there's nothing available here. Okay,
5829
03:37:37,680 --> 03:37:41,840
that's because uh the slaves VM does not
5830
03:37:40,319 --> 03:37:43,520
have anything in the music folder or
5831
03:37:41,840 --> 03:37:45,439
anything in the documents folder. So
5832
03:37:43,520 --> 03:37:47,120
that is the reason. Okay, and similarly
5833
03:37:45,439 --> 03:37:49,680
I can exit from here by giving this
5834
03:37:47,120 --> 03:37:53,120
command exit. It says uh it's logged out
5835
03:37:49,680 --> 03:37:57,760
and connection to slave is closed. Okay
5836
03:37:53,120 --> 03:37:59,840
guys, so this is uh about the SSH and um
5837
03:37:57,760 --> 03:38:01,600
this is about the secure shell
5838
03:37:59,840 --> 03:38:04,239
connection. There is something called as
5839
03:38:01,600 --> 03:38:05,760
the RSA key. Okay, that is something
5840
03:38:04,239 --> 03:38:08,319
that'll get generated if there is a
5841
03:38:05,760 --> 03:38:10,399
firewall. So in my case, I have blocked
5842
03:38:08,319 --> 03:38:12,880
my firewall by dropping the IP tables.
5843
03:38:10,399 --> 03:38:16,000
Okay, so the command to drop the IP
5844
03:38:12,880 --> 03:38:18,399
tables are this one. They are service IP
5845
03:38:16,000 --> 03:38:20,399
tables and stop. Okay, this will drop
5846
03:38:18,399 --> 03:38:21,920
the IP table temporarily. And if you
5847
03:38:20,399 --> 03:38:24,080
want to permanently disable the IP table
5848
03:38:21,920 --> 03:38:27,200
then you can just run the command p sudo
5849
03:38:24,080 --> 03:38:29,279
uh check config and IP tables off. So by
5850
03:38:27,200 --> 03:38:30,800
doing this your uh firewall will be
5851
03:38:29,279 --> 03:38:32,319
turned off and you can use the SSH
5852
03:38:30,800 --> 03:38:34,319
connection in the way I showed you.
5853
03:38:32,319 --> 03:38:36,640
Okay. Now this is a very simpler way but
5854
03:38:34,319 --> 03:38:38,640
in case of a real scenario okay where
5855
03:38:36,640 --> 03:38:40,479
the machine is located remotely where
5856
03:38:38,640 --> 03:38:42,160
you cannot actually disable your
5857
03:38:40,479 --> 03:38:44,560
firewall. Okay. Because firewall is
5858
03:38:42,160 --> 03:38:45,920
important to block any unauthorized
5859
03:38:44,560 --> 03:38:48,239
access right. So firewall is important
5860
03:38:45,920 --> 03:38:50,479
to be enabled. So in that case if you
5861
03:38:48,239 --> 03:38:51,680
want an SSH connection to be present in
5862
03:38:50,479 --> 03:38:53,359
spite of a firewall then there is
5863
03:38:51,680 --> 03:38:56,239
another procedure where you have to
5864
03:38:53,359 --> 03:38:58,479
generate an SSH key right an RSA key
5865
03:38:56,239 --> 03:39:00,640
from the master's end and set that key
5866
03:38:58,479 --> 03:39:02,319
at the slave end so you have that kind
5867
03:39:00,640 --> 03:39:03,680
of a process and uh that is something
5868
03:39:02,319 --> 03:39:05,840
that's a little more complicated than
5869
03:39:03,680 --> 03:39:08,080
this and of course that I can't show you
5870
03:39:05,840 --> 03:39:10,960
now but I promise to show you that in my
5871
03:39:08,080 --> 03:39:12,720
uh next Linux webinar okay so if you
5872
03:39:10,960 --> 03:39:14,880
guys promise to come back and visit me
5873
03:39:12,720 --> 03:39:16,479
in that webinar then I can promise you
5874
03:39:14,880 --> 03:39:19,760
to uh show it to you there. All right
5875
03:39:16,479 --> 03:39:21,120
guys, so uh I'm uh hoping that it's all
5876
03:39:19,760 --> 03:39:23,600
fine. I'm hoping that you people
5877
03:39:21,120 --> 03:39:24,960
understood the concepts here and u it's
5878
03:39:23,600 --> 03:39:28,239
been a good session. It's been pretty
5879
03:39:24,960 --> 03:39:30,720
long but it's been worth it right. Uh
5880
03:39:28,239 --> 03:39:33,120
basically u Hmon who's new to computer
5881
03:39:30,720 --> 03:39:34,720
science he says that you know he's got a
5882
03:39:33,120 --> 03:39:37,760
lot of you know he's understood Linux
5883
03:39:34,720 --> 03:39:41,040
well and uh yeah he also says that he's
5884
03:39:37,760 --> 03:39:43,200
going to install CentOS. Okay, that's
5885
03:39:41,040 --> 03:39:44,800
good because even this was CentOS. Maybe
5886
03:39:43,200 --> 03:39:46,640
this is why you want to install CentOS
5887
03:39:44,800 --> 03:39:48,880
but don't just keep yourself restricted
5888
03:39:46,640 --> 03:39:50,720
to this CentOS. Hmon you can also
5889
03:39:48,880 --> 03:39:52,880
install Ubuntu and find out which one
5890
03:39:50,720 --> 03:39:55,120
you like. So see I like CentOS and uh
5891
03:39:52,880 --> 03:39:57,359
this is my preferred Linux distribution.
5892
03:39:55,120 --> 03:39:59,520
Okay. So I recommend everything Ubuntu
5893
03:39:57,359 --> 03:40:01,200
and CentOS to you. You can install them
5894
03:39:59,520 --> 03:40:05,560
and uh you work on them and you will
5895
03:40:01,200 --> 03:40:05,560
only figure out which is better for you.
5896
03:40:08,880 --> 03:40:12,800
So let's talk a little bit about the
5897
03:40:10,479 --> 03:40:15,359
kernel and the shell. So what is a
5898
03:40:12,800 --> 03:40:17,439
kernel? Now the computer programs that
5899
03:40:15,359 --> 03:40:19,520
allocate the system resources and
5900
03:40:17,439 --> 03:40:21,680
coordinate all the details of the
5901
03:40:19,520 --> 03:40:23,680
computer's internals is basically known
5902
03:40:21,680 --> 03:40:26,000
as the kernel. Now the kernel is the
5903
03:40:23,680 --> 03:40:28,560
heart of any operating system. It
5904
03:40:26,000 --> 03:40:30,720
interacts with the hardware and most of
5905
03:40:28,560 --> 03:40:34,160
the tasks like memory management,
5906
03:40:30,720 --> 03:40:36,720
taskuling and file management. Now users
5907
03:40:34,160 --> 03:40:39,439
communicate with a kernel through a
5908
03:40:36,720 --> 03:40:42,000
program called the shell. The shell is
5909
03:40:39,439 --> 03:40:44,239
that utility that processes your
5910
03:40:42,000 --> 03:40:46,560
requests. When you type in a command,
5911
03:40:44,239 --> 03:40:48,720
basically at your terminal, the shell
5912
03:40:46,560 --> 03:40:51,520
interprets the command and calls the
5913
03:40:48,720 --> 03:40:54,479
program that you want. The shell uses
5914
03:40:51,520 --> 03:40:56,560
standard syntax for all commands. It is
5915
03:40:54,479 --> 03:40:58,880
basically a command line interpreter
5916
03:40:56,560 --> 03:41:01,200
which translates commands entered by the
5917
03:40:58,880 --> 03:41:03,439
user and converts them into a language
5918
03:41:01,200 --> 03:41:05,680
that is understood by the kernel. And
5919
03:41:03,439 --> 03:41:08,000
obviously the next logical question is
5920
03:41:05,680 --> 03:41:10,160
what is a shell script? Since I spoke
5921
03:41:08,000 --> 03:41:12,080
about the shell, it is only obvious that
5922
03:41:10,160 --> 03:41:14,160
I'm going to mention the shell script.
5923
03:41:12,080 --> 03:41:16,160
The basic concept of a shell script is a
5924
03:41:14,160 --> 03:41:18,319
list of commands which are listed in
5925
03:41:16,160 --> 03:41:20,560
order of execution.
5926
03:41:18,319 --> 03:41:24,000
With that, let's move on to our next
5927
03:41:20,560 --> 03:41:26,160
topic which is evolution of the shell.
5928
03:41:24,000 --> 03:41:28,640
So let's begin with a short history of
5929
03:41:26,160 --> 03:41:31,120
the modern shells and then explore some
5930
03:41:28,640 --> 03:41:34,000
of the useful and exotic shells that are
5931
03:41:31,120 --> 03:41:35,279
available in Linux today. All right. So
5932
03:41:34,000 --> 03:41:38,080
the shell or the command line
5933
03:41:35,279 --> 03:41:40,319
interpreter have a long history but this
5934
03:41:38,080 --> 03:41:43,600
discussion begins with the first ever
5935
03:41:40,319 --> 03:41:46,080
Unix shell. Ken Thompson of Bell Labs
5936
03:41:43,600 --> 03:41:50,000
discovered the first shell for the Unix
5937
03:41:46,080 --> 03:41:52,399
called the V6 in 1971. Now similar to
5938
03:41:50,000 --> 03:41:54,319
its predecessor, this shell was an
5939
03:41:52,399 --> 03:41:57,279
independent user program that could be
5940
03:41:54,319 --> 03:41:59,920
executed outside the kernel. Now I'm not
5941
03:41:57,279 --> 03:42:02,319
going to talk about the Thommpson shell.
5942
03:41:59,920 --> 03:42:05,359
We are going to begin our journey with a
5943
03:42:02,319 --> 03:42:07,359
look at the modern shell since 1977 when
5944
03:42:05,359 --> 03:42:09,760
the bone shell was introduced. Now the
5945
03:42:07,359 --> 03:42:13,120
bond shell created by Stephen Bourne at
5946
03:42:09,760 --> 03:42:15,279
the AT Bell Labs remains useful even
5947
03:42:13,120 --> 03:42:18,080
today. The author developed the Bond
5948
03:42:15,279 --> 03:42:20,160
shell after working on an algol 60 gate
5949
03:42:18,080 --> 03:42:22,720
compiler. So you'll find its grammar
5950
03:42:20,160 --> 03:42:24,800
more similar to the algorithmic language
5951
03:42:22,720 --> 03:42:27,920
than other shells. Now the source code
5952
03:42:24,800 --> 03:42:31,040
itself although developed in C even made
5953
03:42:27,920 --> 03:42:33,359
use of macros to give it the algol 68
5954
03:42:31,040 --> 03:42:35,680
flavor. Now the bond shell had two
5955
03:42:33,359 --> 03:42:37,840
primary goals to serve as a command line
5956
03:42:35,680 --> 03:42:40,080
interpreter to interactively execute
5957
03:42:37,840 --> 03:42:42,560
commands for the operating system and
5958
03:42:40,080 --> 03:42:44,640
for scripting. In addition to replacing
5959
03:42:42,560 --> 03:42:46,960
the Thompson shell, the bone shell
5960
03:42:44,640 --> 03:42:49,520
offered several advantages over its
5961
03:42:46,960 --> 03:42:52,080
predecessors. Now the bone introduced
5962
03:42:49,520 --> 03:42:54,239
control flows, loops and variables into
5963
03:42:52,080 --> 03:42:56,399
scripts providing a more functional
5964
03:42:54,239 --> 03:42:58,960
language to interact with the operating
5965
03:42:56,399 --> 03:43:01,439
system. Now the shell also permitted you
5966
03:42:58,960 --> 03:43:03,040
to use shell scripts as filters
5967
03:43:01,439 --> 03:43:05,600
providing integrated support for
5968
03:43:03,040 --> 03:43:08,160
handling signals but lacked the ability
5969
03:43:05,600 --> 03:43:10,399
to define functions. Finally, it
5970
03:43:08,160 --> 03:43:12,479
incorporated a number of features that
5971
03:43:10,399 --> 03:43:15,359
we use today, including command
5972
03:43:12,479 --> 03:43:17,520
substitution and here documents to embed
5973
03:43:15,359 --> 03:43:20,000
preserved string literal within a
5974
03:43:17,520 --> 03:43:22,399
script. Now, the bone shell was not only
5975
03:43:20,000 --> 03:43:25,120
an important step forward, but also an
5976
03:43:22,399 --> 03:43:28,080
anchor for numerous derivatives, many of
5977
03:43:25,120 --> 03:43:31,520
which are used today in typical Linux
5978
03:43:28,080 --> 03:43:34,000
systems. Next we have the sea shell
5979
03:43:31,520 --> 03:43:36,160
which came in 1978
5980
03:43:34,000 --> 03:43:38,880
was created by Bill Joy while he was
5981
03:43:36,160 --> 03:43:41,199
still a graduate student. It has been
5982
03:43:38,880 --> 03:43:43,520
widely distributed beginning with the
5983
03:43:41,199 --> 03:43:46,000
2BSD release of Berkeley software
5984
03:43:43,520 --> 03:43:49,040
distribution. The C shell is a command
5985
03:43:46,000 --> 03:43:51,439
processor typically run in a text window
5986
03:43:49,040 --> 03:43:54,160
allowing the user to type commands. Now
5987
03:43:51,439 --> 03:43:56,560
the C shell can also read commands from
5988
03:43:54,160 --> 03:43:58,560
a file called a script. Like all Linux
5989
03:43:56,560 --> 03:44:01,359
shells, it supports file name, wild
5990
03:43:58,560 --> 03:44:03,520
carding, piping here documents, command
5991
03:44:01,359 --> 03:44:05,840
substitution, variables, and control
5992
03:44:03,520 --> 03:44:08,560
structures for condition testing. What
5993
03:44:05,840 --> 03:44:11,040
differentiated the C shell from others,
5994
03:44:08,560 --> 03:44:13,760
especially in the 1980s, were its
5995
03:44:11,040 --> 03:44:16,160
interactive features and overall style.
5996
03:44:13,760 --> 03:44:18,720
Its new features made it easier and
5997
03:44:16,160 --> 03:44:20,960
faster to use. The overall style of the
5998
03:44:18,720 --> 03:44:23,600
language looked more like C programming
5999
03:44:20,960 --> 03:44:25,920
language and was seen as more readable.
6000
03:44:23,600 --> 03:44:28,479
Now another improvement that we saw on
6001
03:44:25,920 --> 03:44:30,000
the bone shell was the corn shell in
6002
03:44:28,479 --> 03:44:32,720
1983.
6003
03:44:30,000 --> 03:44:35,040
It was developed by David K of Bell Labs
6004
03:44:32,720 --> 03:44:37,680
again as a comprehensive combined
6005
03:44:35,040 --> 03:44:39,840
version of other major shells that were
6006
03:44:37,680 --> 03:44:42,000
present at that time. The initial
6007
03:44:39,840 --> 03:44:44,000
development was based on the bone shell
6008
03:44:42,000 --> 03:44:46,479
source code. Now the corn shell is
6009
03:44:44,000 --> 03:44:48,560
backward compatible with the bone shell
6010
03:44:46,479 --> 03:44:50,479
and includes many features of the C
6011
03:44:48,560 --> 03:44:54,080
shell as well. Now the corn shell
6012
03:44:50,479 --> 03:44:56,080
compiles with pix 2 shell and utilities.
6013
03:44:54,080 --> 03:44:58,399
Major differences between the corn shell
6014
03:44:56,080 --> 03:45:01,040
and the traditional bone shell include
6015
03:44:58,399 --> 03:45:03,359
job control, command aliasing and
6016
03:45:01,040 --> 03:45:05,920
command history that is designed after
6017
03:45:03,359 --> 03:45:09,120
the corresponding C shell features.
6018
03:45:05,920 --> 03:45:12,239
After the con shell, we have the 10X C
6019
03:45:09,120 --> 03:45:14,319
shell which was a derivative of your
6020
03:45:12,239 --> 03:45:16,960
basic C shell.
6021
03:45:14,319 --> 03:45:19,520
Now this shell in 1983 was essentially
6022
03:45:16,960 --> 03:45:21,680
the sea shell but with programmable
6023
03:45:19,520 --> 03:45:25,040
command line completion, command line
6024
03:45:21,680 --> 03:45:28,640
editing and a few other features. Then
6025
03:45:25,040 --> 03:45:31,520
we have bash which still remains one of
6026
03:45:28,640 --> 03:45:34,000
the most popular shells even in today's
6027
03:45:31,520 --> 03:45:36,720
time. Now this was written by Brian Fox
6028
03:45:34,000 --> 03:45:39,279
for the GNU project as a free software
6029
03:45:36,720 --> 03:45:41,680
replacement for the Bond shell. It had
6030
03:45:39,279 --> 03:45:44,000
been distributed widely as default login
6031
03:45:41,680 --> 03:45:46,640
shell for most Linux distributions and
6032
03:45:44,000 --> 03:45:49,199
Apple's Mac OS. Now the bash can also
6033
03:45:46,640 --> 03:45:51,279
read and execute commands from a file
6034
03:45:49,199 --> 03:45:53,920
like all Linux and Unix shells. It
6035
03:45:51,279 --> 03:45:56,880
supports file name globing piping here
6036
03:45:53,920 --> 03:45:58,880
documents and command substitution. The
6037
03:45:56,880 --> 03:46:01,439
keywords, syntax, and other basic
6038
03:45:58,880 --> 03:46:04,399
features of the language are all from
6039
03:46:01,439 --> 03:46:06,960
the basic shell. The shell's name is an
6040
03:46:04,399 --> 03:46:09,439
acronym for born again shell. a pun on
6041
03:46:06,960 --> 03:46:11,120
the name of the bone shell that it
6042
03:46:09,439 --> 03:46:13,680
replaces.
6043
03:46:11,120 --> 03:46:15,680
The bash command syntax is a superset of
6044
03:46:13,680 --> 03:46:18,000
the bone shell command syntax. It
6045
03:46:15,680 --> 03:46:20,160
supports brace expansion, command line
6046
03:46:18,000 --> 03:46:22,560
completion, basic debugging, and
6047
03:46:20,160 --> 03:46:24,960
exception handling using trap. Now, it
6048
03:46:22,560 --> 03:46:26,960
can execute the vast majority of shell
6049
03:46:24,960 --> 03:46:28,720
scripts without modification with the
6050
03:46:26,960 --> 03:46:31,199
exception of the bone shell scripts
6051
03:46:28,720 --> 03:46:33,520
tumbling into French syntax behavior.
6052
03:46:31,199 --> 03:46:35,520
The bash command syntax includes ideas
6053
03:46:33,520 --> 03:46:38,640
drawn from the corn shell and the sea
6054
03:46:35,520 --> 03:46:41,040
shell as well. After that, the world
6055
03:46:38,640 --> 03:46:43,680
came across various other shells such as
6056
03:46:41,040 --> 03:46:45,600
the public domain con shell which was
6057
03:46:43,680 --> 03:46:47,680
basically a public domain or a free
6058
03:46:45,600 --> 03:46:49,920
version of the corn shell. You had the
6059
03:46:47,680 --> 03:46:53,760
alchemist shell. Then you had the
6060
03:46:49,920 --> 03:46:56,880
extensible shell or the plan 9 shell.
6061
03:46:53,760 --> 03:47:00,800
Today we have many other shells namely
6062
03:46:56,880 --> 03:47:04,239
your Zshell, your DBN armquist shell or
6063
03:47:00,800 --> 03:47:06,960
the Dash shell and the Mir BSD corn
6064
03:47:04,239 --> 03:47:10,640
shell. In this segment I am going to
6065
03:47:06,960 --> 03:47:13,600
majorly focus on four shells which will
6066
03:47:10,640 --> 03:47:15,840
give you an idea of all the other
6067
03:47:13,600 --> 03:47:18,000
derivative shells as well. I'm going to
6068
03:47:15,840 --> 03:47:19,680
be talking about first the basic shell,
6069
03:47:18,000 --> 03:47:22,720
the bone shell. I'm going to talk about
6070
03:47:19,680 --> 03:47:26,160
the bornag again shell, the corn shell,
6071
03:47:22,720 --> 03:47:29,279
the 10x sea shell, and an exotic shell
6072
03:47:26,160 --> 03:47:31,600
called the scheme shell. Moving on,
6073
03:47:29,279 --> 03:47:34,960
let's talk a little bit about shell
6074
03:47:31,600 --> 03:47:38,000
versus bash. Now, most people use these
6075
03:47:34,960 --> 03:47:40,000
two terms synonymously, but they are not
6076
03:47:38,000 --> 03:47:41,840
the same thing.
6077
03:47:40,000 --> 03:47:43,600
Now, the shell command language is a
6078
03:47:41,840 --> 03:47:46,080
programming language which is described
6079
03:47:43,600 --> 03:47:49,120
by the posk standard. It has many
6080
03:47:46,080 --> 03:47:51,760
implementations including the bash. Now
6081
03:47:49,120 --> 03:47:55,439
because shell is a specification and not
6082
03:47:51,760 --> 03:47:58,640
an implementation, the /bin/sh
6083
03:47:55,439 --> 03:48:01,680
is a sim link or a hard link to an
6084
03:47:58,640 --> 03:48:05,359
actual implementation on most of the pix
6085
03:48:01,680 --> 03:48:08,080
systems. Now the bash started as a shell
6086
03:48:05,359 --> 03:48:10,800
compatible implementation but as time
6087
03:48:08,080 --> 03:48:12,880
passed it has acquired many extensions.
6088
03:48:10,800 --> 03:48:15,840
Now many of these extensions may change
6089
03:48:12,880 --> 03:48:19,279
the behavior of valid pix shell scripts.
6090
03:48:15,840 --> 03:48:22,160
So by itself bash is not a pix shell
6091
03:48:19,279 --> 03:48:24,960
rather it is a dialect of the pix shell.
6092
03:48:22,160 --> 03:48:27,920
So summarizing about this I would say
6093
03:48:24,960 --> 03:48:31,359
that shell is actually a specification
6094
03:48:27,920 --> 03:48:34,080
of which bash is an implementation. For
6095
03:48:31,359 --> 03:48:36,800
a long time the shebang line of the
6096
03:48:34,080 --> 03:48:39,920
shell script used to point to the bash
6097
03:48:36,800 --> 03:48:42,319
on most Linux systems. As a result, it
6098
03:48:39,920 --> 03:48:44,960
has become more safe to ignore the
6099
03:48:42,319 --> 03:48:47,040
difference between the two. But both of
6100
03:48:44,960 --> 03:48:49,600
them are pretty much different things.
6101
03:48:47,040 --> 03:48:52,880
With that, let's look at shell versus
6102
03:48:49,600 --> 03:48:55,279
bash versus a few other Linux shells.
6103
03:48:52,880 --> 03:48:57,040
First of all, the sea shell. Now, if
6104
03:48:55,279 --> 03:48:59,520
you're a network or systems
6105
03:48:57,040 --> 03:49:01,920
administrator in a Linux or Unix
6106
03:48:59,520 --> 03:49:04,239
environment, you will most certainly run
6107
03:49:01,920 --> 03:49:06,880
into the C shell. So, it is good to at
6108
03:49:04,239 --> 03:49:09,680
least have some familiarity with it. Now
6109
03:49:06,880 --> 03:49:12,000
casual users and even most developers
6110
03:49:09,680 --> 03:49:13,760
will probably suggest other shells. But
6111
03:49:12,000 --> 03:49:15,920
if you are comfortable with C
6112
03:49:13,760 --> 03:49:18,640
programming language then the C shell is
6113
03:49:15,920 --> 03:49:20,640
a great shell to begin with. Now the con
6114
03:49:18,640 --> 03:49:23,279
shell is the one that you can use
6115
03:49:20,640 --> 03:49:26,479
interactively to execute commands from
6116
03:49:23,279 --> 03:49:29,359
the command line or programmatically to
6117
03:49:26,479 --> 03:49:31,279
create scripts that can automate many
6118
03:49:29,359 --> 03:49:34,560
computer maintenance and system
6119
03:49:31,279 --> 03:49:37,359
administration tasks. Now, bash is far
6120
03:49:34,560 --> 03:49:40,560
too big a subject to be covered fully in
6121
03:49:37,359 --> 03:49:43,120
a single line, but it is one of the most
6122
03:49:40,560 --> 03:49:45,199
commonly used scripting languages that
6123
03:49:43,120 --> 03:49:47,840
you will find today. People are
6124
03:49:45,199 --> 03:49:49,920
comfortable with bash scripting and most
6125
03:49:47,840 --> 03:49:53,040
of the content that you will find around
6126
03:49:49,920 --> 03:49:54,479
shell scripting will be in bash. But you
6127
03:49:53,040 --> 03:49:56,960
should probably learn it for its
6128
03:49:54,479 --> 03:49:59,920
versatility and ease of use more than
6129
03:49:56,960 --> 03:50:02,479
anything. Most colleges and universities
6130
03:49:59,920 --> 03:50:04,319
teach their students to script in bash
6131
03:50:02,479 --> 03:50:07,439
because it's a great place to begin as
6132
03:50:04,319 --> 03:50:10,399
well. So now I'm going to run the same
6133
03:50:07,439 --> 03:50:12,720
script in three different shells which
6134
03:50:10,399 --> 03:50:14,880
are derivatives of the three most basic
6135
03:50:12,720 --> 03:50:17,120
shells which are your bond shell, your C
6136
03:50:14,880 --> 03:50:19,840
shell and your corn shell to see how
6137
03:50:17,120 --> 03:50:22,399
different or similar they are. So for
6138
03:50:19,840 --> 03:50:25,760
that I have opened up my terminal. This
6139
03:50:22,399 --> 03:50:28,160
is CentOS 7 the Fedora version. So what
6140
03:50:25,760 --> 03:50:29,600
I'm going to try to do is take a single
6141
03:50:28,160 --> 03:50:32,479
argument which is going to be a
6142
03:50:29,600 --> 03:50:36,479
directory name and my script is supposed
6143
03:50:32,479 --> 03:50:39,600
to search recursively for all executable
6144
03:50:36,479 --> 03:50:42,080
files in that directory along with the
6145
03:50:39,600 --> 03:50:44,319
number of files that are found. I'm
6146
03:50:42,080 --> 03:50:46,399
going to reuse this script design in
6147
03:50:44,319 --> 03:50:49,359
each of the examples to illustrate the
6148
03:50:46,399 --> 03:50:52,880
differences. So first let's see what
6149
03:50:49,359 --> 03:50:54,800
directories do we have. Okay. So what
6150
03:50:52,880 --> 03:50:59,600
I'm interested in is this Eclipse
6151
03:50:54,800 --> 03:51:03,279
directory. So what I'm going to do is
6152
03:50:59,600 --> 03:51:08,560
okay this is one file Java Oxygen. Let's
6153
03:51:03,279 --> 03:51:11,680
see if it's executable or not.
6154
03:51:08,560 --> 03:51:14,960
Okay, as we see the Java Oxygen file is
6155
03:51:11,680 --> 03:51:17,359
executable. So when I pass Eclipse as an
6156
03:51:14,960 --> 03:51:20,000
argument, this directory as an argument
6157
03:51:17,359 --> 03:51:23,520
to any of my scripts, I am supposed to
6158
03:51:20,000 --> 03:51:25,520
get an answer that this Java oxygen file
6159
03:51:23,520 --> 03:51:27,760
is executable and the number of
6160
03:51:25,520 --> 03:51:30,319
executable files found in that
6161
03:51:27,760 --> 03:51:32,960
particular directory is equal to 1. So
6162
03:51:30,319 --> 03:51:38,000
first I'm going to run the 10x shell and
6163
03:51:32,960 --> 03:51:41,760
see. So I'm going to go and open up this
6164
03:51:38,000 --> 03:51:44,960
10x shell. So basically what I did is
6165
03:51:41,760 --> 03:51:48,080
open up my 10x script. It's divided into
6166
03:51:44,960 --> 03:51:50,800
three basic sections. First note that I
6167
03:51:48,080 --> 03:51:53,840
use the shebang symbol to declare this
6168
03:51:50,800 --> 03:51:56,720
file as interpretable by the defined
6169
03:51:53,840 --> 03:51:59,920
shell. This allows me to execute the
6170
03:51:56,720 --> 03:52:02,560
file as a regular executable rather than
6171
03:51:59,920 --> 03:52:04,720
proceed it with an interpreter binary.
6172
03:52:02,560 --> 03:52:07,600
All right. It maintains a count of the
6173
03:52:04,720 --> 03:52:11,760
executable files found. So I initialize
6174
03:52:07,600 --> 03:52:15,279
this count with zero here. So the first
6175
03:52:11,760 --> 03:52:18,080
section, this section right here tests
6176
03:52:15,279 --> 03:52:19,600
the arguments passed by the user. This
6177
03:52:18,080 --> 03:52:21,359
arg
6178
03:52:19,600 --> 03:52:24,479
variable represents the number of
6179
03:52:21,359 --> 03:52:26,880
arguments that are passed excluding the
6180
03:52:24,479 --> 03:52:29,040
command name itself. Now you can access
6181
03:52:26,880 --> 03:52:32,560
these arguments by specifying their
6182
03:52:29,040 --> 03:52:34,800
index. For example, if I say this hash
6183
03:52:32,560 --> 03:52:37,520
one, it refers to the first argument.
6184
03:52:34,800 --> 03:52:39,760
The script is expecting one argument. If
6185
03:52:37,520 --> 03:52:43,279
it doesn't find it, it emits an error
6186
03:52:39,760 --> 03:52:45,040
image. So using this dollar 0, I'm going
6187
03:52:43,279 --> 03:52:46,880
to indicate the command name that was
6188
03:52:45,040 --> 03:52:50,399
typed. Now let's come to the second
6189
03:52:46,880 --> 03:52:54,560
section. This basically ensures that the
6190
03:52:50,399 --> 03:52:57,199
argument passed in was a directory. The
6191
03:52:54,560 --> 03:52:59,680
d operator here, the hyphen d operator
6192
03:52:57,199 --> 03:53:03,600
here returns true if the argument is a
6193
03:52:59,680 --> 03:53:06,080
directory. But note that I specify a not
6194
03:53:03,600 --> 03:53:08,720
directory sign here. This exclamatory
6195
03:53:06,080 --> 03:53:11,199
symbol which means negate. Now this way
6196
03:53:08,720 --> 03:53:13,439
the expression says that if an argument
6197
03:53:11,199 --> 03:53:16,000
is not a directory you emit an error
6198
03:53:13,439 --> 03:53:19,040
message which is this one. And for the
6199
03:53:16,000 --> 03:53:21,520
final section it iterates the files in
6200
03:53:19,040 --> 03:53:24,479
the directory to test whether they are
6201
03:53:21,520 --> 03:53:27,840
executable. I use the convenient for
6202
03:53:24,479 --> 03:53:30,239
each iterator which loops through each
6203
03:53:27,840 --> 03:53:32,319
entry in the parenthesis in this case
6204
03:53:30,239 --> 03:53:34,640
which is the directory and then tests
6205
03:53:32,319 --> 03:53:38,640
each as a part of the loop. Now this
6206
03:53:34,640 --> 03:53:40,960
step here uses the hyphen x operator to
6207
03:53:38,640 --> 03:53:43,199
test whether the file is an executable.
6208
03:53:40,960 --> 03:53:45,760
If it is the file is emitted and the
6209
03:53:43,199 --> 03:53:49,520
count is increased. I end the script by
6210
03:53:45,760 --> 03:53:51,920
emitting the count of executables here.
6211
03:53:49,520 --> 03:53:54,960
Okay. So now that we have understood
6212
03:53:51,920 --> 03:53:58,199
what the script is, let's go ahead and
6213
03:53:54,960 --> 03:53:58,199
run this
6214
03:53:58,720 --> 03:54:04,800
and then I'm going to toy Eclipse.
6215
03:54:02,479 --> 03:54:08,080
And as we had predicted, it says that
6216
03:54:04,800 --> 03:54:11,359
Java oxygen is your executable file and
6217
03:54:08,080 --> 03:54:14,080
one executable files found. Now let me
6218
03:54:11,359 --> 03:54:16,880
clear this out for you.
6219
03:54:14,080 --> 03:54:20,000
Next, let's try doing the same thing
6220
03:54:16,880 --> 03:54:23,120
with our corn shell.
6221
03:54:20,000 --> 03:54:25,680
Now this is the code. Now as you can see
6222
03:54:23,120 --> 03:54:27,680
our shebang line immediately it's
6223
03:54:25,680 --> 03:54:29,920
different. Now this corn shell is a
6224
03:54:27,680 --> 03:54:32,239
derivative of the bone shell and it
6225
03:54:29,920 --> 03:54:35,199
looks so much more similar to it than
6226
03:54:32,239 --> 03:54:36,960
the sea shell. So let's look at our
6227
03:54:35,199 --> 03:54:40,720
example again. Now the first thing
6228
03:54:36,960 --> 03:54:43,840
you'll notice here is its similarity to
6229
03:54:40,720 --> 03:54:47,840
the first code that I had put up. Let me
6230
03:54:43,840 --> 03:54:50,399
open it side by side for you.
6231
03:54:47,840 --> 03:54:54,319
Okay. So what I'm going to do is I am
6232
03:54:50,399 --> 03:54:56,479
going to open another new terminal. Let
6233
03:54:54,319 --> 03:55:00,560
me just open another tab right here,
6234
03:54:56,479 --> 03:55:02,560
another new window. So I can basically
6235
03:55:00,560 --> 03:55:04,160
show you the similarity between both of
6236
03:55:02,560 --> 03:55:08,080
these.
6237
03:55:04,160 --> 03:55:10,720
So I'm going to go ahead and
6238
03:55:08,080 --> 03:55:13,600
Okay, now we have these two on both
6239
03:55:10,720 --> 03:55:16,560
sides. So the first thing you'll notice
6240
03:55:13,600 --> 03:55:19,279
on your con shell script is its
6241
03:55:16,560 --> 03:55:21,840
similarity to the 10x shell script.
6242
03:55:19,279 --> 03:55:24,800
Structurally the script is almost
6243
03:55:21,840 --> 03:55:26,239
identical. The first, second, and third
6244
03:55:24,800 --> 03:55:28,560
parts of the script, you have your test
6245
03:55:26,239 --> 03:55:30,319
arguments. Then you have your ensure
6246
03:55:28,560 --> 03:55:32,479
argument which is a directory and then
6247
03:55:30,319 --> 03:55:34,479
you iterate the directory to emit the
6248
03:55:32,479 --> 03:55:37,680
executable files. But the key
6249
03:55:34,479 --> 03:55:40,319
differences are evident in the way
6250
03:55:37,680 --> 03:55:42,800
conditionals, expressions and the
6251
03:55:40,319 --> 03:55:45,040
iteration is performed. For example,
6252
03:55:42,800 --> 03:55:48,720
instead of operating C like test
6253
03:55:45,040 --> 03:55:51,760
operators, the KSH adopts the typical
6254
03:55:48,720 --> 03:55:56,319
bond style operators. So here you can
6255
03:55:51,760 --> 03:55:59,040
see this not equal to versus here this
6256
03:55:56,319 --> 03:56:00,720
not equal to. Now the corn shell also
6257
03:55:59,040 --> 03:56:03,040
has some differences related to the
6258
03:56:00,720 --> 03:56:05,520
iteration. Now in the corn shell the
6259
03:56:03,040 --> 03:56:07,439
forin structure is used with the command
6260
03:56:05,520 --> 03:56:09,760
substitution to represent the list of
6261
03:56:07,439 --> 03:56:12,160
files created from the standard output
6262
03:56:09,760 --> 03:56:14,479
of the command ls representing the
6263
03:56:12,160 --> 03:56:16,800
contents of the name subdirectory in
6264
03:56:14,479 --> 03:56:19,439
addition to the other features defined
6265
03:56:16,800 --> 03:56:22,319
here. The con supports the alias feature
6266
03:56:19,439 --> 03:56:24,080
to replace a word with the userdefined
6267
03:56:22,319 --> 03:56:26,800
string. Now the con has many other
6268
03:56:24,080 --> 03:56:29,439
features that are disabled by default
6269
03:56:26,800 --> 03:56:32,399
such as file name completion but you can
6270
03:56:29,439 --> 03:56:35,279
enable it if you want to. So let me
6271
03:56:32,399 --> 03:56:36,960
close this. So let's try running this
6272
03:56:35,279 --> 03:56:39,520
file
6273
03:56:36,960 --> 03:56:42,720
and let's put in Eclipse again. And as
6274
03:56:39,520 --> 03:56:45,279
you see the answer is the same. Okay.
6275
03:56:42,720 --> 03:56:50,000
Finally we going to try the same thing
6276
03:56:45,279 --> 03:56:52,080
using the bash or the born again shell.
6277
03:56:50,000 --> 03:56:54,000
Now the bash has continued to evolve
6278
03:56:52,080 --> 03:56:56,560
with new features, support for regular
6279
03:56:54,000 --> 03:56:58,640
expressions and associative arrays. Now
6280
03:56:56,560 --> 03:57:01,439
although some of these features may not
6281
03:56:58,640 --> 03:57:03,520
be present in other scripting languages,
6282
03:57:01,439 --> 03:57:06,640
it's possible to write scripts that are
6283
03:57:03,520 --> 03:57:10,080
compatible with other languages. To this
6284
03:57:06,640 --> 03:57:12,160
point, this script that you see here is
6285
03:57:10,080 --> 03:57:15,120
identical to the corn shell script
6286
03:57:12,160 --> 03:57:18,640
except for the shebang difference. Let
6287
03:57:15,120 --> 03:57:20,800
me open the corn shell real quick and
6288
03:57:18,640 --> 03:57:23,800
give you a sidebyside comparison on
6289
03:57:20,800 --> 03:57:23,800
this.
6290
03:57:24,560 --> 03:57:30,479
Okay, so as you can see it's pretty much
6291
03:57:27,760 --> 03:57:32,720
the same except for your shebang line
6292
03:57:30,479 --> 03:57:35,359
which obviously has to be different
6293
03:57:32,720 --> 03:57:38,000
because of where they are pointing. One
6294
03:57:35,359 --> 03:57:40,160
key difference among these shells is the
6295
03:57:38,000 --> 03:57:42,960
licenses under which they are released.
6296
03:57:40,160 --> 03:57:46,319
Now the bash as you would expect having
6297
03:57:42,960 --> 03:57:50,080
been developed by the GNU project is
6298
03:57:46,319 --> 03:57:52,960
released under GPL but the C shell 10X C
6299
03:57:50,080 --> 03:57:55,920
shell Z shell and so on are released
6300
03:57:52,960 --> 03:57:58,000
under BSD in BSD like license. The con
6301
03:57:55,920 --> 03:58:01,359
shell is available under the common
6302
03:57:58,000 --> 03:58:03,439
public license but apart from that as
6303
03:58:01,359 --> 03:58:06,720
you can see the way you write the script
6304
03:58:03,439 --> 03:58:10,319
in bash and con is the same except for
6305
03:58:06,720 --> 03:58:14,760
their shebang line. So let me just
6306
03:58:10,319 --> 03:58:14,760
run this and show it to you.
6307
03:58:16,319 --> 03:58:22,640
And as you can see the answer is the
6308
03:58:19,520 --> 03:58:25,520
same. Now my point being why I chose
6309
03:58:22,640 --> 03:58:28,399
these three specific shells is that
6310
03:58:25,520 --> 03:58:30,479
it'll give you an idea of how all the
6311
03:58:28,399 --> 03:58:32,720
other derivative shells work. More or
6312
03:58:30,479 --> 03:58:35,680
less it's going to be similar to these
6313
03:58:32,720 --> 03:58:38,080
three basic shells. Else your logic will
6314
03:58:35,680 --> 03:58:41,199
always remain the same. With that, let
6315
03:58:38,080 --> 03:58:43,520
me move back to my presentation.
6316
03:58:41,199 --> 03:58:46,080
Now, apart from these, you can go ahead
6317
03:58:43,520 --> 03:58:48,479
and pick the shell you like. Many of the
6318
03:58:46,080 --> 03:58:51,520
ideas and much of the interfaces of the
6319
03:58:48,479 --> 03:58:54,000
shells remain the same almost 35 years
6320
03:58:51,520 --> 03:58:57,040
later. A tremendous testament to the
6321
03:58:54,000 --> 03:58:59,520
original authors of the early shells.
6322
03:58:57,040 --> 03:59:01,840
Now, in an industry that continuously
6323
03:58:59,520 --> 03:59:04,160
reinvents itself, the shell has been
6324
03:59:01,840 --> 03:59:06,239
improved upon, but not substantially
6325
03:59:04,160 --> 03:59:08,319
changed. Although there have been
6326
03:59:06,239 --> 03:59:10,800
attempts to create specialized shells,
6327
03:59:08,319 --> 03:59:13,359
customized shells, the bond shell
6328
03:59:10,800 --> 03:59:17,000
derivatives continue to be the primary
6329
03:59:13,359 --> 03:59:17,000
shells in use.
6330
03:59:20,960 --> 03:59:27,520
Let's look at our hardware requirements.
6331
03:59:24,479 --> 03:59:31,040
You should have a system with at least 2
6332
03:59:27,520 --> 03:59:34,640
GHz dualcore processor or better, a
6333
03:59:31,040 --> 03:59:38,000
system memory of 4GB or more, and a
6334
03:59:34,640 --> 03:59:42,000
recommended free disk space of at least
6335
03:59:38,000 --> 03:59:44,720
25GB. Now, let's look at the software
6336
03:59:42,000 --> 03:59:47,040
requirements. We are going to be doing
6337
03:59:44,720 --> 03:59:49,920
this on our system with Windows 10
6338
03:59:47,040 --> 03:59:52,800
installed. Also, we are going to use a
6339
03:59:49,920 --> 03:59:56,720
tool called Virtual Box. Alternatives to
6340
03:59:52,800 --> 03:59:59,840
this also exist like VMware but we will
6341
03:59:56,720 --> 04:00:02,960
be using Virtual Box here. Also, it is
6342
03:59:59,840 --> 04:00:05,600
important that you enable virtualization
6343
04:00:02,960 --> 04:00:09,359
in your BIOS settings for the PC
6344
04:00:05,600 --> 04:00:12,880
otherwise virtual box won't run. So,
6345
04:00:09,359 --> 04:00:16,160
let's move on to the demo part. Setting
6346
04:00:12,880 --> 04:00:18,640
up the Linux VM on our system has two
6347
04:00:16,160 --> 04:00:21,680
major steps. The first thing for you to
6348
04:00:18,640 --> 04:00:24,560
do is download the virtual box utility.
6349
04:00:21,680 --> 04:00:27,040
And second is to download Linux. We will
6350
04:00:24,560 --> 04:00:29,680
be using YUbuntu here which is a very
6351
04:00:27,040 --> 04:00:33,439
popular Linux distribution. So let's
6352
04:00:29,680 --> 04:00:35,600
first go ahead and download Virtual Box.
6353
04:00:33,439 --> 04:00:38,399
Open the link and go to your download
6354
04:00:35,600 --> 04:00:41,680
section. As I'm having Windows here,
6355
04:00:38,399 --> 04:00:44,560
I'll click on this and then my setup
6356
04:00:41,680 --> 04:00:47,120
should start. Now I'll just cancel this
6357
04:00:44,560 --> 04:00:49,760
setup because I have already downloaded
6358
04:00:47,120 --> 04:00:53,279
the file before. As you can see I have
6359
04:00:49,760 --> 04:00:55,120
my file here and the other thing for you
6360
04:00:53,279 --> 04:00:58,479
to do is to download the Linux
6361
04:00:55,120 --> 04:01:01,520
distribution. So to do that type in
6362
04:00:58,479 --> 04:01:04,399
yubuntu download
6363
04:01:01,520 --> 04:01:06,160
here you can download the latest Ubuntu
6364
04:01:04,399 --> 04:01:07,840
and as you can see it has the
6365
04:01:06,160 --> 04:01:10,319
recommended systems requirement over
6366
04:01:07,840 --> 04:01:12,479
here which we talked about before. To
6367
04:01:10,319 --> 04:01:15,359
download the Ubuntu, you click on this
6368
04:01:12,479 --> 04:01:17,680
download button and soon enough the
6369
04:01:15,359 --> 04:01:20,800
download should begin.
6370
04:01:17,680 --> 04:01:23,199
Now the download process starts. But I
6371
04:01:20,800 --> 04:01:26,640
have already downloaded this as well on
6372
04:01:23,199 --> 04:01:31,680
my system. So I have my Virtual Box over
6373
04:01:26,640 --> 04:01:34,720
here with my Linux distribution here. So
6374
04:01:31,680 --> 04:01:38,160
let's install Virtual Box first. To do
6375
04:01:34,720 --> 04:01:41,040
this, open the setup and follow these
6376
04:01:38,160 --> 04:01:41,040
steps.
6377
04:01:41,439 --> 04:01:48,640
Now we can start installing the Oracle
6378
04:01:44,399 --> 04:01:51,279
virtual box. So click next and go with
6379
04:01:48,640 --> 04:01:55,199
the normal location
6380
04:01:51,279 --> 04:01:57,439
and continue clicking next. And this
6381
04:01:55,199 --> 04:02:00,319
shows warning here but don't be worried
6382
04:01:57,439 --> 04:02:05,399
about it. This won't have any issues. So
6383
04:02:00,319 --> 04:02:05,399
click on yes and then install.
6384
04:02:09,359 --> 04:02:16,640
Now that the installation has finished,
6385
04:02:12,080 --> 04:02:19,920
let's start our virtual box. So now that
6386
04:02:16,640 --> 04:02:22,640
the virtual box is now open, we need to
6387
04:02:19,920 --> 04:02:25,279
create a new VM. So to do this, we click
6388
04:02:22,640 --> 04:02:27,520
on this button new and we provide it a
6389
04:02:25,279 --> 04:02:32,720
name
6390
04:02:27,520 --> 04:02:35,520
and I provide it up to 4 GB of RAM. Now
6391
04:02:32,720 --> 04:02:38,000
I'll create my hard disk and this will
6392
04:02:35,520 --> 04:02:40,239
be dynamically allocated. Now that you
6393
04:02:38,000 --> 04:02:44,319
have this set up, what you need to do is
6394
04:02:40,239 --> 04:02:47,760
that you need to copy this ISO image and
6395
04:02:44,319 --> 04:02:51,520
load it into our VM. So to do that you
6396
04:02:47,760 --> 04:02:55,760
need to click on settings here
6397
04:02:51,520 --> 04:03:00,560
and select this.
6398
04:02:55,760 --> 04:03:03,199
Now provide it with your file.
6399
04:03:00,560 --> 04:03:06,560
So I select my Ubuntu here. This is my
6400
04:03:03,199 --> 04:03:12,439
Ubuntu image and I'll open it.
6401
04:03:06,560 --> 04:03:12,439
Now hit okay and start the VM.
6402
04:03:16,960 --> 04:03:24,560
Now let's maximize this. And here I'll
6403
04:03:21,600 --> 04:03:26,720
select the first option.
6404
04:03:24,560 --> 04:03:29,680
So because this is your first time doing
6405
04:03:26,720 --> 04:03:32,319
this, it might take up to like 2 hours
6406
04:03:29,680 --> 04:03:34,800
at max for you to set up this
6407
04:03:32,319 --> 04:03:38,160
environment.
6408
04:03:34,800 --> 04:03:41,640
Now click on install Ubuntu and follow
6409
04:03:38,160 --> 04:03:41,640
along the instructions.
6410
04:04:09,279 --> 04:04:13,399
Now restart your system.
6411
04:04:16,239 --> 04:04:24,840
Now you should have a working Ubuntu
6412
04:04:19,520 --> 04:04:24,840
system on your virtual box.
6413
04:04:25,840 --> 04:04:31,840
And with that the demo is concluded. In
6414
04:04:29,760 --> 04:04:34,479
this way, you can set up a number of
6415
04:04:31,840 --> 04:04:38,840
virtual machines on your system and
6416
04:04:34,479 --> 04:04:38,840
continue your DevOps journey.
6417
04:04:42,319 --> 04:04:46,080
The first thing we talk about is the
6418
04:04:43,920 --> 04:04:48,560
Linux directory commands. So, what we'll
6419
04:04:46,080 --> 04:04:50,880
do here is we'll take a look at each
6420
04:04:48,560 --> 04:04:55,040
command and what they work like in
6421
04:04:50,880 --> 04:04:58,000
Linux. So, the first command is the pwd
6422
04:04:55,040 --> 04:04:59,840
command, right? So the pwd command is
6423
04:04:58,000 --> 04:05:02,319
basically used to display the location
6424
04:04:59,840 --> 04:05:04,880
of your current working directory. Now
6425
04:05:02,319 --> 04:05:07,359
directory is basically a file. You have
6426
04:05:04,880 --> 04:05:09,680
to realize that everything in Linux is a
6427
04:05:07,359 --> 04:05:11,920
file. So directory is a file which
6428
04:05:09,680 --> 04:05:14,319
contains other files as well. Right? So
6429
04:05:11,920 --> 04:05:16,640
the pwd file is used to display the
6430
04:05:14,319 --> 04:05:18,880
location of the current working file
6431
04:05:16,640 --> 04:05:21,439
directory that you have. Let's take a
6432
04:05:18,880 --> 04:05:23,600
look at it. As you can see pwd is the
6433
04:05:21,439 --> 04:05:25,520
syntax for it and it basically shows you
6434
04:05:23,600 --> 04:05:29,120
whichever directory you have. So let's
6435
04:05:25,520 --> 04:05:31,760
take a look at it, right? Then so let's
6436
04:05:29,120 --> 04:05:35,680
say you want to check out the directory
6437
04:05:31,760 --> 04:05:41,120
for one of your files. So let's say you
6438
04:05:35,680 --> 04:05:44,399
go to files and you open up terminal
6439
04:05:41,120 --> 04:05:48,319
and then you type in pwd.
6440
04:05:44,399 --> 04:05:52,640
So this is basically your directory. It
6441
04:05:48,319 --> 04:05:55,040
is in home and KB is the user, right? So
6442
04:05:52,640 --> 04:05:58,239
this is basically what pwd does. Moving
6443
04:05:55,040 --> 04:06:00,640
on to the next command. So next up we
6444
04:05:58,239 --> 04:06:03,920
have the second command which is the
6445
04:06:00,640 --> 04:06:05,840
mkdir which is basically make directory.
6446
04:06:03,920 --> 04:06:08,000
Now make directory is used to make
6447
04:06:05,840 --> 04:06:09,920
different new directories under any
6448
04:06:08,000 --> 04:06:11,840
directory that is already there. So
6449
04:06:09,920 --> 04:06:14,960
let's say for example we've already seen
6450
04:06:11,840 --> 04:06:16,640
that we are in the directory home and if
6451
04:06:14,960 --> 04:06:18,720
you want to make a new directory under
6452
04:06:16,640 --> 04:06:21,600
any existing directories that are
6453
04:06:18,720 --> 04:06:24,560
present in Linux you use the mkdir
6454
04:06:21,600 --> 04:06:26,800
command and for syntax of the command
6455
04:06:24,560 --> 04:06:29,279
you'll have mkdir and then your
6456
04:06:26,800 --> 04:06:31,439
directory name right so let's say for
6457
04:06:29,279 --> 04:06:33,279
example if you want to name your new
6458
04:06:31,439 --> 04:06:36,479
directory then you just have to write
6459
04:06:33,279 --> 04:06:38,800
mkdir and new directory so let's take a
6460
04:06:36,479 --> 04:06:40,720
look at it right so you're already here
6461
04:06:38,800 --> 04:06:43,359
in the terminal and you're inside the
6462
04:06:40,720 --> 04:06:46,319
directory right with pwd.
6463
04:06:43,359 --> 04:06:48,880
So what we do here is you make a new
6464
04:06:46,319 --> 04:06:53,040
directory say mkdir
6465
04:06:48,880 --> 04:06:56,000
and let's say new diir.
6466
04:06:53,040 --> 04:06:59,439
So now if you basically ls into it we'll
6467
04:06:56,000 --> 04:07:01,279
come to ls later but if you ls into it
6468
04:06:59,439 --> 04:07:03,920
you can see there's a new directory that
6469
04:07:01,279 --> 04:07:07,359
has been formed here. So this is the
6470
04:07:03,920 --> 04:07:10,479
mkdir command. So moving on to the next
6471
04:07:07,359 --> 04:07:12,880
one. So the next one is basically
6472
04:07:10,479 --> 04:07:14,880
another command called rmdir. Just like
6473
04:07:12,880 --> 04:07:17,600
you make a directory, you can also
6474
04:07:14,880 --> 04:07:19,760
remove a directory. So remove directory
6475
04:07:17,600 --> 04:07:21,920
is basically used to delete a directory
6476
04:07:19,760 --> 04:07:24,239
that you've already created. And to
6477
04:07:21,920 --> 04:07:27,199
basically make that happen, you'll have
6478
04:07:24,239 --> 04:07:29,680
to type in rmdir and your directory
6479
04:07:27,199 --> 04:07:32,160
name. So let's take a look at how it
6480
04:07:29,680 --> 04:07:34,800
works. Right? So as you can see here,
6481
04:07:32,160 --> 04:07:38,000
you've made a new directory called new
6482
04:07:34,800 --> 04:07:44,560
diir. So to delete it all you have to do
6483
04:07:38,000 --> 04:07:46,479
is rmd diir and directory and it has
6484
04:07:44,560 --> 04:07:48,319
been removed. Now if you cross check it
6485
04:07:46,479 --> 04:07:50,800
you'll see that your directory has been
6486
04:07:48,319 --> 04:07:53,920
removed. Right? So this is how remove
6487
04:07:50,800 --> 04:07:56,560
directory command works. Rmdir. Moving
6488
04:07:53,920 --> 04:07:59,199
on to the next command. Next up we
6489
04:07:56,560 --> 04:08:01,920
basically have the ls command. Like in
6490
04:07:59,199 --> 04:08:03,760
previous examples we used ls right. So l
6491
04:08:01,920 --> 04:08:06,479
command is used to display a list of the
6492
04:08:03,760 --> 04:08:09,680
content that is present in a directory.
6493
04:08:06,479 --> 04:08:11,520
So let's say you have a directory which
6494
04:08:09,680 --> 04:08:13,840
is the home directory and you want to
6495
04:08:11,520 --> 04:08:16,000
see what's present inside that
6496
04:08:13,840 --> 04:08:18,080
directory. So if you just type in ls
6497
04:08:16,000 --> 04:08:20,319
it'll show you all of the files present
6498
04:08:18,080 --> 04:08:22,560
in the present directory there. And for
6499
04:08:20,319 --> 04:08:24,160
the syntax you just need to type in ls
6500
04:08:22,560 --> 04:08:27,359
and you'll get all the files that's
6501
04:08:24,160 --> 04:08:30,080
there. So let's just check it out. So
6502
04:08:27,359 --> 04:08:32,880
suppose you want to check out the system
6503
04:08:30,080 --> 04:08:34,960
files inside your directory. So if you
6504
04:08:32,880 --> 04:08:39,040
go to your computer directory, you'll
6505
04:08:34,960 --> 04:08:40,720
just type in ls in the terminal. And
6506
04:08:39,040 --> 04:08:43,199
these are all the files that is present
6507
04:08:40,720 --> 04:08:46,319
in this directory which is the my
6508
04:08:43,199 --> 04:08:47,920
computer for Linux. Since there is no my
6509
04:08:46,319 --> 04:08:49,920
computer for Linux, you'll have all
6510
04:08:47,920 --> 04:08:53,520
these files, the system files that you
6511
04:08:49,920 --> 04:08:56,319
have. So this is basically what ls does.
6512
04:08:53,520 --> 04:08:58,479
So ls basically just displays the
6513
04:08:56,319 --> 04:08:59,840
contents of the directory that's there.
6514
04:08:58,479 --> 04:09:01,680
Right? Now if you want to see which
6515
04:08:59,840 --> 04:09:04,160
directory I'm talking about I'm talking
6516
04:09:01,680 --> 04:09:06,560
about this directory which is computer.
6517
04:09:04,160 --> 04:09:11,840
Right? All of these files that you see
6518
04:09:06,560 --> 04:09:14,720
bin boot dev etc. All you got to do is
6519
04:09:11,840 --> 04:09:17,600
just type in ls and you can see them. So
6520
04:09:14,720 --> 04:09:20,000
this is the ls command. So moving on to
6521
04:09:17,600 --> 04:09:22,399
the next command.
6522
04:09:20,000 --> 04:09:24,479
So the next command we see is basically
6523
04:09:22,399 --> 04:09:26,720
the cd command. Now the cd command is
6524
04:09:24,479 --> 04:09:29,279
used to change the directory that you're
6525
04:09:26,720 --> 04:09:30,880
currently in. Right? So if you go to the
6526
04:09:29,279 --> 04:09:33,199
computer directory with all the system
6527
04:09:30,880 --> 04:09:34,880
files that's there just type in ls and
6528
04:09:33,199 --> 04:09:37,279
you can basically see all the files
6529
04:09:34,880 --> 04:09:38,960
that's there. Right? So you want to go
6530
04:09:37,279 --> 04:09:40,640
into one of those files and check the
6531
04:09:38,960 --> 04:09:42,640
contents of those files. Right? You want
6532
04:09:40,640 --> 04:09:44,479
to change the directory. Now these are
6533
04:09:42,640 --> 04:09:47,199
subdirectories that are already present
6534
04:09:44,479 --> 04:09:50,560
in the computer directory. Right? So you
6535
04:09:47,199 --> 04:09:53,680
just change directory to let's say bin
6536
04:09:50,560 --> 04:09:56,960
or library or dev. So you just need to
6537
04:09:53,680 --> 04:09:58,960
type cd change directory and the name of
6538
04:09:56,960 --> 04:10:00,880
the directory right and you will
6539
04:09:58,960 --> 04:10:04,080
basically get into that directory. So
6540
04:10:00,880 --> 04:10:06,319
let's just check it out. So basically
6541
04:10:04,080 --> 04:10:07,840
guys if you can go to terminal you see
6542
04:10:06,319 --> 04:10:10,319
right right now you're in the root
6543
04:10:07,840 --> 04:10:13,120
directory. The root directory is always
6544
04:10:10,319 --> 04:10:15,760
shown as a slash. It's a forward slash
6545
04:10:13,120 --> 04:10:18,319
right? So if you want to change
6546
04:10:15,760 --> 04:10:20,880
directories, let's say let's check out
6547
04:10:18,319 --> 04:10:22,960
the directories that are there to check
6548
04:10:20,880 --> 04:10:26,080
out the contents of your root directory,
6549
04:10:22,960 --> 04:10:28,479
you will just have to type ls and you
6550
04:10:26,080 --> 04:10:30,080
can see these are directories. So to
6551
04:10:28,479 --> 04:10:33,359
change the directory, what you have to
6552
04:10:30,080 --> 04:10:35,520
do is simply type in cd and choose any
6553
04:10:33,359 --> 04:10:38,479
of these directories that you have.
6554
04:10:35,520 --> 04:10:42,080
Let's say you want to get it to bin.
6555
04:10:38,479 --> 04:10:44,160
And that's it. You go into bin. Now your
6556
04:10:42,080 --> 04:10:46,479
directory has changed from the root
6557
04:10:44,160 --> 04:10:48,399
directory to the bin directory. Now the
6558
04:10:46,479 --> 04:10:50,640
bin directory is a part of the root
6559
04:10:48,399 --> 04:10:52,640
directory. So we have slash and then
6560
04:10:50,640 --> 04:10:55,120
bin. But now you've changed your
6561
04:10:52,640 --> 04:10:58,080
directory to bin. So this is the cd
6562
04:10:55,120 --> 04:11:00,000
command. So moving on. First we saw the
6563
04:10:58,080 --> 04:11:02,479
Linux directory commands. Now we move on
6564
04:11:00,000 --> 04:11:04,160
to the Linux file commands. So there are
6565
04:11:02,479 --> 04:11:06,399
various Linux file commands. The first
6566
04:11:04,160 --> 04:11:08,239
one we talk about is the touch command.
6567
04:11:06,399 --> 04:11:10,960
So basically the touch command is used
6568
04:11:08,239 --> 04:11:13,040
to create empty files and you can create
6569
04:11:10,960 --> 04:11:15,279
multiple files by executing the touch
6570
04:11:13,040 --> 04:11:17,920
command only once. For example, if you
6571
04:11:15,279 --> 04:11:19,840
see here you can create a empty file
6572
04:11:17,920 --> 04:11:22,880
called file.txt
6573
04:11:19,840 --> 04:11:25,439
and you can also create two files in the
6574
04:11:22,880 --> 04:11:28,239
same command. So you now as you can see
6575
04:11:25,439 --> 04:11:29,840
if you type in touch file 2 or file
6576
04:11:28,239 --> 04:11:32,000
three or whatever the name of your file
6577
04:11:29,840 --> 04:11:34,720
might be you can create any number of
6578
04:11:32,000 --> 04:11:36,800
files at one go. So this is basically
6579
04:11:34,720 --> 04:11:39,680
what touch is used for. And for the
6580
04:11:36,800 --> 04:11:42,960
syntax touch basically you have to write
6581
04:11:39,680 --> 04:11:45,520
touch and then the file name. And if you
6582
04:11:42,960 --> 04:11:48,239
want to make two or more files together,
6583
04:11:45,520 --> 04:11:50,800
you can write touch and then add the
6584
04:11:48,239 --> 04:11:54,080
file names one after the other. So let's
6585
04:11:50,800 --> 04:11:57,040
check it out. So guys, I'll basically
6586
04:11:54,080 --> 04:12:00,239
make a file in this folder called Linux
6587
04:11:57,040 --> 04:12:02,800
that I have. Right? So all I need to do
6588
04:12:00,239 --> 04:12:05,600
is just as you can see there are other
6589
04:12:02,800 --> 04:12:08,000
files as well. So let's see how we can
6590
04:12:05,600 --> 04:12:11,199
create a new file and all you have to do
6591
04:12:08,000 --> 04:12:14,239
is open a terminal. So guys as you can
6592
04:12:11,199 --> 04:12:17,199
see I've basically just cded into this
6593
04:12:14,239 --> 04:12:20,000
and it's in the Linux folder like we saw
6594
04:12:17,199 --> 04:12:23,439
before and we'll create a new file. Just
6595
04:12:20,000 --> 04:12:25,120
to do that you'll have to type touch and
6596
04:12:23,439 --> 04:12:28,720
edurea
6597
04:12:25,120 --> 04:12:32,239
2 for example and after that you'll just
6598
04:12:28,720 --> 04:12:33,920
have to check it out. So edurea 2 is
6599
04:12:32,239 --> 04:12:35,920
basically a file that you've just
6600
04:12:33,920 --> 04:12:37,920
created. Now if you want to create
6601
04:12:35,920 --> 04:12:40,080
another file for example two files
6602
04:12:37,920 --> 04:12:42,880
together let's check that out as well.
6603
04:12:40,080 --> 04:12:44,479
Let's first clear this out. So to clear
6604
04:12:42,880 --> 04:12:47,920
your terminal you'll just have to type
6605
04:12:44,479 --> 04:12:50,080
in clear and that's it. Right. So let's
6606
04:12:47,920 --> 04:12:52,000
create more than one file together with
6607
04:12:50,080 --> 04:12:56,000
one command. You'll have to type in
6608
04:12:52,000 --> 04:13:00,399
touch and name of your file. Let's say
6609
04:12:56,000 --> 04:13:04,880
my name is Korak. I will type korok11
6610
04:13:00,399 --> 04:13:07,840
txt and koro12.
6611
04:13:04,880 --> 04:13:10,159
txt. So these have been created. Let's
6612
04:13:07,840 --> 04:13:12,560
check them out. So as you can see there
6613
04:13:10,159 --> 04:13:14,560
are two files that have been created and
6614
04:13:12,560 --> 04:13:16,479
you can see that there's only one single
6615
04:13:14,560 --> 04:13:19,279
touch command that I have used. So this
6616
04:13:16,479 --> 04:13:21,359
is what touch is used for. So basically
6617
04:13:19,279 --> 04:13:23,439
the next command is the cat command. Now
6618
04:13:21,359 --> 04:13:25,840
the cat command is one of the most
6619
04:13:23,439 --> 04:13:27,439
frequently used Linux commands. Right?
6620
04:13:25,840 --> 04:13:29,600
So the cat command is short for
6621
04:13:27,439 --> 04:13:33,199
concatenate. Now what this helps us to
6622
04:13:29,600 --> 04:13:36,239
do is it helps us to create a single or
6623
04:13:33,199 --> 04:13:38,000
multiple files. So if you have created
6624
04:13:36,239 --> 04:13:40,479
an empty file called touch, you can
6625
04:13:38,000 --> 04:13:43,600
basically add content to it if you type
6626
04:13:40,479 --> 04:13:45,680
in cat. So it allows us to create single
6627
04:13:43,600 --> 04:13:48,159
or multiple files, view contents of the
6628
04:13:45,680 --> 04:13:50,800
file, concatenate files and redirect
6629
04:13:48,159 --> 04:13:52,640
output in the terminal of files. So what
6630
04:13:50,800 --> 04:13:54,720
it does is you can copy the content of a
6631
04:13:52,640 --> 04:13:57,760
file and put it in another. And we'll
6632
04:13:54,720 --> 04:14:00,960
show that as well. So let's see an
6633
04:13:57,760 --> 04:14:04,080
example of how CAT works. And the syntax
6634
04:14:00,960 --> 04:14:06,479
for cat is if you want to create files,
6635
04:14:04,080 --> 04:14:08,960
you know, files with content in it,
6636
04:14:06,479 --> 04:14:10,720
you'll basically have the cat command
6637
04:14:08,960 --> 04:14:12,399
followed with a greater than sign and
6638
04:14:10,720 --> 04:14:15,199
the file name. And if you want to
6639
04:14:12,399 --> 04:14:16,960
concatenate, basically copy the content
6640
04:14:15,199 --> 04:14:19,680
of one file to another. You'll have to
6641
04:14:16,960 --> 04:14:24,000
write cat and file name. So let's check
6642
04:14:19,680 --> 04:14:26,399
it out. So basically the cat command can
6643
04:14:24,000 --> 04:14:28,159
be used like this. Let's say you want to
6644
04:14:26,399 --> 04:14:30,720
insert something into the new file
6645
04:14:28,159 --> 04:14:34,159
you've just created. Created code of 11
6646
04:14:30,720 --> 04:14:39,640
one. So basically what you can do now is
6647
04:14:34,159 --> 04:14:39,640
add content to it. So let's say hi.
6648
04:14:41,120 --> 04:14:46,720
And to basically get out of it, you have
6649
04:14:42,880 --> 04:14:49,040
to do Ctrl D, right? And that is you
6650
04:14:46,720 --> 04:14:53,120
adding content to your file. Now if you
6651
04:14:49,040 --> 04:14:55,120
basically check this and just write for
6652
04:14:53,120 --> 04:14:57,040
see this is basically showing you the
6653
04:14:55,120 --> 04:14:59,359
content of the file that's already there
6654
04:14:57,040 --> 04:15:01,680
and this command is basically letting
6655
04:14:59,359 --> 04:15:04,800
you add content to the empty file that
6656
04:15:01,680 --> 04:15:06,720
you created using touch. So up next we
6657
04:15:04,800 --> 04:15:08,960
have the next command which is the rm
6658
04:15:06,720 --> 04:15:10,960
command. rm is basically short for
6659
04:15:08,960 --> 04:15:13,680
remove and it is a command which is used
6660
04:15:10,960 --> 04:15:16,560
to remove a file and the syntax for that
6661
04:15:13,680 --> 04:15:19,040
is rm followed by file name. So let's
6662
04:15:16,560 --> 04:15:20,560
check it out. So if you want to remove a
6663
04:15:19,040 --> 04:15:22,640
file, you'll have to first go to the
6664
04:15:20,560 --> 04:15:24,239
directory where the file is present. And
6665
04:15:22,640 --> 04:15:28,239
then once you enter the directory,
6666
04:15:24,239 --> 04:15:29,520
you'll just have to type in rm and post
6667
04:15:28,239 --> 04:15:31,920
that you'll have to type in the name of
6668
04:15:29,520 --> 04:15:34,479
the file. For example, since I've
6669
04:15:31,920 --> 04:15:38,319
recreated a file called kor11
6670
04:15:34,479 --> 04:15:41,600
txt, if you put rm that and it's
6671
04:15:38,319 --> 04:15:44,000
removed. So just to cross check, korok1
6672
04:15:41,600 --> 04:15:47,040
file has now been deleted. Now let's try
6673
04:15:44,000 --> 04:15:49,120
this file as well. Right? So if you just
6674
04:15:47,040 --> 04:15:51,359
type in kor12
6675
04:15:49,120 --> 04:15:53,760
so since 11 one is not there anymore
6676
04:15:51,359 --> 04:15:56,640
you'll have korak12.txt
6677
04:15:53,760 --> 04:15:59,680
and you do this and now check it you'll
6678
04:15:56,640 --> 04:16:03,279
see that korak12 has also been removed
6679
04:15:59,680 --> 04:16:05,439
right so this is what rm does. So up
6680
04:16:03,279 --> 04:16:07,920
next you'll have the cp command. Now the
6681
04:16:05,439 --> 04:16:10,560
cp command is used to copy a file or a
6682
04:16:07,920 --> 04:16:13,840
directory. Now, all you need to do to
6683
04:16:10,560 --> 04:16:15,359
use a cp command is type in cp and type
6684
04:16:13,840 --> 04:16:18,880
in the name of the files that you want
6685
04:16:15,359 --> 04:16:22,159
to copy, right? So, let's say you want
6686
04:16:18,880 --> 04:16:24,319
to copy a text file called into another
6687
04:16:22,159 --> 04:16:27,040
text file called demo.txt. So, all you
6688
04:16:24,319 --> 04:16:29,359
need to do is type in cp and the name of
6689
04:16:27,040 --> 04:16:31,600
the two files that you want copied into,
6690
04:16:29,359 --> 04:16:33,680
right? The first name is the file you
6691
04:16:31,600 --> 04:16:35,920
want to copy the contents of and the
6692
04:16:33,680 --> 04:16:38,880
second name of the file is the file you
6693
04:16:35,920 --> 04:16:42,399
want to basically copy it to.
6694
04:16:38,880 --> 04:16:45,520
So let's check it out. If you basically
6695
04:16:42,399 --> 04:16:47,199
go into the Linux directory that you
6696
04:16:45,520 --> 04:16:49,120
have, that's basically a folder that
6697
04:16:47,199 --> 04:16:50,960
I've created and these are the files
6698
04:16:49,120 --> 04:16:53,040
that are present in there. So you want
6699
04:16:50,960 --> 04:16:55,439
to copy the contents of one file into
6700
04:16:53,040 --> 04:16:58,800
another. All you need to do is type in
6701
04:16:55,439 --> 04:17:00,960
cp and the name of the first file that
6702
04:16:58,800 --> 04:17:04,800
is already existing
6703
04:17:00,960 --> 04:17:06,720
one txt and
6704
04:17:04,800 --> 04:17:08,399
new.xt,
6705
04:17:06,720 --> 04:17:10,720
right?
6706
04:17:08,399 --> 04:17:12,720
And all you need to know here is you can
6707
04:17:10,720 --> 04:17:15,680
go check the contents of the file after
6708
04:17:12,720 --> 04:17:18,080
this. Right? So if you go and check out
6709
04:17:15,680 --> 04:17:21,439
new.txt,
6710
04:17:18,080 --> 04:17:24,720
it's basically empty. Why is that?
6711
04:17:21,439 --> 04:17:26,880
That's because edurea 1 is also empty,
6712
04:17:24,720 --> 04:17:30,399
right? So if you basically add some
6713
04:17:26,880 --> 04:17:33,920
contents, let's say hi
6714
04:17:30,399 --> 04:17:37,120
and save this and just shut it down back
6715
04:17:33,920 --> 04:17:40,479
again. Go back to terminal. And now
6716
04:17:37,120 --> 04:17:44,159
let's check this out again. Just copy.
6717
04:17:40,479 --> 04:17:48,159
So you can just do this and check it out
6718
04:17:44,159 --> 04:17:52,640
again. Right. So if you go back to your
6719
04:17:48,159 --> 04:17:56,800
file now and open up new.txt,
6720
04:17:52,640 --> 04:17:58,319
this is the same content as your ed1
6721
04:17:56,800 --> 04:18:01,439
file.
6722
04:17:58,319 --> 04:18:03,439
So this is what copy command does. So
6723
04:18:01,439 --> 04:18:05,439
moving on to the next command. The next
6724
04:18:03,439 --> 04:18:07,520
command is the MV command or the move
6725
04:18:05,439 --> 04:18:10,000
command. So the move command is
6726
04:18:07,520 --> 04:18:12,800
basically used to move a file or
6727
04:18:10,000 --> 04:18:14,720
directory from one location to another.
6728
04:18:12,800 --> 04:18:17,279
So all you need to do to use the move
6729
04:18:14,720 --> 04:18:18,720
command is basically type in mv. Then
6730
04:18:17,279 --> 04:18:21,359
the name of the file that you want to
6731
04:18:18,720 --> 04:18:24,080
move and finally the name of the
6732
04:18:21,359 --> 04:18:26,800
directory you want to move it to. So
6733
04:18:24,080 --> 04:18:28,319
let's check it out. So you're basically
6734
04:18:26,800 --> 04:18:31,439
in the directory where you have your
6735
04:18:28,319 --> 04:18:33,439
files. Now you want to move your file to
6736
04:18:31,439 --> 04:18:36,640
another directory. So you have to just
6737
04:18:33,439 --> 04:18:38,640
type in mp the name of the file that you
6738
04:18:36,640 --> 04:18:42,000
want to move. Let's say you want to move
6739
04:18:38,640 --> 04:18:44,720
new.ext, right? So new.ext and where you
6740
04:18:42,000 --> 04:18:47,279
want to move it to. Let's say documents
6741
04:18:44,720 --> 04:18:50,000
or let's say
6742
04:18:47,279 --> 04:18:55,520
now if you basically now check it with
6743
04:18:50,000 --> 04:18:57,520
ls your new.ext file has gone off to the
6744
04:18:55,520 --> 04:18:59,680
documents folder.
6745
04:18:57,520 --> 04:19:02,159
Next up, we have another command which
6746
04:18:59,680 --> 04:19:04,399
is the last of the file commands that
6747
04:19:02,159 --> 04:19:06,560
you have. This is the rename command.
6748
04:19:04,399 --> 04:19:09,359
Now, the rename command as you can see
6749
04:19:06,560 --> 04:19:12,640
is used to rename files. It is useful
6750
04:19:09,359 --> 04:19:16,080
for renaming a large group of files. And
6751
04:19:12,640 --> 04:19:18,800
the basic syntax for that is rename and
6752
04:19:16,080 --> 04:19:21,040
then apostrophe s with the name of the
6753
04:19:18,800 --> 04:19:23,520
old folder and then the name of the new
6754
04:19:21,040 --> 04:19:26,239
folder. And after that you'll basically
6755
04:19:23,520 --> 04:19:29,279
have to show which type of file you want
6756
04:19:26,239 --> 04:19:33,439
it to be. So this is how you basically
6757
04:19:29,279 --> 04:19:35,359
do renaming. So let's check it out. So
6758
04:19:33,439 --> 04:19:37,439
you basically just type in rename
6759
04:19:35,359 --> 04:19:39,760
command with the old text file and
6760
04:19:37,439 --> 04:19:41,680
basically you want to convert it to new
6761
04:19:39,760 --> 04:19:44,560
text file which is basically you want to
6762
04:19:41,680 --> 04:19:46,319
convert it from a text file to a PDF
6763
04:19:44,560 --> 04:19:48,560
file. So this is the command you given
6764
04:19:46,319 --> 04:19:51,840
and then press enter. Right? So you've
6765
04:19:48,560 --> 04:19:55,120
now changed rename all the text files
6766
04:19:51,840 --> 04:19:58,560
into PDF. So let's say if you ls into
6767
04:19:55,120 --> 04:20:01,279
that now you can see it's demo3 PDF eda
6768
04:19:58,560 --> 04:20:03,359
1 PDF. All of these text files have been
6769
04:20:01,279 --> 04:20:06,399
changed into PDF because the rename
6770
04:20:03,359 --> 04:20:09,439
command. So this is how rename works.
6771
04:20:06,399 --> 04:20:11,359
Moving on to the next command. We've all
6772
04:20:09,439 --> 04:20:13,439
checked out the Linux file commands. Now
6773
04:20:11,359 --> 04:20:15,439
we move on to the Linux file content
6774
04:20:13,439 --> 04:20:18,000
commands. So when it comes to file
6775
04:20:15,439 --> 04:20:20,000
content, the first thing we can see is
6776
04:20:18,000 --> 04:20:21,760
the head command. Now the head command
6777
04:20:20,000 --> 04:20:24,319
is used to display the content of a
6778
04:20:21,760 --> 04:20:26,319
file. Now the content of a file can be
6779
04:20:24,319 --> 04:20:28,640
displayed with other commands as well.
6780
04:20:26,319 --> 04:20:30,159
But the head command how it's different
6781
04:20:28,640 --> 04:20:32,960
from the other commands is that it
6782
04:20:30,159 --> 04:20:35,680
displays the first 10 lines of the file.
6783
04:20:32,960 --> 04:20:37,600
And basically the syntax for that is you
6784
04:20:35,680 --> 04:20:40,239
just have to write head and the name of
6785
04:20:37,600 --> 04:20:43,040
the file you want to show 10 lines in.
6786
04:20:40,239 --> 04:20:44,960
So let's check it out. So now if you
6787
04:20:43,040 --> 04:20:48,159
check out the head command, let's say
6788
04:20:44,960 --> 04:20:50,560
for example you type in head and
6789
04:20:48,159 --> 04:20:52,720
basically the first 10 lines of a file
6790
04:20:50,560 --> 04:20:55,680
that you want to check. Let's check it
6791
04:20:52,720 --> 04:20:58,319
out.
6792
04:20:55,680 --> 04:21:01,120
Right? So as you can see the first 10
6793
04:20:58,319 --> 04:21:03,600
lines have been displayed. Now if you
6794
04:21:01,120 --> 04:21:06,239
want to check the contents of that file
6795
04:21:03,600 --> 04:21:08,720
I'm going to show it to you.
6796
04:21:06,239 --> 04:21:12,000
Yeah. As you can see, the first 10 lines
6797
04:21:08,720 --> 04:21:14,080
are from 10 to 100 and the rest of the
6798
04:21:12,000 --> 04:21:16,720
lines have not been printed. If you
6799
04:21:14,080 --> 04:21:19,840
cross check back here again, so it's 10
6800
04:21:16,720 --> 04:21:21,680
to 100 with no other content that's
6801
04:21:19,840 --> 04:21:23,439
here. So head is basically something
6802
04:21:21,680 --> 04:21:26,319
that is used to show the first 10 lines
6803
04:21:23,439 --> 04:21:29,359
of your file. Right? So moving on to the
6804
04:21:26,319 --> 04:21:31,600
next command. So next up, just like
6805
04:21:29,359 --> 04:21:33,359
head, we have the tail command. Now the
6806
04:21:31,600 --> 04:21:35,840
tail command is used to display the last
6807
04:21:33,359 --> 04:21:37,520
10 lines of the file content. Just like
6808
04:21:35,840 --> 04:21:39,520
head is used to display the first 10
6809
04:21:37,520 --> 04:21:42,239
lines of the file content, tail is used
6810
04:21:39,520 --> 04:21:44,560
to display the last 10 of it. Now it is
6811
04:21:42,239 --> 04:21:47,760
useful for reading error messages,
6812
04:21:44,560 --> 04:21:50,239
right? So tail is basically something
6813
04:21:47,760 --> 04:21:52,399
which is used and after tail you just
6814
04:21:50,239 --> 04:21:54,399
have to specify the file name. So let's
6815
04:21:52,399 --> 04:21:57,040
check it out with the same file that we
6816
04:21:54,399 --> 04:22:00,960
saw before. Right? Then so just like
6817
04:21:57,040 --> 04:22:03,960
head let's just try using tail, right?
6818
04:22:00,960 --> 04:22:03,960
And
6819
04:22:04,000 --> 04:22:09,199
so the last 10 lines are these as you
6820
04:22:06,800 --> 04:22:13,120
can see as in head if you can see here
6821
04:22:09,199 --> 04:22:15,520
I'll just show it to you eda.
6822
04:22:13,120 --> 04:22:17,680
So if you put head you can basically see
6823
04:22:15,520 --> 04:22:20,960
it's from 10 to 100. That's the first 10
6824
04:22:17,680 --> 04:22:23,279
lines of the file. But in eda 2 which
6825
04:22:20,960 --> 04:22:25,680
has tail it'll show you the last 10
6826
04:22:23,279 --> 04:22:28,399
lines of the file. Right? This has no 10
6827
04:22:25,680 --> 04:22:30,800
to 60 here. It starts from 70. Now this
6828
04:22:28,399 --> 04:22:34,399
is the difference between head and tail
6829
04:22:30,800 --> 04:22:36,239
right. So move on to the next command.
6830
04:22:34,399 --> 04:22:38,319
So up next we have a very important
6831
04:22:36,239 --> 04:22:40,720
command which is the tag command. Right?
6832
04:22:38,319 --> 04:22:42,960
So the tag command is the reverse of the
6833
04:22:40,720 --> 04:22:45,439
cat command that we have used before. So
6834
04:22:42,960 --> 04:22:48,239
it displays the file content in reverse
6835
04:22:45,439 --> 04:22:51,040
order. So let's check it out. And
6836
04:22:48,239 --> 04:22:53,279
basically the syntax for it is just tac
6837
04:22:51,040 --> 04:22:55,120
and then file name. So let's check it
6838
04:22:53,279 --> 04:22:58,720
out. So if you want to see the content
6839
04:22:55,120 --> 04:23:01,840
of your file just type in tac and the
6840
04:22:58,720 --> 04:23:03,520
name of the file that you want to see.
6841
04:23:01,840 --> 04:23:05,600
As you can see tac has basically
6842
04:23:03,520 --> 04:23:07,920
displayed the content of this file in
6843
04:23:05,600 --> 04:23:10,640
reverse order. If you want to check it
6844
04:23:07,920 --> 04:23:14,239
out you can again check this. So this
6845
04:23:10,640 --> 04:23:18,239
has 10 to 150 and if you check here tag
6846
04:23:14,239 --> 04:23:20,479
aurea 2 has made it 150 to 10. Right? So
6847
04:23:18,239 --> 04:23:23,520
this is what tag does. Now moving on to
6848
04:23:20,479 --> 04:23:25,680
the next command. So up next we have the
6849
04:23:23,520 --> 04:23:28,399
mo command. The mo command is basically
6850
04:23:25,680 --> 04:23:30,399
a similar command to the cat command and
6851
04:23:28,399 --> 04:23:33,279
it is used to display content the same
6852
04:23:30,399 --> 04:23:36,479
way cat does. So the only difference
6853
04:23:33,279 --> 04:23:39,680
between more or cat is that there in
6854
04:23:36,479 --> 04:23:42,640
case of larger file sizes the screen
6855
04:23:39,680 --> 04:23:45,520
full output is displayed. So for this
6856
04:23:42,640 --> 04:23:49,600
I'll have to show you an example. Since
6857
04:23:45,520 --> 04:23:52,080
we do not have many large content file,
6858
04:23:49,600 --> 04:23:54,640
we can just check some of the files that
6859
04:23:52,080 --> 04:23:56,640
we have. Check them out. And the syntax
6860
04:23:54,640 --> 04:23:58,239
for more command is basically more and
6861
04:23:56,640 --> 04:24:00,960
then file name. So let's check out the
6862
04:23:58,239 --> 04:24:02,720
more command, shall we? So let's
6863
04:24:00,960 --> 04:24:06,479
basically check out the more command,
6864
04:24:02,720 --> 04:24:09,479
right? So if you type in more and let's
6865
04:24:06,479 --> 04:24:09,479
say,
6866
04:24:09,840 --> 04:24:13,680
right? So when you have more, you
6867
04:24:11,439 --> 04:24:15,439
basically type in more and then the name
6868
04:24:13,680 --> 04:24:17,840
of the file. So this will basically
6869
04:24:15,439 --> 04:24:20,399
display the content that you have in the
6870
04:24:17,840 --> 04:24:22,399
file and it's just like cat. Now the
6871
04:24:20,399 --> 04:24:24,479
difference between cat and more is
6872
04:24:22,399 --> 04:24:26,640
basically more is generally used for
6873
04:24:24,479 --> 04:24:29,520
larger files, right? Files with larger
6874
04:24:26,640 --> 04:24:32,000
amount content, larger sizes. So this is
6875
04:24:29,520 --> 04:24:33,680
basically all about more. It'll help you
6876
04:24:32,000 --> 04:24:36,800
show the content that is there in the
6877
04:24:33,680 --> 04:24:38,640
file. It's just like cat. So the next
6878
04:24:36,800 --> 04:24:40,239
command is the less command. So the less
6879
04:24:38,640 --> 04:24:42,319
command is similar to the more command
6880
04:24:40,239 --> 04:24:44,720
but has some added features to it.
6881
04:24:42,319 --> 04:24:46,640
Right? So along with the fact that
6882
04:24:44,720 --> 04:24:48,560
similar to the more command, the less
6883
04:24:46,640 --> 04:24:51,520
command will show you content on your
6884
04:24:48,560 --> 04:24:53,199
file, it automatically also adjusts the
6885
04:24:51,520 --> 04:24:56,319
size of the terminal window that you're
6886
04:24:53,199 --> 04:24:59,120
using, right? So the basic command for
6887
04:24:56,319 --> 04:25:01,760
less is less and then you'll have to
6888
04:24:59,120 --> 04:25:05,279
basically have the file name. So let's
6889
04:25:01,760 --> 04:25:10,239
check it out. So let's just check out
6890
04:25:05,279 --> 04:25:13,279
the less command does and the file name.
6891
04:25:10,239 --> 04:25:15,199
So this will basically give you the
6892
04:25:13,279 --> 04:25:17,520
content that you have, the contents of
6893
04:25:15,199 --> 04:25:19,760
the file that you have and automatically
6894
04:25:17,520 --> 04:25:22,399
reshuffle or adjust the length and
6895
04:25:19,760 --> 04:25:26,880
breadth of the terminal that you have.
6896
04:25:22,399 --> 04:25:29,920
Right? So this is what less does. Moving
6897
04:25:26,880 --> 04:25:32,080
on to the next command. So after that we
6898
04:25:29,920 --> 04:25:33,439
have the different Linux user commands.
6899
04:25:32,080 --> 04:25:36,159
Right? So when it comes to user
6900
04:25:33,439 --> 04:25:38,640
commands, the most important is the su
6901
04:25:36,159 --> 04:25:41,439
and the pseudo commands. So the su
6902
04:25:38,640 --> 04:25:43,680
command provides administrative access
6903
04:25:41,439 --> 04:25:46,080
to another user, right? So in other
6904
04:25:43,680 --> 04:25:48,399
word, it allows access to the Linux
6905
04:25:46,080 --> 04:25:50,960
shell to another user. So let's check it
6906
04:25:48,399 --> 04:25:53,439
out. And syntax for it, that's very
6907
04:25:50,960 --> 04:25:56,560
basic. So you'll just have to write su
6908
04:25:53,439 --> 04:26:00,479
and specify the username, right, of your
6909
04:25:56,560 --> 04:26:02,159
Linux system. So let's check it out. So
6910
04:26:00,479 --> 04:26:04,640
all you need to do here is go to
6911
04:26:02,159 --> 04:26:07,520
terminal and type it su and then the
6912
04:26:04,640 --> 04:26:09,920
username. My username is KB as you can
6913
04:26:07,520 --> 04:26:12,640
see. So now you have to specify the
6914
04:26:09,920 --> 04:26:15,279
password. So this is something which
6915
04:26:12,640 --> 04:26:18,239
allows access to somebody else. Right?
6916
04:26:15,279 --> 04:26:21,279
If you type in SU, so you can basically
6917
04:26:18,239 --> 04:26:23,760
use their Linux system, right? You have
6918
04:26:21,279 --> 04:26:26,960
been allowed access into KB's Linux
6919
04:26:23,760 --> 04:26:29,680
system if you have password and if you
6920
04:26:26,960 --> 04:26:33,439
know the username as well. So this is
6921
04:26:29,680 --> 04:26:35,279
what SU does. So next up we have the ID
6922
04:26:33,439 --> 04:26:37,680
command. Now the ID command is used to
6923
04:26:35,279 --> 04:26:40,080
display the user ID and the group ID
6924
04:26:37,680 --> 04:26:41,840
that you have. So you have a user ID for
6925
04:26:40,080 --> 04:26:43,840
your Linux system. You have a group ID
6926
04:26:41,840 --> 04:26:46,479
for your Linux system and the command
6927
04:26:43,840 --> 04:26:49,680
for that is ID. Right? So let's check it
6928
04:26:46,479 --> 04:26:52,720
out. All you have to do here is type in
6929
04:26:49,680 --> 04:26:55,439
the word ID and you'll basically get
6930
04:26:52,720 --> 04:26:57,600
your user ID and your group ID as well
6931
04:26:55,439 --> 04:27:00,479
along with the username. So this is what
6932
04:26:57,600 --> 04:27:02,479
ID does. So next up we have the pseudo
6933
04:27:00,479 --> 04:27:04,960
command. Now pseudo command let's just
6934
04:27:02,479 --> 04:27:07,920
show you pseudo is something which is
6935
04:27:04,960 --> 04:27:10,159
used extensively in Linux to give you
6936
04:27:07,920 --> 04:27:11,920
access to files which need permission
6937
04:27:10,159 --> 04:27:14,000
right user permission administrator
6938
04:27:11,920 --> 04:27:15,520
permission to access them right you need
6939
04:27:14,000 --> 04:27:18,880
administrator permission to access
6940
04:27:15,520 --> 04:27:21,920
certain files so how do you do that
6941
04:27:18,880 --> 04:27:25,600
let's say for example if you go into the
6942
04:27:21,920 --> 04:27:30,399
terminal for your computer you go into
6943
04:27:25,600 --> 04:27:34,880
this computer and you go into terminal
6944
04:27:30,399 --> 04:27:37,760
And let's check it out. You do ls and
6945
04:27:34,880 --> 04:27:40,080
then you cd into one of the directories.
6946
04:27:37,760 --> 04:27:42,000
And all you have to do now is see the
6947
04:27:40,080 --> 04:27:44,479
files that are there. Right? So these
6948
04:27:42,000 --> 04:27:46,319
are all the files that are there. Now if
6949
04:27:44,479 --> 04:27:48,479
you want to access one of these files,
6950
04:27:46,319 --> 04:27:51,520
these files are actually administrator
6951
04:27:48,479 --> 04:27:54,080
protected. So you need to have pseudo to
6952
04:27:51,520 --> 04:27:56,000
basically ask for permission which has
6953
04:27:54,080 --> 04:28:00,720
to be granted by the administrator. So
6954
04:27:56,000 --> 04:28:04,800
just type in sudo then let's say sudo
6955
04:28:00,720 --> 04:28:07,840
zip and you'll have your password.
6956
04:28:04,800 --> 04:28:09,520
So these are restricted and basically as
6957
04:28:07,840 --> 04:28:11,600
you can see these are restricted because
6958
04:28:09,520 --> 04:28:15,439
this is basically machine understandable
6959
04:28:11,600 --> 04:28:18,319
language and you can already see that
6960
04:28:15,439 --> 04:28:22,319
this is basically what is there in the
6961
04:28:18,319 --> 04:28:24,720
file which is the zip file. So this is
6962
04:28:22,319 --> 04:28:26,640
what pseudo does. So this was a very
6963
04:28:24,720 --> 04:28:30,800
important command that you needed to
6964
04:28:26,640 --> 04:28:32,880
know. So moving on to the next command.
6965
04:28:30,800 --> 04:28:34,800
So next up we have the user add command.
6966
04:28:32,880 --> 04:28:36,720
So the user add command is used to add
6967
04:28:34,800 --> 04:28:39,600
or remove the user from the Linux
6968
04:28:36,720 --> 04:28:41,199
server. Right? So if you add or remove
6969
04:28:39,600 --> 04:28:42,880
the user, you'll have to have special
6970
04:28:41,199 --> 04:28:44,960
permission for which you'll have to use
6971
04:28:42,880 --> 04:28:48,000
the pseudo command as well. Right? So
6972
04:28:44,960 --> 04:28:50,479
you just write sudo and then user add
6973
04:28:48,000 --> 04:28:52,560
and then you add the new user. pseudo
6974
04:28:50,479 --> 04:28:53,920
has to be because you'll have to have
6975
04:28:52,560 --> 04:28:56,880
special permission from the
6976
04:28:53,920 --> 04:28:58,800
administrator to do this and the syntax
6977
04:28:56,880 --> 04:29:00,960
for user ad is user ad and then you
6978
04:28:58,800 --> 04:29:03,600
basically add the username. So let's
6979
04:29:00,960 --> 04:29:06,080
check it out. So you basically want to
6980
04:29:03,600 --> 04:29:08,080
use user ad, right? This will basically
6981
04:29:06,080 --> 04:29:11,920
add user. What you need to do is add
6982
04:29:08,080 --> 04:29:14,319
sudo and then the user add command and
6983
04:29:11,920 --> 04:29:17,840
the name of your user. Let's say I want
6984
04:29:14,319 --> 04:29:20,880
it to be KB9.
6985
04:29:17,840 --> 04:29:24,560
Right? It'll ask for your password. Your
6986
04:29:20,880 --> 04:29:27,520
new user has now been created. And let's
6987
04:29:24,560 --> 04:29:29,520
move on to the next command. So the next
6988
04:29:27,520 --> 04:29:32,319
command is the pass WD command which is
6989
04:29:29,520 --> 04:29:34,560
the password command. So the pass WD
6990
04:29:32,319 --> 04:29:37,120
command is used to create and change the
6991
04:29:34,560 --> 04:29:40,880
password for a user. So let's say for
6992
04:29:37,120 --> 04:29:44,319
example you have to use sudo here as
6993
04:29:40,880 --> 04:29:46,319
well. you have a user already present
6994
04:29:44,319 --> 04:29:48,800
and if you want to change password just
6995
04:29:46,319 --> 04:29:51,120
sudo into that user type the new
6996
04:29:48,800 --> 04:29:52,720
password type retype the new password
6997
04:29:51,120 --> 04:29:55,040
and then basically it'll show you the
6998
04:29:52,720 --> 04:29:57,680
password has been successfully updated
6999
04:29:55,040 --> 04:30:00,960
and the syntax for this is pass WD and
7000
04:29:57,680 --> 04:30:04,399
then username so let's check it out once
7001
04:30:00,960 --> 04:30:06,880
so just type in pass WD then KB that is
7002
04:30:04,399 --> 04:30:09,199
basically your user right now so we'll
7003
04:30:06,880 --> 04:30:10,800
basically change the password for KB
7004
04:30:09,199 --> 04:30:12,720
since it's already an existing user
7005
04:30:10,800 --> 04:30:16,399
which add the password, right? So,
7006
04:30:12,720 --> 04:30:19,199
current password is already there. What
7007
04:30:16,399 --> 04:30:21,920
your new password to be is
7008
04:30:19,199 --> 04:30:23,840
and you have to retype it, right? So,
7009
04:30:21,920 --> 04:30:25,680
the password has now been updated
7010
04:30:23,840 --> 04:30:28,880
successfully. And this is how you
7011
04:30:25,680 --> 04:30:30,800
basically use the pass WT command. So,
7012
04:30:28,880 --> 04:30:32,399
next up we have the group ad command.
7013
04:30:30,800 --> 04:30:35,040
So, the group ad command is basically
7014
04:30:32,399 --> 04:30:36,880
used to create a user group, right? So
7015
04:30:35,040 --> 04:30:39,120
when you create user groups, you'll also
7016
04:30:36,880 --> 04:30:41,439
have to use the sudo command because you
7017
04:30:39,120 --> 04:30:43,840
want to access restricted files, right?
7018
04:30:41,439 --> 04:30:46,399
So the syntax for group ad is group ad
7019
04:30:43,840 --> 04:30:48,319
and then group name. So let's check out
7020
04:30:46,399 --> 04:30:51,439
the group ad command. So first of all,
7021
04:30:48,319 --> 04:30:54,720
you have to type in sudo and then group
7022
04:30:51,439 --> 04:30:58,319
ad and then group name. Let's say we
7023
04:30:54,720 --> 04:31:00,000
name our group educator
7024
04:30:58,319 --> 04:31:02,800
2022
7025
04:31:00,000 --> 04:31:06,640
and then password for KV which we've
7026
04:31:02,800 --> 04:31:09,840
just created. Now, so now this group has
7027
04:31:06,640 --> 04:31:11,760
been added into this user. So that was
7028
04:31:09,840 --> 04:31:14,479
basically how you use the group add
7029
04:31:11,760 --> 04:31:16,640
command. So finally you come to the
7030
04:31:14,479 --> 04:31:19,439
Linux filter commands. Now there are
7031
04:31:16,640 --> 04:31:21,279
various filter commands that Linux has.
7032
04:31:19,439 --> 04:31:23,760
The first thing you can see is the cat
7033
04:31:21,279 --> 04:31:26,000
command. Now the cat command is also
7034
04:31:23,760 --> 04:31:28,319
used as a filter. Right? Now filtering
7035
04:31:26,000 --> 04:31:30,560
here means to filter a file. It is used
7036
04:31:28,319 --> 04:31:32,479
for inside pipes. Now you basically
7037
04:31:30,560 --> 04:31:34,720
filter out the content that is there.
7038
04:31:32,479 --> 04:31:36,800
Now, if you want to filter using cat,
7039
04:31:34,720 --> 04:31:40,399
you'll have to write cat and then the
7040
04:31:36,800 --> 04:31:42,239
file name with cat or tag and then cat
7041
04:31:40,399 --> 04:31:44,560
or tag again, right? So, you'll have
7042
04:31:42,239 --> 04:31:46,640
pipes in between and you'll basically
7043
04:31:44,560 --> 04:31:49,120
have the cat and tag cat and tag
7044
04:31:46,640 --> 04:31:51,760
commands back inside pipes. So, let's
7045
04:31:49,120 --> 04:31:54,880
just check it out. So, if you want to
7046
04:31:51,760 --> 04:31:58,159
use the cat command as a filter, let's
7047
04:31:54,880 --> 04:32:00,080
check it out. Type in cat home and then
7048
04:31:58,159 --> 04:32:06,239
we'll basically have this which is the
7049
04:32:00,080 --> 04:32:08,720
pipe and then the command t then cat
7050
04:32:06,239 --> 04:32:11,120
finally we'll have tag.
7051
04:32:08,720 --> 04:32:14,880
So this is basically what the cat
7052
04:32:11,120 --> 04:32:17,199
command does as a filter. Next up is the
7053
04:32:14,880 --> 04:32:19,920
cut command. Now the cut command is used
7054
04:32:17,199 --> 04:32:22,159
to select a specific column of a file.
7055
04:32:19,920 --> 04:32:25,359
So the D option is basically the
7056
04:32:22,159 --> 04:32:27,920
delimiter option and the F option is
7057
04:32:25,359 --> 04:32:30,399
basically the column. So the D option is
7058
04:32:27,920 --> 04:32:32,800
used as delimiter and it can be a space
7059
04:32:30,399 --> 04:32:35,600
or a slash or a hyphen or anything else.
7060
04:32:32,800 --> 04:32:37,760
Whereas F is the column number and the
7061
04:32:35,600 --> 04:32:39,840
syntax for this is cut and then you put
7062
04:32:37,760 --> 04:32:41,439
the D limiter. You put the column number
7063
04:32:39,840 --> 04:32:45,439
and then you put the file name in the
7064
04:32:41,439 --> 04:32:47,920
end. So let's check it out as well.
7065
04:32:45,439 --> 04:32:50,560
So with the cut command you'll just have
7066
04:32:47,920 --> 04:32:52,800
you type in cut then you'll have the
7067
04:32:50,560 --> 04:32:55,600
delimiter
7068
04:32:52,800 --> 04:32:58,000
after which you will have the f and the
7069
04:32:55,600 --> 04:33:00,960
file name in the end.
7070
04:32:58,000 --> 04:33:03,520
Right? So this is basically what the cut
7071
04:33:00,960 --> 04:33:05,760
command does. It cuts out from a
7072
04:33:03,520 --> 04:33:07,680
specific column and the specific column
7073
04:33:05,760 --> 04:33:10,879
number. Since there's only one column
7074
04:33:07,680 --> 04:33:13,119
here and we specified F2, there is no
7075
04:33:10,879 --> 04:33:17,439
cutting out. So if we do the same thing
7076
04:33:13,119 --> 04:33:20,799
again and change F2 to F_sub_1, let's
7077
04:33:17,439 --> 04:33:23,840
see how it's different, right? So this
7078
04:33:20,799 --> 04:33:26,160
is basically what F1 F_sub_2 does. It
7079
04:33:23,840 --> 04:33:29,439
shows you the column name and it'll show
7080
04:33:26,160 --> 04:33:31,119
you basically a specific part of the
7081
04:33:29,439 --> 04:33:32,799
file that you want. You'll cut out a
7082
04:33:31,119 --> 04:33:35,199
part of that file and it'll show it to
7083
04:33:32,799 --> 04:33:37,279
you. But since we have only column one,
7084
04:33:35,199 --> 04:33:39,600
it'll show you just the column one here.
7085
04:33:37,279 --> 04:33:42,000
Right? So this is what cut does. Moving
7086
04:33:39,600 --> 04:33:44,240
on to the next command. So the next
7087
04:33:42,000 --> 04:33:46,320
command is the grep command. So the grep
7088
04:33:44,240 --> 04:33:48,000
command in Linux is the most powerful
7089
04:33:46,320 --> 04:33:50,240
command and it is used to filter the
7090
04:33:48,000 --> 04:33:53,039
Linux system. Right? Grep stands for
7091
04:33:50,240 --> 04:33:55,039
global regular expression print. Right?
7092
04:33:53,039 --> 04:33:57,359
So it is basically very useful for
7093
04:33:55,039 --> 04:34:00,719
searching content from a pack. Right? So
7094
04:33:57,359 --> 04:34:03,359
for example, you need the syntax as
7095
04:34:00,719 --> 04:34:06,719
basically command and then grep and then
7096
04:34:03,359 --> 04:34:11,199
you search the word. Right? So let's see
7097
04:34:06,719 --> 04:34:13,439
how gref works. So let's check it out.
7098
04:34:11,199 --> 04:34:16,080
So to basically check out how Gre works,
7099
04:34:13,439 --> 04:34:19,840
let's check this out. Let's say cat and
7100
04:34:16,080 --> 04:34:23,600
iterator 2. Then you'll basically have
7101
04:34:19,840 --> 04:34:27,279
this with gre 3.
7102
04:34:23,600 --> 04:34:29,520
So this is basically every content in
7103
04:34:27,279 --> 04:34:31,359
the file which is in RA 2 which has the
7104
04:34:29,520 --> 04:34:33,119
value three in it. So these are the two
7105
04:34:31,359 --> 04:34:35,279
values which has three in it and that is
7106
04:34:33,119 --> 04:34:38,160
what grep is showing. So this is how
7107
04:34:35,279 --> 04:34:40,400
grep works. So moving on to the next
7108
04:34:38,160 --> 04:34:42,719
command is the com command. Now the com
7109
04:34:40,400 --> 04:34:45,279
command is used to compare two files or
7110
04:34:42,719 --> 04:34:47,439
streams. Right? So by default it for
7111
04:34:45,279 --> 04:34:49,359
displays three columns. The first
7112
04:34:47,439 --> 04:34:51,520
displays the non-matching columns of the
7113
04:34:49,359 --> 04:34:53,920
first file. The second for the second
7114
04:34:51,520 --> 04:34:55,920
file and third displays the non-matching
7115
04:34:53,920 --> 04:34:57,680
columns for the third file. So the
7116
04:34:55,920 --> 04:34:59,920
syntax for this is fairly easy. It's
7117
04:34:57,680 --> 04:35:02,240
just com and then you specify the file
7118
04:34:59,920 --> 04:35:04,561
names that you want. Right? So let's
7119
04:35:02,240 --> 04:35:06,719
just check this out. So if you want to
7120
04:35:04,561 --> 04:35:10,959
check out how the com command works,
7121
04:35:06,719 --> 04:35:13,119
let's see this com. and basically add
7122
04:35:10,959 --> 04:35:16,240
the two folders you want and the
7123
04:35:13,119 --> 04:35:19,119
contents of it which you want. So these
7124
04:35:16,240 --> 04:35:21,840
are all the files content that is there
7125
04:35:19,119 --> 04:35:24,160
in both the files right input is not in
7126
04:35:21,840 --> 04:35:27,279
sorted order but the file number one is
7127
04:35:24,160 --> 04:35:30,320
not in sorted order and so this is
7128
04:35:27,279 --> 04:35:33,199
basically showing the content of all of
7129
04:35:30,320 --> 04:35:35,520
the files that I've given which is 2 and
7130
04:35:33,199 --> 04:35:37,439
home and the content widget which has
7131
04:35:35,520 --> 04:35:38,959
right it displays it in three different
7132
04:35:37,439 --> 04:35:42,480
columns.
7133
04:35:38,959 --> 04:35:45,359
So this is what com does so checking out
7134
04:35:42,480 --> 04:35:47,920
the next command. So the next command is
7135
04:35:45,359 --> 04:35:51,119
the sedd command right. So the sed
7136
04:35:47,920 --> 04:35:53,760
command is short for stream editor. Now
7137
04:35:51,119 --> 04:35:56,160
sedd is used to edit files using regular
7138
04:35:53,760 --> 04:35:58,561
expression. It does not permanently edit
7139
04:35:56,160 --> 04:36:01,279
files. Instead what it does is the
7140
04:35:58,561 --> 04:36:03,680
edited contains remains only on display
7141
04:36:01,279 --> 04:36:06,480
and it doesn't really affect the actual
7142
04:36:03,680 --> 04:36:09,439
file. So the syntax for sedd is
7143
04:36:06,480 --> 04:36:12,799
basically the command and then sed with
7144
04:36:09,439 --> 04:36:15,359
apostrophe s and the old word with the
7145
04:36:12,799 --> 04:36:19,199
new word. Right. So if you want to check
7146
04:36:15,359 --> 04:36:21,119
it out, let's see. So basically for
7147
04:36:19,199 --> 04:36:23,039
having SED, you'll basically have to
7148
04:36:21,119 --> 04:36:26,719
show the stream editor. So this is the
7149
04:36:23,039 --> 04:36:29,840
command for it. You have to put SED eco
7150
04:36:26,719 --> 04:36:31,760
and eco is basically used in Linux and
7151
04:36:29,840 --> 04:36:36,561
you basically have this thing printed
7152
04:36:31,760 --> 04:36:38,879
called eda 7. Right? So as we can see is
7153
04:36:36,561 --> 04:36:40,959
used to edit files using a regular
7154
04:36:38,879 --> 04:36:43,520
expression. Right? So it doesn't really
7155
04:36:40,959 --> 04:36:45,920
permanently edit those files but it's
7156
04:36:43,520 --> 04:36:48,959
only for view. You can't really change
7157
04:36:45,920 --> 04:36:51,520
what's there in the content. So as I
7158
04:36:48,959 --> 04:36:54,959
showed before if you write class E= 7
7159
04:36:51,520 --> 04:36:57,520
with sed and change it in class. So this
7160
04:36:54,959 --> 04:36:59,279
is just for view eda 7 what you see is
7161
04:36:57,520 --> 04:37:02,561
for view. It hasn't really changed the
7162
04:36:59,279 --> 04:37:04,561
content of it. Right? So next up we go
7163
04:37:02,561 --> 04:37:07,520
to the next command which is the t
7164
04:37:04,561 --> 04:37:10,240
command. Right? So twe command which is
7165
04:37:07,520 --> 04:37:13,039
t command is similar to the cat command.
7166
04:37:10,240 --> 04:37:15,439
The only difference between both filters
7167
04:37:13,039 --> 04:37:17,600
is that it puts standard input or
7168
04:37:15,439 --> 04:37:20,561
standard output and can also write them
7169
04:37:17,600 --> 04:37:23,520
into a file. So let's check it out. Also
7170
04:37:20,561 --> 04:37:26,080
the syntax for t command is the cat and
7171
04:37:23,520 --> 04:37:28,799
then file name then followed with t and
7172
04:37:26,080 --> 04:37:32,160
then with new file and then you have cat
7173
04:37:28,799 --> 04:37:35,119
attack. So let's check it out. So as you
7174
04:37:32,160 --> 04:37:37,600
can see here the DE is basically putting
7175
04:37:35,119 --> 04:37:39,920
in standard input standard output and
7176
04:37:37,600 --> 04:37:43,920
writing the same thing as you can see in
7177
04:37:39,920 --> 04:37:46,879
HDA 2 into the new 98 file as well. So
7178
04:37:43,920 --> 04:37:48,799
this is what T does the T command. So
7179
04:37:46,879 --> 04:37:51,039
moving forward we have the TR command.
7180
04:37:48,799 --> 04:37:54,400
Now the TR command is used to translate
7181
04:37:51,039 --> 04:37:56,240
the file content like from lowerase to
7182
04:37:54,400 --> 04:37:57,920
uppercase right? So if you have some
7183
04:37:56,240 --> 04:37:59,840
sort of content in a file which is in
7184
04:37:57,920 --> 04:38:02,080
lower case, you can change it to upper
7185
04:37:59,840 --> 04:38:04,879
case. And the syntax for that is
7186
04:38:02,080 --> 04:38:07,039
basically command follow tr and the old
7187
04:38:04,879 --> 04:38:09,439
word to the new word. Right? So let's
7188
04:38:07,039 --> 04:38:10,959
check it out. So guys, when you're
7189
04:38:09,439 --> 04:38:12,719
talking about the cat command, you'll
7190
04:38:10,959 --> 04:38:14,959
basically have to write cat and the name
7191
04:38:12,719 --> 04:38:18,320
of the file followed with tr which is
7192
04:38:14,959 --> 04:38:20,879
translate and then just replace the file
7193
04:38:18,320 --> 04:38:22,561
with the old file. Then replace the word
7194
04:38:20,879 --> 04:38:24,639
from the old word to the new word. So
7195
04:38:22,561 --> 04:38:27,680
let's say we have hello as the own
7196
04:38:24,639 --> 04:38:30,959
world. I want it to be upper case on
7197
04:38:27,680 --> 04:38:35,439
hello right. So it'll show me hello
7198
04:38:30,959 --> 04:38:38,879
world right? You go back to the file now
7199
04:38:35,439 --> 04:38:41,520
it shows you hello world right. So hello
7200
04:38:38,879 --> 04:38:44,000
world is like this and I wanted to
7201
04:38:41,520 --> 04:38:45,840
basically make it uppercase. So this is
7202
04:38:44,000 --> 04:38:48,160
what I have to do to make it uppercase
7203
04:38:45,840 --> 04:38:50,240
use the tr command.
7204
04:38:48,160 --> 04:38:52,639
So next up we have the unique command.
7205
04:38:50,240 --> 04:38:54,561
So the unique command is used to form a
7206
04:38:52,639 --> 04:38:58,080
sorted list in which every word will
7207
04:38:54,561 --> 04:39:01,279
occur only once right. So the syntax for
7208
04:38:58,080 --> 04:39:05,439
this is the command followed by the file
7209
04:39:01,279 --> 04:39:08,240
name and / unique. So every command has
7210
04:39:05,439 --> 04:39:11,680
to be there only once there is absolute
7211
04:39:08,240 --> 04:39:12,959
redundancy. So let's check it out. So
7212
04:39:11,680 --> 04:39:14,719
all you have to do for the unique
7213
04:39:12,959 --> 04:39:16,480
command is basically type in sort
7214
04:39:14,719 --> 04:39:19,520
followed by the name of the file you
7215
04:39:16,480 --> 04:39:21,359
have and put in unique after that. If
7216
04:39:19,520 --> 04:39:24,320
you do this, this is basically showing
7217
04:39:21,359 --> 04:39:26,160
you everything in the content only once.
7218
04:39:24,320 --> 04:39:28,480
So there is redundancy that's there.
7219
04:39:26,160 --> 04:39:30,799
Everything is unique. So this is about
7220
04:39:28,480 --> 04:39:33,680
this unique command. Moving on to the
7221
04:39:30,799 --> 04:39:35,920
next command. We have here our final
7222
04:39:33,680 --> 04:39:38,638
command which is the WC command. Right?
7223
04:39:35,920 --> 04:39:41,280
So the WC command is used to count the
7224
04:39:38,638 --> 04:39:43,680
words, lines and characters in a file.
7225
04:39:41,280 --> 04:39:45,200
So let's say if you want to count the
7226
04:39:43,680 --> 04:39:47,600
number of characters you have in your
7227
04:39:45,200 --> 04:39:51,360
file, just type in WC followed by the
7228
04:39:47,600 --> 04:39:54,638
file name. So let's check it out. So
7229
04:39:51,360 --> 04:39:59,120
finally we come to WC. So what you have
7230
04:39:54,638 --> 04:40:01,680
to do here is type in WC
7231
04:39:59,120 --> 04:40:04,320
and the name of the file you want. Let's
7232
04:40:01,680 --> 04:40:06,560
say you want home.
7233
04:40:04,320 --> 04:40:08,958
Right? So this is basically showing you
7234
04:40:06,560 --> 04:40:11,600
the number of characters that the home
7235
04:40:08,958 --> 04:40:14,718
file has. Home file has certain content
7236
04:40:11,600 --> 04:40:17,680
in it and that content has around 48
7237
04:40:14,718 --> 04:40:21,638
characters in it. So that is all about
7238
04:40:17,680 --> 04:40:21,638
the WC command.
7239
04:40:25,360 --> 04:40:29,360
First we will have a look at the Linux
7240
04:40:27,360 --> 04:40:31,200
commands that are very basic. Like even
7241
04:40:29,360 --> 04:40:33,120
if you are not working in DevOps, if you
7242
04:40:31,200 --> 04:40:34,560
are someone who's using the Linux- based
7243
04:40:33,120 --> 04:40:36,798
operating system, you must be knowing
7244
04:40:34,560 --> 04:40:38,320
these commands. These are the frequently
7245
04:40:36,798 --> 04:40:40,400
used commands like while you're working
7246
04:40:38,320 --> 04:40:42,400
in DevOps. Okay, I'm just showing you
7247
04:40:40,400 --> 04:40:44,560
the list. Then we will practically see
7248
04:40:42,400 --> 04:40:47,200
how to use this commands on the command
7249
04:40:44,560 --> 04:40:49,040
prompt. So these are the few commands
7250
04:40:47,200 --> 04:40:50,958
I've tried to cover maximum number of
7251
04:40:49,040 --> 04:40:53,440
commands so that you're comfortable
7252
04:40:50,958 --> 04:40:55,600
working with DevOps. So now let us try
7253
04:40:53,440 --> 04:40:58,080
to execute these commands in an Linux
7254
04:40:55,600 --> 04:41:01,280
based system. So in my system I have
7255
04:40:58,080 --> 04:41:03,920
installed Ubuntu operating system. So
7256
04:41:01,280 --> 04:41:06,400
let us start with the basic commands in
7257
04:41:03,920 --> 04:41:09,040
Linux. So the first command that you
7258
04:41:06,400 --> 04:41:11,120
must know is the man command. Man stands
7259
04:41:09,040 --> 04:41:13,680
for manual. Like if you want to know
7260
04:41:11,120 --> 04:41:16,400
about any command in Linux, you can just
7261
04:41:13,680 --> 04:41:18,638
type man space the name of the command.
7262
04:41:16,400 --> 04:41:21,920
Say for example, you have to know about
7263
04:41:18,638 --> 04:41:24,240
ls. Say for example, just type man space
7264
04:41:21,920 --> 04:41:29,320
ls. So ls is a command. We'll talk about
7265
04:41:24,240 --> 04:41:29,320
it later. So just press enter.
7266
04:41:29,840 --> 04:41:35,840
Okay. So here it shows the name of the
7267
04:41:32,400 --> 04:41:37,920
command, its syntax and the description.
7268
04:41:35,840 --> 04:41:40,560
Like if you want to know what it is and
7269
04:41:37,920 --> 04:41:43,520
what it does so you can use man command
7270
04:41:40,560 --> 04:41:45,200
for it. So the next command that you
7271
04:41:43,520 --> 04:41:46,638
should know is the clear command. If you
7272
04:41:45,200 --> 04:41:48,878
want to clear your terminal just type
7273
04:41:46,638 --> 04:41:51,680
clear and press enter. So this clears
7274
04:41:48,878 --> 04:41:53,600
your terminal. So the next command that
7275
04:41:51,680 --> 04:41:55,200
you must know is uh say for example if
7276
04:41:53,600 --> 04:41:57,280
you want to know where is your current
7277
04:41:55,200 --> 04:41:59,120
working directory. For that there is a
7278
04:41:57,280 --> 04:42:01,600
command called pwd that is present
7279
04:41:59,120 --> 04:42:04,400
working directory. Simply type pwd and
7280
04:42:01,600 --> 04:42:06,718
press enter. Okay. So here it says home
7281
04:42:04,400 --> 04:42:08,958
edurea. So this is my current working
7282
04:42:06,718 --> 04:42:10,320
directory and if you want to change your
7283
04:42:08,958 --> 04:42:12,560
directory for that there's a command
7284
04:42:10,320 --> 04:42:14,718
called cd that is change directory.
7285
04:42:12,560 --> 04:42:16,560
Suppose from home edurea you have to
7286
04:42:14,718 --> 04:42:18,878
switch your working directory to home.
7287
04:42:16,560 --> 04:42:23,520
So simply type home.
7288
04:42:18,878 --> 04:42:26,000
Okay. So if I now type pwd it says home.
7289
04:42:23,520 --> 04:42:28,798
So this was another basic command. So
7290
04:42:26,000 --> 04:42:30,718
the next command is eco command. Say if
7291
04:42:28,798 --> 04:42:33,280
you want to type anything like if you
7292
04:42:30,718 --> 04:42:35,360
want to print anything on the terminal.
7293
04:42:33,280 --> 04:42:38,718
So you can use eco command for that. Say
7294
04:42:35,360 --> 04:42:40,798
for example eco
7295
04:42:38,718 --> 04:42:42,798
hello world.
7296
04:42:40,798 --> 04:42:45,120
So I have to print these two words on
7297
04:42:42,798 --> 04:42:48,080
the terminal. For that I'll use the eco
7298
04:42:45,120 --> 04:42:51,280
command. Okay. So it says hello world.
7299
04:42:48,080 --> 04:42:53,360
Pretty simple. So the next command is su
7300
04:42:51,280 --> 04:42:55,200
command. Let's see first who is the
7301
04:42:53,360 --> 04:42:58,240
current user. For that there's one more
7302
04:42:55,200 --> 04:43:00,878
command called who am I.
7303
04:42:58,240 --> 04:43:02,798
Okay. So here it says edureka. So
7304
04:43:00,878 --> 04:43:05,360
Edureka is the current user of this
7305
04:43:02,798 --> 04:43:07,520
system the Linux system. So if you want
7306
04:43:05,360 --> 04:43:10,080
to switch to the root user who has all
7307
04:43:07,520 --> 04:43:12,638
the permissions as of now the Edureka
7308
04:43:10,080 --> 04:43:14,798
he's not a super user. He doesn't have
7309
04:43:12,638 --> 04:43:17,200
any permissions related to file
7310
04:43:14,798 --> 04:43:20,320
operations or any other operations. So
7311
04:43:17,200 --> 04:43:23,360
root is a user the basic user he has all
7312
04:43:20,320 --> 04:43:25,520
the permissions on this Linux OS. So if
7313
04:43:23,360 --> 04:43:28,560
you want to switch to the root user so
7314
04:43:25,520 --> 04:43:32,080
simply type su press enter it'll ask for
7315
04:43:28,560 --> 04:43:34,798
a password. Type the password.
7316
04:43:32,080 --> 04:43:38,320
So here it says authentication failure.
7317
04:43:34,798 --> 04:43:41,320
So there's one more command bash sudo
7318
04:43:38,320 --> 04:43:41,320
bash.
7319
04:43:45,280 --> 04:43:52,718
Okay. So before it was edurea here and
7320
04:43:48,958 --> 04:43:54,240
now it is root here. So if I type who am
7321
04:43:52,718 --> 04:43:57,120
I?
7322
04:43:54,240 --> 04:43:59,360
So here it says root. Okay. So in case
7323
04:43:57,120 --> 04:44:01,520
if this doesn't work, SU doesn't work
7324
04:43:59,360 --> 04:44:04,320
for any reason. So you can use this
7325
04:44:01,520 --> 04:44:06,878
command called pseudo bash. So it
7326
04:44:04,320 --> 04:44:09,520
switches to the root user. And if you
7327
04:44:06,878 --> 04:44:13,680
want to switch back to Edureka, simply
7328
04:44:09,520 --> 04:44:15,760
type SU and the username.
7329
04:44:13,680 --> 04:44:18,160
Okay. So you're back to the Edureka
7330
04:44:15,760 --> 04:44:20,080
user. Okay.
7331
04:44:18,160 --> 04:44:22,638
These are very basic commands guys, but
7332
04:44:20,080 --> 04:44:25,520
you must be knowing this. So the next
7333
04:44:22,638 --> 04:44:27,680
command is the pseudo command. So pseudo
7334
04:44:25,520 --> 04:44:29,760
command is for user who doesn't have a
7335
04:44:27,680 --> 04:44:32,480
proper permissions or privileges for
7336
04:44:29,760 --> 04:44:34,480
executing some commands or operations.
7337
04:44:32,480 --> 04:44:37,360
So in that case you have to use a pseudo
7338
04:44:34,480 --> 04:44:39,760
command. So say for example adding a
7339
04:44:37,360 --> 04:44:42,000
user, deleting a user, adding a group
7340
04:44:39,760 --> 04:44:44,958
and many other commands that we will see
7341
04:44:42,000 --> 04:44:47,520
in the upcoming commands. So I'll just
7342
04:44:44,958 --> 04:44:49,760
give you a few examples here of pseudo.
7343
04:44:47,520 --> 04:44:52,000
For example, you have to add a user. So
7344
04:44:49,760 --> 04:44:54,480
adding a user, deleting a user that is
7345
04:44:52,000 --> 04:44:56,320
mostly done by the root user. So he has
7346
04:44:54,480 --> 04:44:58,878
all the permissions to add a user and
7347
04:44:56,320 --> 04:45:01,600
all. So say for example if you have to
7348
04:44:58,878 --> 04:45:04,320
add a user. So the command for that is
7349
04:45:01,600 --> 04:45:06,638
sudo user
7350
04:45:04,320 --> 04:45:09,520
add and the name of the user. Say for
7351
04:45:06,638 --> 04:45:11,840
example Arvind.
7352
04:45:09,520 --> 04:45:15,120
Oh it says Arvind already exists. So
7353
04:45:11,840 --> 04:45:17,920
type Arvin 111.
7354
04:45:15,120 --> 04:45:20,000
So it has created a user. And say for
7355
04:45:17,920 --> 04:45:22,000
example if you have to add a password to
7356
04:45:20,000 --> 04:45:28,160
this user. So the command for that is
7357
04:45:22,000 --> 04:45:29,920
pseudo p A sd and the username.
7358
04:45:28,160 --> 04:45:31,840
So it'll ask for a password that you
7359
04:45:29,920 --> 04:45:35,280
need to set. You can type whatever you
7360
04:45:31,840 --> 04:45:37,840
want. Retype it.
7361
04:45:35,280 --> 04:45:40,400
So it has created a user and it has also
7362
04:45:37,840 --> 04:45:41,840
added a password for that user. So say
7363
04:45:40,400 --> 04:45:45,280
for example you have to delete this
7364
04:45:41,840 --> 04:45:50,718
user. So the command for that is pseudo
7365
04:45:45,280 --> 04:45:54,160
user delete userdeel and the username
7366
04:45:50,718 --> 04:45:57,040
or win one one.
7367
04:45:54,160 --> 04:45:59,440
Okay. So the user has been deleted. Say
7368
04:45:57,040 --> 04:46:01,680
for example you have to add a group. A
7369
04:45:59,440 --> 04:46:03,680
group can have multiple users. Okay. So
7370
04:46:01,680 --> 04:46:06,400
you have to add a group to the system.
7371
04:46:03,680 --> 04:46:08,798
So the command for that is sudo group
7372
04:46:06,400 --> 04:46:11,600
add
7373
04:46:08,798 --> 04:46:14,240
and the group name. So you can say the
7374
04:46:11,600 --> 04:46:16,240
group name as techies. Okay. So the
7375
04:46:14,240 --> 04:46:19,200
group has been added. Similarly, if you
7376
04:46:16,240 --> 04:46:22,320
want to remove this group
7377
04:46:19,200 --> 04:46:26,520
sudo group deel and the group name.
7378
04:46:22,320 --> 04:46:26,520
Okay, pretty simple.
7379
04:46:26,798 --> 04:46:30,560
So let me just clear my terminal. So the
7380
04:46:29,280 --> 04:46:32,958
next command that we are going to talk
7381
04:46:30,560 --> 04:46:34,958
about is the touch command. So the touch
7382
04:46:32,958 --> 04:46:36,958
command is used to create any file on
7383
04:46:34,958 --> 04:46:39,760
your system. Say for example, I have to
7384
04:46:36,958 --> 04:46:44,638
create a file, a text file. You can give
7385
04:46:39,760 --> 04:46:46,798
whatever name abc CBA.ext.
7386
04:46:44,638 --> 04:46:48,320
Oh, it says permission denied. Okay. So,
7387
04:46:46,798 --> 04:46:50,958
here we are going to use the command
7388
04:46:48,320 --> 04:46:52,878
sudo.
7389
04:46:50,958 --> 04:46:55,520
So, it has created a file called
7390
04:46:52,878 --> 04:46:58,160
CBA.ext. And how can we see that? Simply
7391
04:46:55,520 --> 04:47:02,400
type ls. Can you see here the file that
7392
04:46:58,160 --> 04:47:04,400
we have just created the CBAT txt? So,
7393
04:47:02,400 --> 04:47:06,560
this is the use of the touch command to
7394
04:47:04,400 --> 04:47:08,400
create a file. So the next command that
7395
04:47:06,560 --> 04:47:11,840
we are going to talk about is the text
7396
04:47:08,400 --> 04:47:15,280
editor command. Say for example vi nano
7397
04:47:11,840 --> 04:47:17,200
vim gedit and so on. So the vi editor is
7398
04:47:15,280 --> 04:47:20,560
the most popular and a classic text
7399
04:47:17,200 --> 04:47:22,000
editor in a Linux family. So to use it
7400
04:47:20,560 --> 04:47:23,600
uh say for example you have to write
7401
04:47:22,000 --> 04:47:26,958
something into that file. So for that
7402
04:47:23,600 --> 04:47:29,360
purpose you will use p sudo vi and the
7403
04:47:26,958 --> 04:47:32,878
name of the file cba.txt.
7404
04:47:29,360 --> 04:47:34,718
Okay. So press enter. The file has been
7405
04:47:32,878 --> 04:47:38,958
opened now. and press I to insert
7406
04:47:34,718 --> 04:47:42,400
anything into this. Say for example, hi
7407
04:47:38,958 --> 04:47:45,840
this is Edurea.
7408
04:47:42,400 --> 04:47:50,000
So to save this file simply press escape
7409
04:47:45,840 --> 04:47:52,798
colon W for write and Q to quit.
7410
04:47:50,000 --> 04:47:55,280
So our file has been saved. So there's
7411
04:47:52,798 --> 04:47:57,520
one more command called cat command. So
7412
04:47:55,280 --> 04:48:00,240
this command can read, modify or
7413
04:47:57,520 --> 04:48:02,240
concatenate text files. So this command
7414
04:48:00,240 --> 04:48:04,320
is also used to display the contents of
7415
04:48:02,240 --> 04:48:06,000
the file. So say for example I've
7416
04:48:04,320 --> 04:48:08,878
written something into this file called
7417
04:48:06,000 --> 04:48:10,480
CBA.txt. Now I have to display the
7418
04:48:08,878 --> 04:48:16,240
contents of this file. So what I'll do
7419
04:48:10,480 --> 04:48:18,718
is cat and file name CBA. TXT.
7420
04:48:16,240 --> 04:48:21,360
So here this was the line that I had
7421
04:48:18,718 --> 04:48:23,600
written in this file CBA. TXT. So the
7422
04:48:21,360 --> 04:48:25,520
cat command can be used for that. So
7423
04:48:23,600 --> 04:48:27,600
there are also other flags that can be
7424
04:48:25,520 --> 04:48:30,320
used with this command. Say for example
7425
04:48:27,600 --> 04:48:33,600
hyphen B. So the command would be
7426
04:48:30,320 --> 04:48:35,280
cat-ben and the file name. So this is
7427
04:48:33,600 --> 04:48:38,000
used to add line numbers to the
7428
04:48:35,280 --> 04:48:41,440
non-blank lines. So the next flag is
7429
04:48:38,000 --> 04:48:43,680
hyphen n that is cat-n. So this command
7430
04:48:41,440 --> 04:48:46,400
is used to add line numbers to all the
7431
04:48:43,680 --> 04:48:49,040
lines that are present in the file. Caty
7432
04:48:46,400 --> 04:48:52,798
s is used to squeeze blank lines into
7433
04:48:49,040 --> 04:48:55,520
one lines. And cat-en capital e it shows
7434
04:48:52,798 --> 04:48:57,600
the dollar sign at the end of the line.
7435
04:48:55,520 --> 04:48:59,600
So these were a few flags that you can
7436
04:48:57,600 --> 04:49:01,760
use with cat command. So let me just
7437
04:48:59,600 --> 04:49:03,360
clear the terminal. So the next command
7438
04:49:01,760 --> 04:49:05,840
that we are going to talk about is the
7439
04:49:03,360 --> 04:49:08,718
copy command. This command is used to
7440
04:49:05,840 --> 04:49:11,360
copy files and directories. A copy of
7441
04:49:08,718 --> 04:49:13,680
the file directory still remains in the
7442
04:49:11,360 --> 04:49:16,400
working directory. So let me just show
7443
04:49:13,680 --> 04:49:19,760
you how do you use this command. So it
7444
04:49:16,400 --> 04:49:21,440
is very simple. Copy. So say for example
7445
04:49:19,760 --> 04:49:24,160
CBA
7446
04:49:21,440 --> 04:49:27,760
txt. I have to copy this file to the
7447
04:49:24,160 --> 04:49:30,160
location. Say for example home
7448
04:49:27,760 --> 04:49:32,000
edurea. Right now we are at the home
7449
04:49:30,160 --> 04:49:34,160
location. Have to copy this file to this
7450
04:49:32,000 --> 04:49:36,878
location home edurea. Okay. So the
7451
04:49:34,160 --> 04:49:40,240
command is very simple. CP file name and
7452
04:49:36,878 --> 04:49:43,040
the destination name. So press enter. So
7453
04:49:40,240 --> 04:49:45,040
let us now see whether the file has been
7454
04:49:43,040 --> 04:49:49,000
copied there. So for that we'll have to
7455
04:49:45,040 --> 04:49:49,000
switch to that location.
7456
04:49:49,520 --> 04:49:55,920
CD edureka.
7457
04:49:52,240 --> 04:49:58,878
Uh so let us use the ls command. Okay.
7458
04:49:55,920 --> 04:50:01,280
So here you can see the cba.txt file has
7459
04:49:58,878 --> 04:50:03,440
been copied. So this was a very simple
7460
04:50:01,280 --> 04:50:05,600
command and there are a few flags that
7461
04:50:03,440 --> 04:50:07,920
you can use along with this command. So
7462
04:50:05,600 --> 04:50:10,878
there's a flag called hyphen n that is
7463
04:50:07,920 --> 04:50:13,840
cp - n and the file name. So this does
7464
04:50:10,878 --> 04:50:17,200
not override the file. The next flag is
7465
04:50:13,840 --> 04:50:19,280
the hyphen u that is cpu. So this
7466
04:50:17,200 --> 04:50:20,798
command updates the destination file
7467
04:50:19,280 --> 04:50:23,040
only when the source file is different
7468
04:50:20,798 --> 04:50:25,280
from the destination file. There's one
7469
04:50:23,040 --> 04:50:28,718
more flag called hyphen capital R that
7470
04:50:25,280 --> 04:50:31,120
is cp capital R. So this command is a
7471
04:50:28,718 --> 04:50:33,360
recursive copy for copying directories
7472
04:50:31,120 --> 04:50:36,080
and this command even copies the hidden
7473
04:50:33,360 --> 04:50:38,638
files. So these were a few flags that
7474
04:50:36,080 --> 04:50:40,878
you can use with the copy command. So
7475
04:50:38,638 --> 04:50:43,280
the next command is the move command or
7476
04:50:40,878 --> 04:50:45,200
the MV command. So this command moves
7477
04:50:43,280 --> 04:50:47,760
the files and the directories from one
7478
04:50:45,200 --> 04:50:50,000
directory to the another. The file or
7479
04:50:47,760 --> 04:50:52,400
the directory once moved is deleted from
7480
04:50:50,000 --> 04:50:54,878
the working directory. So this was not
7481
04:50:52,400 --> 04:50:56,560
the case with the copy command. So I
7482
04:50:54,878 --> 04:50:59,120
hope you get the difference between copy
7483
04:50:56,560 --> 04:51:02,000
and move. So let us see what is the
7484
04:50:59,120 --> 04:51:04,080
syntax for this. So the syntax is MB um
7485
04:51:02,000 --> 04:51:07,760
the flag name like if there are any
7486
04:51:04,080 --> 04:51:11,040
flags here, the file name
7487
04:51:07,760 --> 04:51:14,718
and the destination name. Okay, the path
7488
04:51:11,040 --> 04:51:16,400
to the destination. So let us just say
7489
04:51:14,718 --> 04:51:18,320
first we'll have a look at the files
7490
04:51:16,400 --> 04:51:20,798
that are present here. Okay, so
7491
04:51:18,320 --> 04:51:22,878
demo.txt. Can you see this file here? So
7492
04:51:20,798 --> 04:51:25,280
we'll try to move this file to the home
7493
04:51:22,878 --> 04:51:27,920
folder. So the command is very simple.
7494
04:51:25,280 --> 04:51:31,798
MV the file name
7495
04:51:27,920 --> 04:51:31,798
demo. TXT.
7496
04:51:34,480 --> 04:51:39,638
It says permission denied. So just
7497
04:51:36,160 --> 04:51:39,638
simply use sudo.
7498
04:51:43,520 --> 04:51:50,440
Okay, the file has been moved. Let us
7499
04:51:45,680 --> 04:51:50,440
now verify this cd.
7500
04:51:52,958 --> 04:51:58,638
Okay, so we are here at the home folder.
7501
04:51:56,160 --> 04:52:02,240
Simply use ls command. So as you can see
7502
04:51:58,638 --> 04:52:04,480
here, demo.txt has been moved. So this
7503
04:52:02,240 --> 04:52:06,638
was a very simple command and easy to
7504
04:52:04,480 --> 04:52:09,680
use command. There are three flags that
7505
04:52:06,638 --> 04:52:11,360
are associated with this command. MV-I.
7506
04:52:09,680 --> 04:52:13,120
So this command enters into an
7507
04:52:11,360 --> 04:52:16,000
interactive mode and the command line
7508
04:52:13,120 --> 04:52:18,878
asks before overwriting the files. So
7509
04:52:16,000 --> 04:52:20,560
the command mvu updates the destination
7510
04:52:18,878 --> 04:52:22,798
file only when the source file is
7511
04:52:20,560 --> 04:52:26,160
different from the destination file. And
7512
04:52:22,798 --> 04:52:28,400
the third flag is the mv -v. So this
7513
04:52:26,160 --> 04:52:30,160
command enters the verbos mode. And this
7514
04:52:28,400 --> 04:52:32,240
command prints the source and the
7515
04:52:30,160 --> 04:52:34,560
destination file. So for those who are
7516
04:52:32,240 --> 04:52:37,120
not aware of what verbose mode is. So,
7517
04:52:34,560 --> 04:52:39,680
verbos mode provides additional details
7518
04:52:37,120 --> 04:52:42,560
as to what drivers and softwares it is
7519
04:52:39,680 --> 04:52:46,000
loading during the startup. So, this was
7520
04:52:42,560 --> 04:52:47,440
all about the uh move command.
7521
04:52:46,000 --> 04:52:49,840
So, the next command that we are going
7522
04:52:47,440 --> 04:52:51,920
to talk about is the rm command. So,
7523
04:52:49,840 --> 04:52:54,718
this command removes files from a
7524
04:52:51,920 --> 04:52:56,878
directory. By default, the rm command
7525
04:52:54,718 --> 04:52:58,878
does not remove directories. Once
7526
04:52:56,878 --> 04:53:01,280
removed, the contents of the file cannot
7527
04:52:58,878 --> 04:53:05,520
be recovered. So, the syntax for this is
7528
04:53:01,280 --> 04:53:08,718
very simple. rm the flag flag name and
7529
04:53:05,520 --> 04:53:11,120
the file name. It's a very simple
7530
04:53:08,718 --> 04:53:13,360
command and easy to use command. So I'll
7531
04:53:11,120 --> 04:53:16,160
just show you how to use this. Say for
7532
04:53:13,360 --> 04:53:19,200
example I have to remove this file
7533
04:53:16,160 --> 04:53:21,920
demo.txt. So simply I'll type rm in the
7534
04:53:19,200 --> 04:53:24,080
file name demo.
7535
04:53:21,920 --> 04:53:28,200
TXT.
7536
04:53:24,080 --> 04:53:28,200
Oh, it says permission denied.
7537
04:53:28,718 --> 04:53:34,160
So the file has been removed. And let us
7538
04:53:31,040 --> 04:53:37,520
just verify this. Okay. So we cannot see
7539
04:53:34,160 --> 04:53:39,680
anywhere the demo.txt file. So it has
7540
04:53:37,520 --> 04:53:42,320
been removed. So this was a very simple
7541
04:53:39,680 --> 04:53:44,400
command rm. So there are two flags that
7542
04:53:42,320 --> 04:53:47,360
can be used along with this command. The
7543
04:53:44,400 --> 04:53:49,520
first flag is the rm - r. So this
7544
04:53:47,360 --> 04:53:53,200
command removes even the non-mpt
7545
04:53:49,520 --> 04:53:55,760
directories and the other flag is rm -
7546
04:53:53,200 --> 04:53:57,920
rp. So this command removes the non-
7547
04:53:55,760 --> 04:54:01,200
empty directories including the parents
7548
04:53:57,920 --> 04:54:03,440
and the subdirectories. So this was the
7549
04:54:01,200 --> 04:54:05,680
rm command. So the next command that
7550
04:54:03,440 --> 04:54:08,000
we're going to talk about is the mkdir
7551
04:54:05,680 --> 04:54:10,480
command. So if you want to create a new
7552
04:54:08,000 --> 04:54:12,240
directory then this command can be used.
7553
04:54:10,480 --> 04:54:14,718
It's a very simple command and the
7554
04:54:12,240 --> 04:54:16,400
syntax is even more simple. So if you
7555
04:54:14,718 --> 04:54:19,360
have to create a directory simply type
7556
04:54:16,400 --> 04:54:21,280
mkdir and the directory name. So say for
7557
04:54:19,360 --> 04:54:26,200
example in home I have to create a
7558
04:54:21,280 --> 04:54:26,200
directory called techies.
7559
04:54:26,320 --> 04:54:32,400
It says permission denied. No issues.
7560
04:54:30,638 --> 04:54:34,718
So the directory has been created. Let
7561
04:54:32,400 --> 04:54:36,798
us just verify this. So as you can see
7562
04:54:34,718 --> 04:54:39,360
here this directory has been created
7563
04:54:36,798 --> 04:54:41,120
here at this location the home folder.
7564
04:54:39,360 --> 04:54:45,520
So the flag that can be used with this
7565
04:54:41,120 --> 04:54:47,520
command is hyphen p that is mkdir - p.
7566
04:54:45,520 --> 04:54:50,240
So this command creates both a parent
7567
04:54:47,520 --> 04:54:52,560
directory and a subdirectory. And if you
7568
04:54:50,240 --> 04:54:55,200
want to create multiple files into a
7569
04:54:52,560 --> 04:54:58,400
directory you can use the command mkdir
7570
04:54:55,200 --> 04:55:00,320
- p and the file names. So this command
7571
04:54:58,400 --> 04:55:04,160
will create multiple subdirectories
7572
04:55:00,320 --> 04:55:06,400
inside the new parent directory. So let
7573
04:55:04,160 --> 04:55:08,798
me just clear the terminal. The next
7574
04:55:06,400 --> 04:55:10,798
command is the rmdir command or the
7575
04:55:08,798 --> 04:55:13,040
remove directory command. So this
7576
04:55:10,798 --> 04:55:15,200
command is used to remove a specified
7577
04:55:13,040 --> 04:55:17,360
directory. Although by default it can
7578
04:55:15,200 --> 04:55:19,360
remove only an empty directory, there
7579
04:55:17,360 --> 04:55:21,760
are flags which can be deployed to
7580
04:55:19,360 --> 04:55:23,840
delete the non-mpt directories as well.
7581
04:55:21,760 --> 04:55:26,400
And the syntax for this command is very
7582
04:55:23,840 --> 04:55:30,638
simple. Simply type rmdir
7583
04:55:26,400 --> 04:55:35,120
the flag name and the directory name.
7584
04:55:30,638 --> 04:55:38,480
Okay. So very simple. Let us just see
7585
04:55:35,120 --> 04:55:40,160
how do you remove a directory rmdir. So
7586
04:55:38,480 --> 04:55:42,638
let us just remove the directory that we
7587
04:55:40,160 --> 04:55:46,600
created in the previous command rmdir
7588
04:55:42,638 --> 04:55:46,600
and the name was techies.
7589
04:55:47,360 --> 04:55:53,520
sudo rmdir techies.
7590
04:55:51,280 --> 04:55:56,798
Okay. So the directory has been removed.
7591
04:55:53,520 --> 04:55:58,638
Let's just verify this. So there's no
7592
04:55:56,798 --> 04:56:01,200
directory called tech is here as it has
7593
04:55:58,638 --> 04:56:02,958
been removed by the rmdir command. So
7594
04:56:01,200 --> 04:56:05,280
there are a couple of flags that you can
7595
04:56:02,958 --> 04:56:09,040
use with this command. The first flag is
7596
04:56:05,280 --> 04:56:11,200
hyphen p that is rmdir - p. So this
7597
04:56:09,040 --> 04:56:13,440
command removes both the parent and the
7598
04:56:11,200 --> 04:56:15,920
child directory. There's one more flag
7599
04:56:13,440 --> 04:56:19,520
called hyphen pv. So the command is
7600
04:56:15,920 --> 04:56:21,200
rmdir - pv. So this command removes all
7601
04:56:19,520 --> 04:56:24,000
the parent and the subd directories
7602
04:56:21,200 --> 04:56:26,798
along with the verbos. So I hope you're
7603
04:56:24,000 --> 04:56:27,920
clear with this command rmdir. So the
7604
04:56:26,798 --> 04:56:30,400
next command that we are going to
7605
04:56:27,920 --> 04:56:32,320
discuss is the grap command. So this
7606
04:56:30,400 --> 04:56:34,320
command is used to search for a
7607
04:56:32,320 --> 04:56:36,480
particular string or a word in a text
7608
04:56:34,320 --> 04:56:39,200
file. So this command is similar to
7609
04:56:36,480 --> 04:56:41,680
control f but this is executed via a
7610
04:56:39,200 --> 04:56:44,480
command line. So let me just show you
7611
04:56:41,680 --> 04:56:46,560
how do you use this command. So let us
7612
04:56:44,480 --> 04:56:48,958
say for example let me have a text file
7613
04:56:46,560 --> 04:56:51,120
here. So the syntax for using this
7614
04:56:48,958 --> 04:56:53,120
command is very simple. So say for
7615
04:56:51,120 --> 04:56:55,760
example we have a file here called gp
7616
04:56:53,120 --> 04:56:57,520
test as you can see here this one. So
7617
04:56:55,760 --> 04:57:01,120
let me just see the contents of this
7618
04:56:57,520 --> 04:57:03,200
file using cat command
7619
04:57:01,120 --> 04:57:05,760
grip test
7620
04:57:03,200 --> 04:57:09,040
dot txt.
7621
04:57:05,760 --> 04:57:12,000
So this file has these words dog apple
7622
04:57:09,040 --> 04:57:13,600
ball cat mouse. So say for example I
7623
04:57:12,000 --> 04:57:16,240
have to search the word cat in this
7624
04:57:13,600 --> 04:57:21,920
file. So for that I'll use the command
7625
04:57:16,240 --> 04:57:26,798
gp the word cat and the file name
7626
04:57:21,920 --> 04:57:29,200
gp test dot txt.
7627
04:57:26,798 --> 04:57:31,440
Okay. So as you can see here the word
7628
04:57:29,200 --> 04:57:33,360
cat has been highlighted just because it
7629
04:57:31,440 --> 04:57:34,878
is present in this file. So say for
7630
04:57:33,360 --> 04:57:36,480
example we want to search for a word
7631
04:57:34,878 --> 04:57:39,440
that is not present here. So say for
7632
04:57:36,480 --> 04:57:42,000
example cat one or any other word. So
7633
04:57:39,440 --> 04:57:44,160
say for example mad.
7634
04:57:42,000 --> 04:57:46,080
Okay. So it is not showing anything that
7635
04:57:44,160 --> 04:57:48,560
means that this word is not present in
7636
04:57:46,080 --> 04:57:50,958
this file. So this was a very simple
7637
04:57:48,560 --> 04:57:53,440
command grip and there are a few flags
7638
04:57:50,958 --> 04:57:55,920
that you can use with this command. So
7639
04:57:53,440 --> 04:58:00,000
say for example grip
7640
04:57:55,920 --> 04:58:02,320
hyphen i and obviously the file name. So
7641
04:58:00,000 --> 04:58:04,878
this command will return the results for
7642
04:58:02,320 --> 04:58:07,360
case insensitive strings. So there's one
7643
04:58:04,878 --> 04:58:10,000
more flag called hyphen n that is grap
7644
04:58:07,360 --> 04:58:12,080
hyphen n. So this command returns the
7645
04:58:10,000 --> 04:58:16,160
matching strings along with their line
7646
04:58:12,080 --> 04:58:18,240
numbers. The next flag is the graph - v.
7647
04:58:16,160 --> 04:58:20,798
So this command returns the results of
7648
04:58:18,240 --> 04:58:24,320
lines not matching the search string.
7649
04:58:20,798 --> 04:58:26,480
Next flag is grap - c. So this command
7650
04:58:24,320 --> 04:58:31,120
returns the number of lines in which the
7651
04:58:26,480 --> 04:58:32,718
results matched the search string.
7652
04:58:31,120 --> 04:58:35,200
So the next command that we are going to
7653
04:58:32,718 --> 04:58:37,520
talk about is the sort command. So this
7654
04:58:35,200 --> 04:58:40,560
command sorts the results of a search
7655
04:58:37,520 --> 04:58:43,600
either alphabetically or numerically.
7656
04:58:40,560 --> 04:58:46,240
Files, file contents and directories can
7657
04:58:43,600 --> 04:58:49,520
be sorted using this command. The syntax
7658
04:58:46,240 --> 04:58:51,440
for this command is very simple. Uh let
7659
04:58:49,520 --> 04:58:53,520
me just see the files that are present
7660
04:58:51,440 --> 04:58:55,760
here. So there's a file called sort
7661
04:58:53,520 --> 04:58:58,638
test. So let me just see the contents of
7662
04:58:55,760 --> 04:59:01,920
this file. sort
7663
04:58:58,638 --> 04:59:04,240
test dot txt.
7664
04:59:01,920 --> 04:59:06,000
Okay, these are the words that are
7665
04:59:04,240 --> 04:59:08,480
present in this file. So I have to just
7666
04:59:06,000 --> 04:59:14,200
sort these words. Okay, so the command
7667
04:59:08,480 --> 04:59:14,200
for that is sort the file name sort
7668
04:59:14,320 --> 04:59:20,000
test dot txt.
7669
04:59:17,760 --> 04:59:24,240
So as you can see here these words have
7670
04:59:20,000 --> 04:59:26,878
been sorted alphabetically B, D, F, M, S
7671
04:59:24,240 --> 04:59:29,040
and T. So this is the use of sort
7672
04:59:26,878 --> 04:59:31,040
command and there are a few flags that
7673
04:59:29,040 --> 04:59:35,120
you can use with this command like the
7674
04:59:31,040 --> 04:59:37,920
first flag is sort hyphen r and the file
7675
04:59:35,120 --> 04:59:40,718
name obviously. So this command returns
7676
04:59:37,920 --> 04:59:43,200
the results in reverse order. So there's
7677
04:59:40,718 --> 04:59:45,280
one more flag called hyphen f. So this
7678
04:59:43,200 --> 04:59:47,760
command does the case insensitive
7679
04:59:45,280 --> 04:59:50,080
sorting. So whether you have uppercase
7680
04:59:47,760 --> 04:59:53,840
words or alphabets or whatever in your
7681
04:59:50,080 --> 04:59:56,000
file. So irrespective of the case this
7682
04:59:53,840 --> 04:59:58,958
command will sort the file and there's
7683
04:59:56,000 --> 05:00:01,280
one more flag called sorty-phen n. So
7684
04:59:58,958 --> 05:00:03,840
this command returns the results as per
7685
05:00:01,280 --> 05:00:06,560
the numerical order. So say for example
7686
05:00:03,840 --> 05:00:08,400
you have numbers in this file and if you
7687
05:00:06,560 --> 05:00:10,878
want to sort them numerically like
7688
05:00:08,400 --> 05:00:13,440
ascending order that can be done using
7689
05:00:10,878 --> 05:00:15,680
the command hyphen in. So this was
7690
05:00:13,440 --> 05:00:19,040
pretty much about the sort command. So
7691
05:00:15,680 --> 05:00:20,718
let me just clear the terminal.
7692
05:00:19,040 --> 05:00:23,760
So the next command that we are going to
7693
05:00:20,718 --> 05:00:25,920
talk about is the ch own command. So
7694
05:00:23,760 --> 05:00:28,080
different users in the OS have
7695
05:00:25,920 --> 05:00:29,920
ownerships and the permissions to ensure
7696
05:00:28,080 --> 05:00:31,760
that the files are secure and put
7697
05:00:29,920 --> 05:00:34,320
restrictions on who can modify the
7698
05:00:31,760 --> 05:00:36,638
contents of the file. In Linux there are
7699
05:00:34,320 --> 05:00:38,718
different users who can use the system.
7700
05:00:36,638 --> 05:00:41,360
So each user has some properties
7701
05:00:38,718 --> 05:00:44,080
associated with them such as the user ID
7702
05:00:41,360 --> 05:00:46,080
and a home directory. We can add users
7703
05:00:44,080 --> 05:00:48,798
into a group to make the process of
7704
05:00:46,080 --> 05:00:51,760
managing the users easier. A group can
7705
05:00:48,798 --> 05:00:54,240
have zero or more users. A specified
7706
05:00:51,760 --> 05:00:56,878
user can be associated with a default
7707
05:00:54,240 --> 05:00:59,360
group. It can also be a member of other
7708
05:00:56,878 --> 05:01:00,878
groups on the systems as well. So if you
7709
05:00:59,360 --> 05:01:03,200
talk about the ownerships and the
7710
05:01:00,878 --> 05:01:05,840
permissions so to protect and secure the
7711
05:01:03,200 --> 05:01:08,240
files and directories in Linux, we use
7712
05:01:05,840 --> 05:01:10,958
permissions to control what a user can
7713
05:01:08,240 --> 05:01:12,320
do with a file or a directory. So in
7714
05:01:10,958 --> 05:01:14,400
Linux there are three types of
7715
05:01:12,320 --> 05:01:15,920
permission. The read permission, the
7716
05:01:14,400 --> 05:01:17,840
write permission and the execute
7717
05:01:15,920 --> 05:01:20,240
permission. So the read permission
7718
05:01:17,840 --> 05:01:22,480
allows the user to read files and
7719
05:01:20,240 --> 05:01:24,638
directories. It lets the user read
7720
05:01:22,480 --> 05:01:27,280
directories and subdirectories stored in
7721
05:01:24,638 --> 05:01:30,080
it. The write permission allows the user
7722
05:01:27,280 --> 05:01:32,718
to modify and delete a file. Also, it
7723
05:01:30,080 --> 05:01:35,360
allows a user to modify its contents for
7724
05:01:32,718 --> 05:01:37,440
the directories. So unless the execute
7725
05:01:35,360 --> 05:01:39,680
permission is not given to directories,
7726
05:01:37,440 --> 05:01:41,840
changes do not affect them. The third
7727
05:01:39,680 --> 05:01:43,920
permission is the execute permission. So
7728
05:01:41,840 --> 05:01:46,798
the right permission on a file allows it
7729
05:01:43,920 --> 05:01:49,440
to get executed. For example, if we have
7730
05:01:46,798 --> 05:01:51,520
a file named php.sh.
7731
05:01:49,440 --> 05:01:54,480
So unless we don't give it an execute
7732
05:01:51,520 --> 05:01:56,560
permission, it won't be run. So these
7733
05:01:54,480 --> 05:01:58,080
were the permissions types of file
7734
05:01:56,560 --> 05:02:00,480
permissions in Linux. There are three
7735
05:01:58,080 --> 05:02:02,480
types. The first one is the user. So
7736
05:02:00,480 --> 05:02:04,718
these type of file permission affect the
7737
05:02:02,480 --> 05:02:07,040
owner of the file. The second one is the
7738
05:02:04,718 --> 05:02:09,360
group. This type of file permission
7739
05:02:07,040 --> 05:02:11,440
affects the group which owns the file.
7740
05:02:09,360 --> 05:02:13,600
So instead of the group permissions the
7741
05:02:11,440 --> 05:02:15,760
user permissions will apply if the owner
7742
05:02:13,600 --> 05:02:18,080
user is in this group. The third
7743
05:02:15,760 --> 05:02:20,080
permission is the other permission. So
7744
05:02:18,080 --> 05:02:22,958
these type of file permission affect all
7745
05:02:20,080 --> 05:02:26,160
the users on the systems. So to view
7746
05:02:22,958 --> 05:02:28,560
this permissions. So let us just say we
7747
05:02:26,160 --> 05:02:31,040
use a command ls-
7748
05:02:28,560 --> 05:02:33,360
l.
7749
05:02:31,040 --> 05:02:34,718
So this command will list down all the
7750
05:02:33,360 --> 05:02:36,000
files and the directories that are
7751
05:02:34,718 --> 05:02:37,920
present here along with their
7752
05:02:36,000 --> 05:02:40,320
permissions. So as you can see here
7753
05:02:37,920 --> 05:02:44,080
these are the permissions these are the
7754
05:02:40,320 --> 05:02:46,320
users the groups and the timestamp and
7755
05:02:44,080 --> 05:02:49,040
these are the names of the file to use
7756
05:02:46,320 --> 05:02:52,080
this command. So say for example there's
7757
05:02:49,040 --> 05:02:54,480
this file called abc.txt whose user is
7758
05:02:52,080 --> 05:02:56,718
edureka okay so you have to use this
7759
05:02:54,480 --> 05:03:00,160
command ch. So the syntax for that is
7760
05:02:56,718 --> 05:03:02,000
pretty simple ch the owner name the
7761
05:03:00,160 --> 05:03:04,798
owner that you want to change. So say
7762
05:03:02,000 --> 05:03:08,160
for example root and the file name. So
7763
05:03:04,798 --> 05:03:11,200
file name is abc.t txt
7764
05:03:08,160 --> 05:03:14,320
operation not permitted. Sudo, let me
7765
05:03:11,200 --> 05:03:16,638
just try sudo.
7766
05:03:14,320 --> 05:03:19,600
Okay, so this works when you use sudo.
7767
05:03:16,638 --> 05:03:21,520
So let us now just run the command ls- n
7768
05:03:19,600 --> 05:03:24,320
to see the permissions of this file. So
7769
05:03:21,520 --> 05:03:27,360
as you can see here it was first edurea.
7770
05:03:24,320 --> 05:03:29,920
Now let us see the changed owner. Okay.
7771
05:03:27,360 --> 05:03:31,920
So previously it was edurea and now it
7772
05:03:29,920 --> 05:03:36,080
is root. Okay. So this is how you use
7773
05:03:31,920 --> 05:03:38,320
the ch own command. So just to summarize
7774
05:03:36,080 --> 05:03:43,160
the ch command is used to change the
7775
05:03:38,320 --> 05:03:43,160
owner and the group of the file.
7776
05:03:46,798 --> 05:03:51,120
So the next command that we are going to
7777
05:03:48,400 --> 05:03:53,040
talk about is the chod command. So this
7778
05:03:51,120 --> 05:03:55,840
command is used to change the access
7779
05:03:53,040 --> 05:03:57,840
permissions of files and directories. So
7780
05:03:55,840 --> 05:04:00,080
the syntax for this command is pretty
7781
05:03:57,840 --> 05:04:02,000
much simple. So say for example if you
7782
05:04:00,080 --> 05:04:04,878
want to change the permissions and the
7783
05:04:02,000 --> 05:04:07,280
privileges of a file. So for that uh let
7784
05:04:04,878 --> 05:04:09,440
us just see the list of files that is
7785
05:04:07,280 --> 05:04:12,638
present here and the permissions. So say
7786
05:04:09,440 --> 05:04:16,240
for example this file bac.ext
7787
05:04:12,638 --> 05:04:18,160
it has these permissions. So we want to
7788
05:04:16,240 --> 05:04:20,560
give all the permissions to all the
7789
05:04:18,160 --> 05:04:23,280
users and the groups that want to use
7790
05:04:20,560 --> 05:04:27,320
this file. So for that let me type the
7791
05:04:23,280 --> 05:04:27,320
command chod
7792
05:04:28,160 --> 05:04:38,000
7. Okay. and the file name bac
7793
05:04:34,080 --> 05:04:40,320
txt. Okay. So let us again have a look
7794
05:04:38,000 --> 05:04:42,400
at the permissions of this file. Okay.
7795
05:04:40,320 --> 05:04:44,320
So as you can see here previously these
7796
05:04:42,400 --> 05:04:46,718
were the permissions read write read and
7797
05:04:44,320 --> 05:04:49,040
read and now it has changed to read
7798
05:04:46,718 --> 05:04:52,000
write execute for the user the group and
7799
05:04:49,040 --> 05:04:53,920
the others. Okay. So there are a few
7800
05:04:52,000 --> 05:04:56,000
numbers that are associated with the
7801
05:04:53,920 --> 05:04:58,560
permissions like zero means no
7802
05:04:56,000 --> 05:05:00,718
permission at all. One means the execute
7803
05:04:58,560 --> 05:05:03,120
permission. Two means the write
7804
05:05:00,718 --> 05:05:05,200
permission and four means the read
7805
05:05:03,120 --> 05:05:08,718
permission. So here we have used the
7806
05:05:05,200 --> 05:05:11,600
command ch 7. So seven here means read
7807
05:05:08,718 --> 05:05:14,400
write execute all the three four 2 and
7808
05:05:11,600 --> 05:05:16,160
1. So read execute for the user. The
7809
05:05:14,400 --> 05:05:18,240
second seven is for the group and the
7810
05:05:16,160 --> 05:05:21,600
third seven is for any other users or
7811
05:05:18,240 --> 05:05:23,440
the groups. So this was the chmod
7812
05:05:21,600 --> 05:05:25,440
command and I hope you have understood
7813
05:05:23,440 --> 05:05:27,840
this command.
7814
05:05:25,440 --> 05:05:29,120
So let me just clear the terminal. So
7815
05:05:27,840 --> 05:05:32,718
the next command that we are going to
7816
05:05:29,120 --> 05:05:35,040
talk about is the lsof command. So while
7817
05:05:32,718 --> 05:05:36,878
working in Linux or Unix based system
7818
05:05:35,040 --> 05:05:39,120
there might be several files and folders
7819
05:05:36,878 --> 05:05:40,560
which are being used. Some of them are
7820
05:05:39,120 --> 05:05:43,920
visible and some of them are not
7821
05:05:40,560 --> 05:05:46,560
visible. So lsof stands for list of open
7822
05:05:43,920 --> 05:05:49,200
files. So this command provides a list
7823
05:05:46,560 --> 05:05:51,200
of files that are opened. Basically it
7824
05:05:49,200 --> 05:05:53,840
gives the information to find out the
7825
05:05:51,200 --> 05:05:56,320
files which are opened by which process.
7826
05:05:53,840 --> 05:05:58,160
So with one go this command lists out
7827
05:05:56,320 --> 05:06:00,798
all the open files in the output
7828
05:05:58,160 --> 05:06:03,200
console. So the syntax for this command
7829
05:06:00,798 --> 05:06:06,200
is pretty much simple. Let us just type
7830
05:06:03,200 --> 05:06:06,200
ls.
7831
05:06:06,798 --> 05:06:11,840
So as you can see here this is the list
7832
05:06:09,040 --> 05:06:17,280
of open files
7833
05:06:11,840 --> 05:06:19,760
these many files. Okay. If you scroll.
7834
05:06:17,280 --> 05:06:22,560
So here you observe there are details of
7835
05:06:19,760 --> 05:06:25,600
which files are opened. The process ID,
7836
05:06:22,560 --> 05:06:28,718
the user associated with the process. FD
7837
05:06:25,600 --> 05:06:30,798
stands for file descriptor. Size of the
7838
05:06:28,718 --> 05:06:33,120
file altogether gives detailed
7839
05:06:30,798 --> 05:06:35,600
information about the file opened by the
7840
05:06:33,120 --> 05:06:38,718
command, the process ID, its user and so
7841
05:06:35,600 --> 05:06:41,760
on. So cwd here stands for current
7842
05:06:38,718 --> 05:06:44,000
working directory. Okay. Txt stands for
7843
05:06:41,760 --> 05:06:46,400
the text file obviously. So say for
7844
05:06:44,000 --> 05:06:49,120
example if you want to know the list of
7845
05:06:46,400 --> 05:06:50,878
all files opened by a particular user.
7846
05:06:49,120 --> 05:06:52,400
So there are several users of a system
7847
05:06:50,878 --> 05:06:54,958
and each user can have different
7848
05:06:52,400 --> 05:06:58,240
requirements and accordingly they use
7849
05:06:54,958 --> 05:07:00,160
files and devices. So to find a list of
7850
05:06:58,240 --> 05:07:03,280
files that are opened by a specific
7851
05:07:00,160 --> 05:07:06,320
user, you can use the command say for
7852
05:07:03,280 --> 05:07:09,040
example lsof
7853
05:07:06,320 --> 05:07:12,440
hyphen u and the username say for
7854
05:07:09,040 --> 05:07:12,440
example edureka.
7855
05:07:13,760 --> 05:07:19,440
So these are the lists of file that are
7856
05:07:16,080 --> 05:07:21,920
opened by the user edureka.
7857
05:07:19,440 --> 05:07:23,280
Let me just clear the terminal. So then
7858
05:07:21,920 --> 05:07:26,160
next command that we are going to talk
7859
05:07:23,280 --> 05:07:28,480
about is the id command. So the ID
7860
05:07:26,160 --> 05:07:31,120
command in Linux is used to find out
7861
05:07:28,480 --> 05:07:33,280
user and the group names and numeric IDs
7862
05:07:31,120 --> 05:07:35,920
of the current user or any other user in
7863
05:07:33,280 --> 05:07:38,400
the server. So this command is used to
7864
05:07:35,920 --> 05:07:41,200
find out a few important things such as
7865
05:07:38,400 --> 05:07:44,160
the username and the real user ID. Find
7866
05:07:41,200 --> 05:07:46,638
out the specific user's UID, show the
7867
05:07:44,160 --> 05:07:49,280
UID and the groups associated with a
7868
05:07:46,638 --> 05:07:51,760
user. List out all the groups a user
7869
05:07:49,280 --> 05:07:55,040
belongs to and display the security
7870
05:07:51,760 --> 05:07:56,958
context of the current user. The syntax
7871
05:07:55,040 --> 05:08:02,400
for this command is pretty much simple.
7872
05:07:56,958 --> 05:08:04,878
ID, the flag, and the username.
7873
05:08:02,400 --> 05:08:07,520
Okay, so there are a few flags that you
7874
05:08:04,878 --> 05:08:09,840
can use with this command. The first
7875
05:08:07,520 --> 05:08:13,040
flag is the hyphen G. So the command
7876
05:08:09,840 --> 05:08:15,040
would be ID - G and the username. So
7877
05:08:13,040 --> 05:08:18,958
this command prints only the effective
7878
05:08:15,040 --> 05:08:22,400
group ids whereas ID - capital G prints
7879
05:08:18,958 --> 05:08:25,760
all the group IDs. ID - N prints the
7880
05:08:22,400 --> 05:08:29,680
names instead of numbers and ID - R
7881
05:08:25,760 --> 05:08:32,878
prints real IDs instead of numbers. ID -
7882
05:08:29,680 --> 05:08:36,638
U prints only the effective user ID. ID
7883
05:08:32,878 --> 05:08:38,400
- help displays the help messages. ID -
7884
05:08:36,638 --> 05:08:40,878
version displays the version
7885
05:08:38,400 --> 05:08:42,958
information. So without any option it
7886
05:08:40,878 --> 05:08:45,600
prints every set of identified
7887
05:08:42,958 --> 05:08:47,680
information that is the numeric IDs. So
7888
05:08:45,600 --> 05:08:50,798
what you need to do here is simply type
7889
05:08:47,680 --> 05:08:53,600
ID and press enter. So as you can see
7890
05:08:50,798 --> 05:08:56,638
here it displays the UID for this user
7891
05:08:53,600 --> 05:08:58,638
Edureka the group ID and the group that
7892
05:08:56,638 --> 05:09:00,878
he belongs to and the respective group
7893
05:08:58,638 --> 05:09:03,280
ids as well. So say for example if you
7894
05:09:00,878 --> 05:09:08,480
want to know the user ID for this user
7895
05:09:03,280 --> 05:09:10,958
called Edurea ID- u Edurea.
7896
05:09:08,480 --> 05:09:13,840
So 1,00 as you can see here user ID is
7897
05:09:10,958 --> 05:09:15,920
1,00 and group ID is also 1,000. Let me
7898
05:09:13,840 --> 05:09:19,760
just verify this. The command for that
7899
05:09:15,920 --> 05:09:21,520
is idy-g
7900
05:09:19,760 --> 05:09:24,958
okay
7901
05:09:21,520 --> 05:09:27,280
1,00 as you can see here. So to find out
7902
05:09:24,958 --> 05:09:29,280
all the UIDs and the groups associated
7903
05:09:27,280 --> 05:09:33,120
with the user. So say for example
7904
05:09:29,280 --> 05:09:35,440
there's another user called Arvin. So ID
7905
05:09:33,120 --> 05:09:37,520
Arvin.
7906
05:09:35,440 --> 05:09:39,200
So as you can see here the outputs user
7907
05:09:37,520 --> 05:09:41,520
ID group ID and the groups that he
7908
05:09:39,200 --> 05:09:43,440
belongs to. So this was about the ID
7909
05:09:41,520 --> 05:09:44,958
command.
7910
05:09:43,440 --> 05:09:47,440
So the next command that we're going to
7911
05:09:44,958 --> 05:09:49,760
talk about is the tar command. So the
7912
05:09:47,440 --> 05:09:52,878
tar command is used to zip and unzip
7913
05:09:49,760 --> 05:09:55,200
files of the tar format. So let me just
7914
05:09:52,878 --> 05:09:57,200
show you the syntax for this file. So
7915
05:09:55,200 --> 05:10:02,480
say for example if you want to zip a
7916
05:09:57,200 --> 05:10:06,958
folder. So for that the command is tar -
7917
05:10:02,480 --> 05:10:12,040
cvf space file name
7918
05:10:06,958 --> 05:10:12,040
and the folder name source folder name.
7919
05:10:13,280 --> 05:10:18,480
So this was a very easy syntax for the
7920
05:10:15,840 --> 05:10:21,360
tar command and say for example if you
7921
05:10:18,480 --> 05:10:23,760
want to unzip a file. So in DevOps while
7922
05:10:21,360 --> 05:10:27,920
installing something you might be
7923
05:10:23,760 --> 05:10:29,520
getting a file in the tar format while
7924
05:10:27,920 --> 05:10:34,000
unzipping that file you can use this
7925
05:10:29,520 --> 05:10:37,000
command tar - x bf and the tar file
7926
05:10:34,000 --> 05:10:37,000
name.
7927
05:10:37,200 --> 05:10:43,040
So you can use this command to unzip a
7928
05:10:39,600 --> 05:10:44,400
file. So this was about the tar command.
7929
05:10:43,040 --> 05:10:47,120
The next command that we are going to
7930
05:10:44,400 --> 05:10:49,280
talk about is the cut command. So cut
7931
05:10:47,120 --> 05:10:52,320
command is used for extracting a portion
7932
05:10:49,280 --> 05:10:54,160
of a file using columns and delimiters.
7933
05:10:52,320 --> 05:10:56,798
So say for example if you want to list
7934
05:10:54,160 --> 05:10:58,718
everything in a selected column then in
7935
05:10:56,798 --> 05:11:01,200
this case you need to use the hyphen C
7936
05:10:58,718 --> 05:11:05,360
flag with the cut command. So say for
7937
05:11:01,200 --> 05:11:08,920
example let me just see here. So there's
7938
05:11:05,360 --> 05:11:08,920
this file called
7939
05:11:17,200 --> 05:11:20,878
So let me just show you how do you use
7940
05:11:18,958 --> 05:11:23,200
this command. So let us first see what
7941
05:11:20,878 --> 05:11:27,200
are the files present here. So say for
7942
05:11:23,200 --> 05:11:31,520
example this file demo 1
7943
05:11:27,200 --> 05:11:36,000
txt. Okay. Okay. So this file has these
7944
05:11:31,520 --> 05:11:38,560
lines A11 B22 and C3. So say for example
7945
05:11:36,000 --> 05:11:43,200
if you want to display only two columns
7946
05:11:38,560 --> 05:11:45,520
like A1, B2 and C3 from this file. So
7947
05:11:43,200 --> 05:11:47,360
using cut command we can do it. So the
7948
05:11:45,520 --> 05:11:52,958
syntax for doing that is very simple.
7949
05:11:47,360 --> 05:11:57,840
Cut - C1 - 2 space the file name. So the
7950
05:11:52,958 --> 05:11:59,600
file name is demo 1 txt. So hyphen C
7951
05:11:57,840 --> 05:12:02,798
here stands for the column and which
7952
05:11:59,600 --> 05:12:05,280
columns? One and two column. Okay. So
7953
05:12:02,798 --> 05:12:09,760
just press enter. Okay, as you can see
7954
05:12:05,280 --> 05:12:12,400
here, it will display these two columns.
7955
05:12:09,760 --> 05:12:15,520
So, say for example, you want only one
7956
05:12:12,400 --> 05:12:19,760
column and not the two columns. So, just
7957
05:12:15,520 --> 05:12:22,958
remove this two hyphen C1. Press enter.
7958
05:12:19,760 --> 05:12:25,920
So, you you can see here A B C only the
7959
05:12:22,958 --> 05:12:28,240
first column is displayed. Okay. So,
7960
05:12:25,920 --> 05:12:29,600
this was about the cut command. So, the
7961
05:12:28,240 --> 05:12:32,798
next command that we are going to talk
7962
05:12:29,600 --> 05:12:35,040
about is the SE that is set command. So
7963
05:12:32,798 --> 05:12:37,120
zed is a text editor which can perform
7964
05:12:35,040 --> 05:12:39,920
editing operations in a non-interactive
7965
05:12:37,120 --> 05:12:42,000
way. So set command gets its input from
7966
05:12:39,920 --> 05:12:44,638
a standard input or a file to perform
7967
05:12:42,000 --> 05:12:46,718
the editing operations on a file. So set
7968
05:12:44,638 --> 05:12:49,200
is a very powerful utility and you can
7969
05:12:46,718 --> 05:12:51,920
do a lot of file manipulations using
7970
05:12:49,200 --> 05:12:54,240
said. So say for example if you want to
7971
05:12:51,920 --> 05:12:56,560
replace a text in a file by searching it
7972
05:12:54,240 --> 05:12:59,680
in a file you can use the set command
7973
05:12:56,560 --> 05:13:01,600
with the substitute s flag small s to
7974
05:12:59,680 --> 05:13:04,480
search for the specific pattern and
7975
05:13:01,600 --> 05:13:06,480
change it. So say for example let me
7976
05:13:04,480 --> 05:13:10,080
just show you an example here there's
7977
05:13:06,480 --> 05:13:14,160
this file called demo. So set test.
7978
05:13:10,080 --> 05:13:18,638
Okay. So cat let me just see the content
7979
05:13:14,160 --> 05:13:21,120
this file set test
7980
05:13:18,638 --> 05:13:24,400
dot txt.
7981
05:13:21,120 --> 05:13:26,000
Okay. So here it says how are you bubb.
7982
05:13:24,400 --> 05:13:29,200
So say for example I have to replace
7983
05:13:26,000 --> 05:13:33,280
this bubban by any other name. So I can
7984
05:13:29,200 --> 05:13:36,160
use the sed command here. sed space
7985
05:13:33,280 --> 05:13:38,560
single quote s that is the flag that you
7986
05:13:36,160 --> 05:13:41,440
can use with this command. So the word
7987
05:13:38,560 --> 05:13:45,840
that you want to replace and the new
7988
05:13:41,440 --> 05:13:51,520
word chan. Okay. And the name of the
7989
05:13:45,840 --> 05:13:53,520
file obviously s e d t e s txt.
7990
05:13:51,520 --> 05:13:55,840
So as you can see here first it was how
7991
05:13:53,520 --> 05:13:59,920
are you babban and now it is how are you
7992
05:13:55,840 --> 05:14:01,680
chugan. So this was the command sed. I
7993
05:13:59,920 --> 05:14:04,240
hope you have understood this command.
7994
05:14:01,680 --> 05:14:05,680
Let me just clear the terminal. Okay. So
7995
05:14:04,240 --> 05:14:08,480
the next command that we are going to
7996
05:14:05,680 --> 05:14:10,320
talk about is the unique command. So
7997
05:14:08,480 --> 05:14:13,680
unique command is used for filtering out
7998
05:14:10,320 --> 05:14:15,600
the duplicate lines in a files. So the
7999
05:14:13,680 --> 05:14:17,680
syntax for this command is pretty much
8000
05:14:15,600 --> 05:14:20,718
simple. So say for example you have to
8001
05:14:17,680 --> 05:14:22,798
remove all the duplicate lines from a
8002
05:14:20,718 --> 05:14:26,718
file. So you can use this command unique
8003
05:14:22,798 --> 05:14:29,680
and the file name.
8004
05:14:26,718 --> 05:14:30,958
So this was a very easy command. The
8005
05:14:29,680 --> 05:14:33,440
next command that we are going to talk
8006
05:14:30,958 --> 05:14:35,840
about is the watch command. So watch
8007
05:14:33,440 --> 05:14:38,320
command in Linux is used to execute a
8008
05:14:35,840 --> 05:14:40,798
program periodically showing output in
8009
05:14:38,320 --> 05:14:42,878
full screen. This command will run a
8010
05:14:40,798 --> 05:14:45,360
specified command in the argument
8011
05:14:42,878 --> 05:14:47,760
repeatedly by showing its outputs and
8012
05:14:45,360 --> 05:14:50,320
errors. By default, the specified
8013
05:14:47,760 --> 05:14:53,840
command will run every 2 seconds and
8014
05:14:50,320 --> 05:14:56,240
watch will run until interrupted. So the
8015
05:14:53,840 --> 05:15:00,480
syntax for this command is very simple.
8016
05:14:56,240 --> 05:15:03,280
You just have to type watch the flag and
8017
05:15:00,480 --> 05:15:05,200
the command.
8018
05:15:03,280 --> 05:15:08,000
Let me just show you an example using
8019
05:15:05,200 --> 05:15:10,560
this. So there's this flag called hyphen
8020
05:15:08,000 --> 05:15:12,718
d that you can use with watch. So this
8021
05:15:10,560 --> 05:15:14,638
parameter hyphen d highlights the
8022
05:15:12,718 --> 05:15:17,040
differences between the successive
8023
05:15:14,638 --> 05:15:19,120
updates. The options will read the
8024
05:15:17,040 --> 05:15:21,120
optional arguments which changes the
8025
05:15:19,120 --> 05:15:23,200
highlight to be permanent and this
8026
05:15:21,120 --> 05:15:26,080
allows the user to see what has changed
8027
05:15:23,200 --> 05:15:28,718
at least once since the first iteration.
8028
05:15:26,080 --> 05:15:30,958
So let me just type hyphen d watch
8029
05:15:28,718 --> 05:15:33,958
hyphen d free
8030
05:15:30,958 --> 05:15:33,958
m
8031
05:15:34,240 --> 05:15:38,560
free command we have used we'll see what
8032
05:15:36,638 --> 05:15:41,120
free command is in the later part of
8033
05:15:38,560 --> 05:15:42,878
this session. So the next command that
8034
05:15:41,120 --> 05:15:45,360
we're going to talk about is the eval
8035
05:15:42,878 --> 05:15:47,120
command. So, eval is a built-in Linux
8036
05:15:45,360 --> 05:15:49,520
command which is used to execute
8037
05:15:47,120 --> 05:15:51,600
arguments as a shell command. So, it
8038
05:15:49,520 --> 05:15:54,080
combines arguments into a single string
8039
05:15:51,600 --> 05:15:56,958
and uses it as an input to the shell and
8040
05:15:54,080 --> 05:15:59,760
execute commands. So, the syntax for
8041
05:15:56,958 --> 05:16:03,200
this command is very simple. Eval and
8042
05:15:59,760 --> 05:16:06,160
the arguments. So, let me just show you
8043
05:16:03,200 --> 05:16:11,120
an example of eval command here. So say
8044
05:16:06,160 --> 05:16:15,280
for example you have to type eval -
8045
05:16:11,120 --> 05:16:17,360
help eval help. This command shows the
8046
05:16:15,280 --> 05:16:19,600
description of the eval command itself.
8047
05:16:17,360 --> 05:16:22,160
So as you can see here. So let me just
8048
05:16:19,600 --> 05:16:23,680
clear the terminal. So the next command
8049
05:16:22,160 --> 05:16:26,240
that we are going to talk about is the
8050
05:16:23,680 --> 05:16:28,480
history command. History command is used
8051
05:16:26,240 --> 05:16:31,040
to view the previously executed
8052
05:16:28,480 --> 05:16:34,160
commands. This feature was not available
8053
05:16:31,040 --> 05:16:35,760
in the bond shell. Bash and con shell
8054
05:16:34,160 --> 05:16:38,400
support this feature in which every
8055
05:16:35,760 --> 05:16:40,798
command is executed and is treated as
8056
05:16:38,400 --> 05:16:42,798
the event and is associated with an
8057
05:16:40,798 --> 05:16:44,798
event number using which they can be
8058
05:16:42,798 --> 05:16:47,040
recalled and changed if there's a
8059
05:16:44,798 --> 05:16:50,240
requirement to do so. So these commands
8060
05:16:47,040 --> 05:16:51,920
are saved in a history file. So in bash
8061
05:16:50,240 --> 05:16:54,798
shell history command shows the whole
8062
05:16:51,920 --> 05:16:59,200
list of commands. So say for example
8063
05:16:54,798 --> 05:17:01,360
just type history here press enter. So
8064
05:16:59,200 --> 05:17:05,680
this is the list of commands I've used
8065
05:17:01,360 --> 05:17:08,560
till now. 400 500 plus commands I guess.
8066
05:17:05,680 --> 05:17:10,878
Yeah 584 commands I've used. So say for
8067
05:17:08,560 --> 05:17:13,680
example if you want to see only last
8068
05:17:10,878 --> 05:17:16,798
five commands that I've used. History
8069
05:17:13,680 --> 05:17:19,120
space 5. Press enter. So these are the
8070
05:17:16,798 --> 05:17:21,520
last five commands that you have used.
8071
05:17:19,120 --> 05:17:24,160
Can can see here.
8072
05:17:21,520 --> 05:17:25,520
Let me just clear the terminal. Okay. So
8073
05:17:24,160 --> 05:17:29,040
the next command that we are going to
8074
05:17:25,520 --> 05:17:31,440
talk about is the dd command. So DD is a
8075
05:17:29,040 --> 05:17:33,520
command line utility for Unix and Unix
8076
05:17:31,440 --> 05:17:35,920
like OS whose primary purpose is to
8077
05:17:33,520 --> 05:17:38,560
convert and copy files. The command line
8078
05:17:35,920 --> 05:17:41,840
syntax of DD differs from many other
8079
05:17:38,560 --> 05:17:44,560
Unix programs in that it uses the syntax
8080
05:17:41,840 --> 05:17:46,638
option
8081
05:17:44,560 --> 05:17:48,958
equal to
8082
05:17:46,638 --> 05:17:51,760
value.
8083
05:17:48,958 --> 05:17:54,240
So this syntax option equal to value is
8084
05:17:51,760 --> 05:17:56,320
used for its command line operations. So
8085
05:17:54,240 --> 05:17:58,638
I'll show you just a practical example
8086
05:17:56,320 --> 05:18:01,120
of this command. So say for example you
8087
05:17:58,638 --> 05:18:03,440
have to back up the entire hard disk. So
8088
05:18:01,120 --> 05:18:05,440
to back up an entire copy of a hard disk
8089
05:18:03,440 --> 05:18:07,840
to another hard disk connected to the
8090
05:18:05,440 --> 05:18:10,240
same system. So this command dd can be
8091
05:18:07,840 --> 05:18:12,080
used. In this command the unit's device
8092
05:18:10,240 --> 05:18:15,280
name of the source hard disk is say for
8093
05:18:12,080 --> 05:18:18,798
example the source hard disk name is dev
8094
05:18:15,280 --> 05:18:20,480
hda and the target hard disk name is dev
8095
05:18:18,798 --> 05:18:24,080
hdb.
8096
05:18:20,480 --> 05:18:27,280
So how do you use this command? DD d
8097
05:18:24,080 --> 05:18:30,160
space if I if stands for input file
8098
05:18:27,280 --> 05:18:34,718
space the name of the source or disk. So
8099
05:18:30,160 --> 05:18:38,320
it is dev space hda
8100
05:18:34,718 --> 05:18:40,718
and I just forgot to place equal to sign
8101
05:18:38,320 --> 05:18:42,878
here as discussed earlier it has a
8102
05:18:40,718 --> 05:18:45,360
syntax of option equal to value. So
8103
05:18:42,878 --> 05:18:48,718
input file is this the source file and
8104
05:18:45,360 --> 05:18:51,280
the output file of is
8105
05:18:48,718 --> 05:18:52,958
dev/
8106
05:18:51,280 --> 05:18:54,560
hdb.
8107
05:18:52,958 --> 05:18:56,638
So as of now we are not copying
8108
05:18:54,560 --> 05:18:59,120
anything. So but I'm just showing you
8109
05:18:56,638 --> 05:19:01,280
how to use this command. So input file
8110
05:18:59,120 --> 05:19:03,520
and output file should be mentioned very
8111
05:19:01,280 --> 05:19:05,440
carefully just in case you mention
8112
05:19:03,520 --> 05:19:08,400
source device in the target and the vice
8113
05:19:05,440 --> 05:19:10,718
versa you might lose all the data. I
8114
05:19:08,400 --> 05:19:12,240
hope you have understood this command.
8115
05:19:10,718 --> 05:19:14,480
Okay. So there's one more command that
8116
05:19:12,240 --> 05:19:16,798
we talked about like the free command.
8117
05:19:14,480 --> 05:19:19,120
Okay. So the free command displays the
8118
05:19:16,798 --> 05:19:21,360
total amount of free space available
8119
05:19:19,120 --> 05:19:23,680
along with the amount of memory used and
8120
05:19:21,360 --> 05:19:26,240
swap memory in the system and also the
8121
05:19:23,680 --> 05:19:28,400
buffers used by the kernel. The syntax
8122
05:19:26,240 --> 05:19:32,400
for this command is very simple. Free
8123
05:19:28,400 --> 05:19:34,638
space or options you can see. So let me
8124
05:19:32,400 --> 05:19:37,120
just type free command here and press
8125
05:19:34,638 --> 05:19:39,280
enter. So as you can see here total
8126
05:19:37,120 --> 05:19:42,718
installed memory that is present on the
8127
05:19:39,280 --> 05:19:45,920
system. So used means the used memory
8128
05:19:42,718 --> 05:19:48,000
and free means the unused memory. Shared
8129
05:19:45,920 --> 05:19:50,878
displays the memory used by the temp
8130
05:19:48,000 --> 05:19:53,760
folders. Buffer displays the memory used
8131
05:19:50,878 --> 05:19:55,680
by the kernel buffers. And cached
8132
05:19:53,760 --> 05:19:59,200
displays the memory used by the page
8133
05:19:55,680 --> 05:20:01,120
cache and the slabs. And buffers/cache
8134
05:19:59,200 --> 05:20:04,080
displays the sum of the buffers and the
8135
05:20:01,120 --> 05:20:05,520
cache. And there are a few flags or
8136
05:20:04,080 --> 05:20:08,560
options that you can use with this
8137
05:20:05,520 --> 05:20:11,200
command that is hyphen B. The command is
8138
05:20:08,560 --> 05:20:14,320
free-b. So it displays the memory in
8139
05:20:11,200 --> 05:20:16,718
bytes. If you use hyphen k this displays
8140
05:20:14,320 --> 05:20:19,200
the amount of memory in kilobytes which
8141
05:20:16,718 --> 05:20:22,240
is by default hyphen m displays the
8142
05:20:19,200 --> 05:20:24,878
amount of memory in megabytes and hyphen
8143
05:20:22,240 --> 05:20:27,520
g small g displays the amount of memory
8144
05:20:24,878 --> 05:20:30,480
in gabytes. I hope you have understood
8145
05:20:27,520 --> 05:20:32,878
this command free. So let me just clear
8146
05:20:30,480 --> 05:20:34,878
the terminal. Okay. So the next command
8147
05:20:32,878 --> 05:20:37,280
that we are going to talk about is the
8148
05:20:34,878 --> 05:20:38,958
SSH command. So while working in DevOps
8149
05:20:37,280 --> 05:20:43,360
you might frequently use this command.
8150
05:20:38,958 --> 05:20:45,920
the SSH command. So SSH means that
8151
05:20:43,360 --> 05:20:47,600
secure shell. Okay. So this command
8152
05:20:45,920 --> 05:20:50,320
refers to a cryptographic network
8153
05:20:47,600 --> 05:20:52,878
protocol for operating network services
8154
05:20:50,320 --> 05:20:55,440
securely over an unsecured network.
8155
05:20:52,878 --> 05:20:57,680
Typical use cases include remote command
8156
05:20:55,440 --> 05:21:00,878
line execution. But any network service
8157
05:20:57,680 --> 05:21:03,360
can be secured with the command ssh.
8158
05:21:00,878 --> 05:21:06,480
So say for example if you have a master
8159
05:21:03,360 --> 05:21:08,480
node and the slave node. So if you are
8160
05:21:06,480 --> 05:21:10,480
running this command, the command that
8161
05:21:08,480 --> 05:21:12,638
I'm going to type now on the slave node,
8162
05:21:10,480 --> 05:21:14,958
this will give you access to the master
8163
05:21:12,638 --> 05:21:21,200
node. So the command for that is very
8164
05:21:14,958 --> 05:21:23,440
simple. SSH and the master's IP address.
8165
05:21:21,200 --> 05:21:26,000
So if you run this command on the slave
8166
05:21:23,440 --> 05:21:28,798
machine, it you can get access to the
8167
05:21:26,000 --> 05:21:30,638
master machine. And vice versa, if you
8168
05:21:28,798 --> 05:21:33,760
execute this command on the master
8169
05:21:30,638 --> 05:21:36,480
machine along with the slave IP, you can
8170
05:21:33,760 --> 05:21:38,718
get access to the slave machine. So
8171
05:21:36,480 --> 05:21:41,718
there's one more command called SSH key
8172
05:21:38,718 --> 05:21:41,718
gen.
8173
05:21:42,160 --> 05:21:47,280
So this command is used to generate a
8174
05:21:44,560 --> 05:21:49,920
public private authentication key pair.
8175
05:21:47,280 --> 05:21:51,920
So authentication keys allows a user to
8176
05:21:49,920 --> 05:21:54,718
connect to a remote system without
8177
05:21:51,920 --> 05:21:57,520
supplying the password. So keys must be
8178
05:21:54,718 --> 05:21:59,440
generated for each user separately. So
8179
05:21:57,520 --> 05:22:02,000
if you generate key pairs as the root
8180
05:21:59,440 --> 05:22:05,200
user only the root user can use those
8181
05:22:02,000 --> 05:22:07,520
key. So the syntax for creating pair of
8182
05:22:05,200 --> 05:22:13,040
keys is very simple. So you need to type
8183
05:22:07,520 --> 05:22:14,560
sshen key gen space- t and rsa. Press
8184
05:22:13,040 --> 05:22:17,120
enter.
8185
05:22:14,560 --> 05:22:20,240
Here you can press enter. It says it
8186
05:22:17,120 --> 05:22:23,280
already exists. So I want it to
8187
05:22:20,240 --> 05:22:26,638
overwrite. Press enter. Enter past
8188
05:22:23,280 --> 05:22:30,560
phrase empty for no passphrase. Enter
8189
05:22:26,638 --> 05:22:33,280
passphrase. Press enter. Press enter.
8190
05:22:30,560 --> 05:22:36,000
Okay. So the key has been generated. As
8191
05:22:33,280 --> 05:22:38,240
you can see here, hyphen t option here
8192
05:22:36,000 --> 05:22:40,958
is used to specify the type of key that
8193
05:22:38,240 --> 05:22:43,200
you have to create. So you have the
8194
05:22:40,958 --> 05:22:46,000
option of specifying the passphrase to
8195
05:22:43,200 --> 05:22:47,920
encrypt the private part of the key. So
8196
05:22:46,000 --> 05:22:50,320
if you encrypt your personal key, you
8197
05:22:47,920 --> 05:22:52,638
must supply the passphrase each time you
8198
05:22:50,320 --> 05:22:54,560
use this key. So in this case we have
8199
05:22:52,638 --> 05:22:56,958
just pressed enter. We haven't passed
8200
05:22:54,560 --> 05:22:58,958
anything in the passphrase. So this
8201
05:22:56,958 --> 05:23:01,840
prevents an attacker who has access to
8202
05:22:58,958 --> 05:23:03,840
your private key and can impersonate you
8203
05:23:01,840 --> 05:23:07,600
and access all the computers you have
8204
05:23:03,840 --> 05:23:10,718
access to from being able to do so. So
8205
05:23:07,600 --> 05:23:13,600
this was about the command SSH key. Let
8206
05:23:10,718 --> 05:23:15,120
me just clear the terminal.
8207
05:23:13,600 --> 05:23:17,840
So the next command that we are going to
8208
05:23:15,120 --> 05:23:20,160
talk about is the IP command. So the IP
8209
05:23:17,840 --> 05:23:21,760
command in Linux is present in the net
8210
05:23:20,160 --> 05:23:24,638
tools which is used for performing
8211
05:23:21,760 --> 05:23:27,200
several network administration tasks. IP
8212
05:23:24,638 --> 05:23:28,638
simply stands for internet protocol. So
8213
05:23:27,200 --> 05:23:30,798
this command is used to show
8214
05:23:28,638 --> 05:23:33,360
manipulative routing devices and
8215
05:23:30,798 --> 05:23:35,520
tunnels. It is similar to the if config
8216
05:23:33,360 --> 05:23:37,440
command. Okay. The next command that we
8217
05:23:35,520 --> 05:23:40,320
are going to discuss is the if config
8218
05:23:37,440 --> 05:23:42,000
command. So if config that is interface
8219
05:23:40,320 --> 05:23:44,480
configuration command is used to
8220
05:23:42,000 --> 05:23:47,360
configure the kernel resident network
8221
05:23:44,480 --> 05:23:50,480
interfaces. It is used at the boot time
8222
05:23:47,360 --> 05:23:52,798
to set up interfaces as necessary. After
8223
05:23:50,480 --> 05:23:54,798
that, it is usually used when needed
8224
05:23:52,798 --> 05:23:57,360
during debugging or when you need a
8225
05:23:54,798 --> 05:24:00,000
system tuning. Also, this command is
8226
05:23:57,360 --> 05:24:02,320
used to assign IP addresses and net mask
8227
05:24:00,000 --> 05:24:04,798
to an interface or to enable or disable
8228
05:24:02,320 --> 05:24:07,680
a given interface. So, the syntax for
8229
05:24:04,798 --> 05:24:09,840
this command is very simple. If config
8230
05:24:07,680 --> 05:24:13,600
space options
8231
05:24:09,840 --> 05:24:15,280
or and space the interface.
8232
05:24:13,600 --> 05:24:18,718
So there are two options that you can
8233
05:24:15,280 --> 05:24:21,760
use with this command that is ifconfig -
8234
05:24:18,718 --> 05:24:23,840
a. So this option is used to display all
8235
05:24:21,760 --> 05:24:27,280
the interfaces available even if they
8236
05:24:23,840 --> 05:24:31,280
are down. So if you use this command if
8237
05:24:27,280 --> 05:24:33,920
config a. Okay. So you can see all the
8238
05:24:31,280 --> 05:24:37,360
interfaces that are available.
8239
05:24:33,920 --> 05:24:40,560
Okay. Yeah. And there's one more command
8240
05:24:37,360 --> 05:24:42,878
called hyphen s. So if you type if
8241
05:24:40,560 --> 05:24:45,680
config
8242
05:24:42,878 --> 05:24:48,400
- s so this displays a short list
8243
05:24:45,680 --> 05:24:51,360
instead of all the details.
8244
05:24:48,400 --> 05:24:54,080
So this was about the if config command.
8245
05:24:51,360 --> 05:24:55,840
So let me just clear the terminal. Also
8246
05:24:54,080 --> 05:24:58,718
if you want to know the IP address of
8247
05:24:55,840 --> 05:25:03,200
your machine you simply need to type if
8248
05:24:58,718 --> 05:25:06,160
config press enter. Okay.
8249
05:25:03,200 --> 05:25:08,718
As you can see here this is the IP
8250
05:25:06,160 --> 05:25:10,400
address of your machine. So to know the
8251
05:25:08,718 --> 05:25:14,080
IP address of your machine, you just
8252
05:25:10,400 --> 05:25:18,000
need to use this command if config. So
8253
05:25:14,080 --> 05:25:19,520
let me just clear the terminal.
8254
05:25:18,000 --> 05:25:21,840
The next command that we are going to
8255
05:25:19,520 --> 05:25:23,920
talk about is the IP command. So IP
8256
05:25:21,840 --> 05:25:25,920
command in Linux is present in the net
8257
05:25:23,920 --> 05:25:29,040
tools which is used for performing
8258
05:25:25,920 --> 05:25:31,680
several network administration tasks. So
8259
05:25:29,040 --> 05:25:33,760
IP stands for internet protocol. This
8260
05:25:31,680 --> 05:25:36,560
command is used to show or manipulate
8261
05:25:33,760 --> 05:25:38,798
routing devices and tunnels. It is
8262
05:25:36,560 --> 05:25:40,638
similar to the ifconfig command but it
8263
05:25:38,798 --> 05:25:43,680
is much more powerful and more functions
8264
05:25:40,638 --> 05:25:45,920
and facilities attached to it. If config
8265
05:25:43,680 --> 05:25:48,160
is one of the deprecated commands in the
8266
05:25:45,920 --> 05:25:50,718
net tools of Linux that has not been
8267
05:25:48,160 --> 05:25:52,798
maintained for many years. IP command is
8268
05:25:50,718 --> 05:25:54,400
used to perform several tasks like
8269
05:25:52,798 --> 05:25:56,560
assigning an address to a network
8270
05:25:54,400 --> 05:25:59,280
interface or configuring network
8271
05:25:56,560 --> 05:26:01,520
interface parameters and so on. So it
8272
05:25:59,280 --> 05:26:03,840
can perform several other tasks like
8273
05:26:01,520 --> 05:26:06,560
configuring and modifying the default
8274
05:26:03,840 --> 05:26:09,600
and static routing, setting up a tunnel
8275
05:26:06,560 --> 05:26:12,000
over an IP, listing IP addresses and
8276
05:26:09,600 --> 05:26:14,000
property information, modifying the
8277
05:26:12,000 --> 05:26:16,878
status of the interface, assigning,
8278
05:26:14,000 --> 05:26:19,440
deleting and setting up IP addresses and
8279
05:26:16,878 --> 05:26:23,600
routes. So let me just show you a
8280
05:26:19,440 --> 05:26:25,520
practical example of IP
8281
05:26:23,600 --> 05:26:28,080
space
8282
05:26:25,520 --> 05:26:30,080
address.
8283
05:26:28,080 --> 05:26:32,240
Okay.
8284
05:26:30,080 --> 05:26:34,798
So this command is used to show all the
8285
05:26:32,240 --> 05:26:37,840
IP addresses associated on all network
8286
05:26:34,798 --> 05:26:39,760
devices. So as you can see here, these
8287
05:26:37,840 --> 05:26:42,480
are the various network devices and
8288
05:26:39,760 --> 05:26:44,718
their IP addresses. Yeah. So there's one
8289
05:26:42,480 --> 05:26:47,760
more command called
8290
05:26:44,718 --> 05:26:50,320
IP space link.
8291
05:26:47,760 --> 05:26:52,560
So this command is used to display link
8292
05:26:50,320 --> 05:26:54,160
layer information. It will fetch
8293
05:26:52,560 --> 05:26:56,560
characteristics of the link layer
8294
05:26:54,160 --> 05:26:58,560
devices currently available. Any
8295
05:26:56,560 --> 05:27:00,718
networking device which has a driver
8296
05:26:58,560 --> 05:27:05,760
loaded can be classified as an available
8297
05:27:00,718 --> 05:27:07,760
device. So IP- link press enter. Okay.
8298
05:27:05,760 --> 05:27:09,920
So this is the output. These are the
8299
05:27:07,760 --> 05:27:12,320
available devices and the link layer
8300
05:27:09,920 --> 05:27:14,878
information as you can see here. So let
8301
05:27:12,320 --> 05:27:16,240
me just clear the terminal. So the next
8302
05:27:14,878 --> 05:27:19,200
command that we're going to talk about
8303
05:27:16,240 --> 05:27:21,440
is the net stat command. So net stat
8304
05:27:19,200 --> 05:27:23,840
command displays various network related
8305
05:27:21,440 --> 05:27:26,958
information such as network connections,
8306
05:27:23,840 --> 05:27:29,360
routing tables, interface statistics,
8307
05:27:26,958 --> 05:27:31,360
multiccast memberships and so on. So the
8308
05:27:29,360 --> 05:27:34,320
syntax for this is very simple. For
8309
05:27:31,360 --> 05:27:36,878
example, netstat
8310
05:27:34,320 --> 05:27:40,480
net start
8311
05:27:36,878 --> 05:27:42,160
and hyphen a.
8312
05:27:40,480 --> 05:27:45,920
So as you can see here if you use this
8313
05:27:42,160 --> 05:27:48,160
command net a. So it is used to show
8314
05:27:45,920 --> 05:27:50,558
both the listening and the non-listing
8315
05:27:48,160 --> 05:27:52,160
ports that are available. So this
8316
05:27:50,558 --> 05:27:53,920
command is used to show both the
8317
05:27:52,160 --> 05:27:56,240
listening as well as the non-listing
8318
05:27:53,920 --> 05:27:59,878
sockets. And there's one more command
8319
05:27:56,240 --> 05:27:59,878
called net start-
8320
05:28:00,240 --> 05:28:04,080
a.
8321
05:28:01,760 --> 05:28:06,638
So this command will list all the TCP
8322
05:28:04,080 --> 05:28:10,798
ports that are available. So as you can
8323
05:28:06,638 --> 05:28:13,840
see here, these are the TCP ports. So
8324
05:28:10,798 --> 05:28:15,920
this was about the net start commands.
8325
05:28:13,840 --> 05:28:18,558
So the next command is the NS lookup
8326
05:28:15,920 --> 05:28:21,120
command. So NS lookup stands for name
8327
05:28:18,558 --> 05:28:23,120
server lookup. This is a useful command
8328
05:28:21,120 --> 05:28:25,600
for getting information from the DNS
8329
05:28:23,120 --> 05:28:28,000
server. It is a network administration
8330
05:28:25,600 --> 05:28:30,718
tool for quering the domain name system
8331
05:28:28,000 --> 05:28:32,798
to obtain domain name or IP addresses,
8332
05:28:30,718 --> 05:28:35,600
mapping or any other specific DNS
8333
05:28:32,798 --> 05:28:38,400
record. It is also used to troubleshoot
8334
05:28:35,600 --> 05:28:40,798
DNS related problems. So the syntax for
8335
05:28:38,400 --> 05:28:42,480
this is very simple. Simply type ns
8336
05:28:40,798 --> 05:28:45,840
lookup
8337
05:28:42,480 --> 05:28:48,240
and the option.
8338
05:28:45,840 --> 05:28:52,200
Let me just type nsookup. Say for
8339
05:28:48,240 --> 05:28:52,200
example google.com.
8340
05:28:54,000 --> 05:28:58,400
So it is giving you the details of this
8341
05:28:56,320 --> 05:29:01,680
domain google.com the server the
8342
05:28:58,400 --> 05:29:04,320
address. So if we type this command like
8343
05:29:01,680 --> 05:29:06,080
ns and the domain name. So this will
8344
05:29:04,320 --> 05:29:08,400
display a record that is IP address of
8345
05:29:06,080 --> 05:29:10,240
the domain as you can see here. So this
8346
05:29:08,400 --> 05:29:13,120
command queries the domain name servers
8347
05:29:10,240 --> 05:29:15,680
to get all these details. So this was
8348
05:29:13,120 --> 05:29:17,920
about the NS lookup command. Let me just
8349
05:29:15,680 --> 05:29:19,600
clear the terminal. So the next command
8350
05:29:17,920 --> 05:29:23,040
that we are going to talk about is the C
8351
05:29:19,600 --> 05:29:25,360
URL or curl command as you can see. So
8352
05:29:23,040 --> 05:29:28,240
curl is a command line tool to transfer
8353
05:29:25,360 --> 05:29:30,878
data to or from a server using any of
8354
05:29:28,240 --> 05:29:35,520
the supported protocols such as HTTP,
8355
05:29:30,878 --> 05:29:38,080
FTP, SCP, SMTP and so on. So curl is
8356
05:29:35,520 --> 05:29:40,160
powered by a lip curl. So this tool is
8357
05:29:38,080 --> 05:29:41,920
preferred for automation since it is
8358
05:29:40,160 --> 05:29:44,400
designed to work without any user
8359
05:29:41,920 --> 05:29:47,680
interaction. So curl can be used to
8360
05:29:44,400 --> 05:29:50,000
transfer multiple files at once. So the
8361
05:29:47,680 --> 05:29:54,080
syntax for this command is very simple.
8362
05:29:50,000 --> 05:29:55,920
Curl hyphen space I repeat curl space
8363
05:29:54,080 --> 05:29:58,958
options
8364
05:29:55,920 --> 05:30:01,520
and the URL.
8365
05:29:58,958 --> 05:30:04,480
So there's one parameter or the option
8366
05:30:01,520 --> 05:30:06,718
that you can use with this is hypheno.
8367
05:30:04,480 --> 05:30:08,878
So this parameter saves the downloaded
8368
05:30:06,718 --> 05:30:12,000
file on the local machine with the name
8369
05:30:08,878 --> 05:30:15,920
provided in the parameters. So this was
8370
05:30:12,000 --> 05:30:17,440
about the curl or the curl command.
8371
05:30:15,920 --> 05:30:21,040
So the next command that we are going to
8372
05:30:17,440 --> 05:30:22,718
talk about is the AWK command. So AWK is
8373
05:30:21,040 --> 05:30:24,558
a scripting language used for
8374
05:30:22,718 --> 05:30:27,360
manipulating data and generating
8375
05:30:24,558 --> 05:30:29,440
reports. The AWK command programming
8376
05:30:27,360 --> 05:30:31,600
language requires no compiling and
8377
05:30:29,440 --> 05:30:33,920
allows the user to use variables,
8378
05:30:31,600 --> 05:30:37,440
numeric functions, string functions and
8379
05:30:33,920 --> 05:30:39,200
logical operators. So, AWK is
8380
05:30:37,440 --> 05:30:42,638
abbreviated from the names of the
8381
05:30:39,200 --> 05:30:46,480
developers that is AHO, Venberger and
8382
05:30:42,638 --> 05:30:48,400
the Kigan. So, the syntax is pretty much
8383
05:30:46,480 --> 05:30:50,400
simple. I'll show you how do you use it.
8384
05:30:48,400 --> 05:30:55,600
So, say for example, let me see the list
8385
05:30:50,400 --> 05:30:58,320
of files that we have. Okay. So, C abc
8386
05:30:55,600 --> 05:31:03,920
txt. So, let us just see the contents of
8387
05:30:58,320 --> 05:31:07,600
this file. A bc txt. Uh let's just see
8388
05:31:03,920 --> 05:31:10,600
another file. demo demo1.txt.
8389
05:31:07,600 --> 05:31:10,600
Okay.
8390
05:31:10,718 --> 05:31:13,718
Demo1.txt.
8391
05:32:04,320 --> 05:32:08,558
Okay. So I'll just show you how do you
8392
05:32:06,638 --> 05:32:10,718
use this command. So say for example you
8393
05:32:08,558 --> 05:32:12,480
want to print every line from a
8394
05:32:10,718 --> 05:32:18,200
specified file. So we can use this
8395
05:32:12,480 --> 05:32:18,200
command AWK single code curly braces.
8396
05:32:19,680 --> 05:32:26,200
Okay. And the name of the file. So say
8397
05:32:21,760 --> 05:32:26,200
for example AWK test.
8398
05:32:27,280 --> 05:32:32,638
Okay. So this was the file. This has
8399
05:32:29,360 --> 05:32:35,360
only two lines. Okay. So if you want to
8400
05:32:32,638 --> 05:32:37,520
print every line from a file so you can
8401
05:32:35,360 --> 05:32:40,160
use this command AWK.
8402
05:32:37,520 --> 05:32:42,718
So say for example I'm looking for a
8403
05:32:40,160 --> 05:32:46,160
specific pattern in a file. So say for
8404
05:32:42,718 --> 05:32:49,040
example AWK
8405
05:32:46,160 --> 05:32:51,280
I'm looking for the word. Okay. So let's
8406
05:32:49,040 --> 05:32:54,718
consider this file itself in single
8407
05:32:51,280 --> 05:32:58,280
quotes. I'm looking for RAM and I want
8408
05:32:54,718 --> 05:32:58,280
to print it
8409
05:32:59,040 --> 05:33:07,280
and the file name awk test dot txt. So
8410
05:33:05,040 --> 05:33:09,680
it will print any of the lines that has
8411
05:33:07,280 --> 05:33:11,920
this word ram.
8412
05:33:09,680 --> 05:33:13,680
Press enter. Okay. So these two lines
8413
05:33:11,920 --> 05:33:16,160
have this word ram. So it has printed
8414
05:33:13,680 --> 05:33:18,638
both these lines. So this was another
8415
05:33:16,160 --> 05:33:20,080
use of awk.
8416
05:33:18,638 --> 05:33:23,120
So the next command that we are going to
8417
05:33:20,080 --> 05:33:25,440
talk about is the tr command. So tr
8418
05:33:23,120 --> 05:33:27,520
stands for translate. So this command in
8419
05:33:25,440 --> 05:33:30,400
Unix is a command line utility for
8420
05:33:27,520 --> 05:33:32,480
translating and deleting characters. It
8421
05:33:30,400 --> 05:33:34,718
supports a range of transformations
8422
05:33:32,480 --> 05:33:37,120
including uppercase to lower case
8423
05:33:34,718 --> 05:33:39,920
squeezing repeating characters, deleting
8424
05:33:37,120 --> 05:33:43,520
specific characters and basic find and
8425
05:33:39,920 --> 05:33:46,718
replace. It can be used with Unix pipes
8426
05:33:43,520 --> 05:33:48,798
to support more complex translations.
8427
05:33:46,718 --> 05:33:52,160
Okay. So I'll just show you an example
8428
05:33:48,798 --> 05:33:57,040
of the TR command. So say for example
8429
05:33:52,160 --> 05:34:01,638
this file called AWK test. Okay. So let
8430
05:33:57,040 --> 05:34:01,638
us just see the contents of this file.
8431
05:34:02,878 --> 05:34:08,718
Now we'll try some other file
8432
05:34:05,520 --> 05:34:11,040
CBA. TXT.
8433
05:34:08,718 --> 05:34:12,958
Okay. So let us just say we want to
8434
05:34:11,040 --> 05:34:14,878
convert this into uppercase everything
8435
05:34:12,958 --> 05:34:17,280
into uppercase.
8436
05:34:14,878 --> 05:34:20,080
Here we want to display this. Hi, this
8437
05:34:17,280 --> 05:34:22,400
is Edureka in upper case. So for that we
8438
05:34:20,080 --> 05:34:25,280
will use the command CAD the file name
8439
05:34:22,400 --> 05:34:28,080
CBA
8440
05:34:25,280 --> 05:34:30,718
dot txt
8441
05:34:28,080 --> 05:34:36,000
and the pipe symbol
8442
05:34:30,718 --> 05:34:38,718
TR space double quotes
8443
05:34:36,000 --> 05:34:41,200
A2 Z
8444
05:34:38,718 --> 05:34:44,878
space and the
8445
05:34:41,200 --> 05:34:47,680
capital A2 Z.
8446
05:34:44,878 --> 05:34:50,000
Okay. So this is the syntax for doing
8447
05:34:47,680 --> 05:34:52,320
this.
8448
05:34:50,000 --> 05:34:53,920
Press enter. As you can see here,
8449
05:34:52,320 --> 05:34:56,240
everything has been converted to
8450
05:34:53,920 --> 05:34:58,798
uppercase. So this is one of the usage
8451
05:34:56,240 --> 05:35:01,920
of the TR command.
8452
05:34:58,798 --> 05:35:03,280
So let me just clear the terminal.
8453
05:35:01,920 --> 05:35:06,160
The next command that we are going to
8454
05:35:03,280 --> 05:35:08,400
talk about is the env command.
8455
05:35:06,160 --> 05:35:11,120
ENV command is used to print environment
8456
05:35:08,400 --> 05:35:13,360
variables. It is also used to run a
8457
05:35:11,120 --> 05:35:16,160
utility or a command in a custom
8458
05:35:13,360 --> 05:35:18,480
environment. In practice, ENV command
8459
05:35:16,160 --> 05:35:20,240
has another common use. It is often used
8460
05:35:18,480 --> 05:35:21,840
by shell scripts to launch a correct
8461
05:35:20,240 --> 05:35:23,680
interpreter.
8462
05:35:21,840 --> 05:35:26,080
In this usage, the environment is
8463
05:35:23,680 --> 05:35:27,840
typically not changed. So, say for
8464
05:35:26,080 --> 05:35:29,440
example, I have to see a list of all the
8465
05:35:27,840 --> 05:35:33,280
environment variables that are present
8466
05:35:29,440 --> 05:35:35,440
on my system. So, I'll simply type env.
8467
05:35:33,280 --> 05:35:38,080
Okay. So, these are the list of
8468
05:35:35,440 --> 05:35:39,600
environment variables that are present.
8469
05:35:38,080 --> 05:35:41,920
Say for example, if you want to run a
8470
05:35:39,600 --> 05:35:46,080
command with an empty environment. So
8471
05:35:41,920 --> 05:35:50,718
for that the syntax is envy-en
8472
05:35:46,080 --> 05:35:52,958
I and the command. Okay. And uh say for
8473
05:35:50,718 --> 05:35:55,120
example if you want to remove a variable
8474
05:35:52,958 --> 05:36:00,000
from the environment.
8475
05:35:55,120 --> 05:36:03,878
So for that the syntax is env
8476
05:36:00,000 --> 05:36:03,878
and the variable
8477
05:36:04,400 --> 05:36:09,600
name. Okay.
8478
05:36:07,440 --> 05:36:12,480
So I hope you have understood this
8479
05:36:09,600 --> 05:36:15,480
command env. Let me just clear the
8480
05:36:12,480 --> 05:36:15,480
terminal.
8481
05:36:15,600 --> 05:36:20,240
So the next command that we are going to
8482
05:36:17,200 --> 05:36:22,320
talk about is the IP tables command. IP
8483
05:36:20,240 --> 05:36:24,878
tables is a command line interface used
8484
05:36:22,320 --> 05:36:27,760
to set up and maintain tables for the
8485
05:36:24,878 --> 05:36:30,718
net filter firewall for the IP v4
8486
05:36:27,760 --> 05:36:32,718
including the Linux kernel. The firewall
8487
05:36:30,718 --> 05:36:34,638
matches packets with rules defined in
8488
05:36:32,718 --> 05:36:38,400
these tables and then takes the
8489
05:36:34,638 --> 05:36:41,440
specified action on a possible match.
8490
05:36:38,400 --> 05:36:43,760
So I'm going to tell you the usage of
8491
05:36:41,440 --> 05:36:45,760
the IP tables commands. So say for
8492
05:36:43,760 --> 05:36:47,520
example while working in DevOps for some
8493
05:36:45,760 --> 05:36:50,638
reason you need to disable the
8494
05:36:47,520 --> 05:36:52,558
firewalls. So for that this command IP
8495
05:36:50,638 --> 05:36:55,558
tables can be used. Say for example
8496
05:36:52,558 --> 05:36:55,558
service
8497
05:36:55,920 --> 05:37:00,040
service IP tables
8498
05:37:00,718 --> 05:37:05,760
stop. So this command can be used to
8499
05:37:03,440 --> 05:37:09,200
disable the firewalls.
8500
05:37:05,760 --> 05:37:11,680
Okay. So this was uh one use of the
8501
05:37:09,200 --> 05:37:13,680
command called IP tables. Okay. So as of
8502
05:37:11,680 --> 05:37:16,160
now we are not running this command on
8503
05:37:13,680 --> 05:37:18,480
our system. So the next command that
8504
05:37:16,160 --> 05:37:21,440
we're going to talk about is the appget
8505
05:37:18,480 --> 05:37:23,520
command. So appget is a command line
8506
05:37:21,440 --> 05:37:26,400
tool which helps in handling packages in
8507
05:37:23,520 --> 05:37:28,320
Linux. Its main task is to retrieve the
8508
05:37:26,400 --> 05:37:30,638
information and packages from the
8509
05:37:28,320 --> 05:37:32,958
authenticated sources for installation,
8510
05:37:30,638 --> 05:37:35,120
upgrade and removal of packages along
8511
05:37:32,958 --> 05:37:37,520
with their dependencies.
8512
05:37:35,120 --> 05:37:40,320
So APD stands for advanced packaging
8513
05:37:37,520 --> 05:37:43,760
tool. So if you're using Ubuntu based
8514
05:37:40,320 --> 05:37:45,760
systems, so here the command appget can
8515
05:37:43,760 --> 05:37:47,920
be used. While if you're someone who's
8516
05:37:45,760 --> 05:37:50,480
using the Red Hat based system such as
8517
05:37:47,920 --> 05:37:53,760
the CentOS, so in that case you need to
8518
05:37:50,480 --> 05:37:56,480
use the command yum. Okay. So the syntax
8519
05:37:53,760 --> 05:37:59,280
for this command is very simple like apt
8520
05:37:56,480 --> 05:38:01,520
get
8521
05:37:59,280 --> 05:38:04,718
the options
8522
05:38:01,520 --> 05:38:06,798
or the flags and the command.
8523
05:38:04,718 --> 05:38:10,240
Okay. So say for example I have to
8524
05:38:06,798 --> 05:38:13,280
install something on my machine.
8525
05:38:10,240 --> 05:38:16,000
So I'll use the command sudo
8526
05:38:13,280 --> 05:38:17,760
app get
8527
05:38:16,000 --> 05:38:19,920
install.
8528
05:38:17,760 --> 05:38:22,480
Say for example I want to install this
8529
05:38:19,920 --> 05:38:24,320
image editor called pinta. Okay. So I'll
8530
05:38:22,480 --> 05:38:24,400
just type pinta. s p s p s p s p s p s p
8531
05:38:24,320 --> 05:38:26,320
s p s p s p s p s p s p s p s p s p s p
8532
05:38:24,400 --> 05:38:30,718
s p s p s p s pseudo apt get install and
8533
05:38:26,320 --> 05:38:33,440
pinta. Okay, so this was about the apt
8534
05:38:30,718 --> 05:38:35,680
get command. The next command is the df
8535
05:38:33,440 --> 05:38:38,400
command and the disk usage command. The
8536
05:38:35,680 --> 05:38:40,798
df or the disk free command reports the
8537
05:38:38,400 --> 05:38:43,760
amount of available disk space being
8538
05:38:40,798 --> 05:38:45,760
used by the file systems. The du or the
8539
05:38:43,760 --> 05:38:48,160
disk usage command reports the size of
8540
05:38:45,760 --> 05:38:50,080
directory trees inclusive of all their
8541
05:38:48,160 --> 05:38:53,600
contents and the size of individual
8542
05:38:50,080 --> 05:38:56,638
files. The aim is to make sure you are
8543
05:38:53,600 --> 05:38:58,400
not overshooting the 80% threshold. If
8544
05:38:56,638 --> 05:39:00,160
you exceed the threshold, it is time to
8545
05:38:58,400 --> 05:39:02,638
scale or clean up the mess because
8546
05:39:00,160 --> 05:39:05,120
you're running out of the resources. So
8547
05:39:02,638 --> 05:39:08,400
the syntax to use this command like uh
8548
05:39:05,120 --> 05:39:10,480
if you want to see the disk free space
8549
05:39:08,400 --> 05:39:13,520
in a human readable format you can use
8550
05:39:10,480 --> 05:39:13,520
the command df
8551
05:39:13,520 --> 05:39:19,160
s p s p s p s p s p s p s p s p s p s
8552
05:39:13,520 --> 05:39:19,160
pseudo df - h
8553
05:39:21,600 --> 05:39:28,160
okay okay so this is the disk free
8554
05:39:25,920 --> 05:39:32,400
command that we are using and we can see
8555
05:39:28,160 --> 05:39:35,440
here the output size available size used
8556
05:39:32,400 --> 05:39:38,000
available memory percentages and the
8557
05:39:35,440 --> 05:39:40,080
mounted location.
8558
05:39:38,000 --> 05:39:42,400
So, but in most cases you want to check
8559
05:39:40,080 --> 05:39:45,120
which part of your system is consuming
8560
05:39:42,400 --> 05:39:48,240
lots of disk space. So the command for
8561
05:39:45,120 --> 05:39:50,320
doing that is
8562
05:39:48,240 --> 05:39:53,920
sudo
8563
05:39:50,320 --> 05:39:56,958
du - h
8564
05:39:53,920 --> 05:40:02,360
- d
8565
05:39:56,958 --> 05:40:02,360
1 and the b r.
8566
05:40:03,920 --> 05:40:10,558
So as you can see here this location it
8567
05:40:07,120 --> 05:40:12,718
is consuming a lot of disk space.
8568
05:40:10,558 --> 05:40:13,920
So this was about the df and the do
8569
05:40:12,718 --> 05:40:16,000
command.
8570
05:40:13,920 --> 05:40:18,160
So now let us talk a bit about shell
8571
05:40:16,000 --> 05:40:20,160
scripting. So first and foremost
8572
05:40:18,160 --> 05:40:22,240
question what is a shell? So an
8573
05:40:20,160 --> 05:40:24,638
operating system is made up of many
8574
05:40:22,240 --> 05:40:26,798
components out of which two are very
8575
05:40:24,638 --> 05:40:29,120
prime components and these components
8576
05:40:26,798 --> 05:40:31,520
are the kernel and the shell. So a
8577
05:40:29,120 --> 05:40:33,360
kernel is at the nucleus of a computer.
8578
05:40:31,520 --> 05:40:35,440
It makes the communication between the
8579
05:40:33,360 --> 05:40:37,600
hardware and the software possible.
8580
05:40:35,440 --> 05:40:40,000
While the kernel is the innermost part
8581
05:40:37,600 --> 05:40:43,040
of an operating system, a shell is the
8582
05:40:40,000 --> 05:40:44,878
outermost one. A shell in a Linux OS
8583
05:40:43,040 --> 05:40:47,440
takes input from you in the form of
8584
05:40:44,878 --> 05:40:49,520
commands, processes it and then gives an
8585
05:40:47,440 --> 05:40:51,520
output. It is the interface through
8586
05:40:49,520 --> 05:40:53,840
which a user works on the programs,
8587
05:40:51,520 --> 05:40:56,320
commands and scripts. A shell is
8588
05:40:53,840 --> 05:40:58,400
accessed by a terminal which runs it. So
8589
05:40:56,320 --> 05:41:00,480
whenever you run the terminal, the shell
8590
05:40:58,400 --> 05:41:02,798
issues a command prompt where you can
8591
05:41:00,480 --> 05:41:04,878
type your input which is then executed
8592
05:41:02,798 --> 05:41:06,638
when you hit the enter key. So the
8593
05:41:04,878 --> 05:41:08,638
output or the result is thereafter
8594
05:41:06,638 --> 05:41:10,958
displayed on the terminal. The shell
8595
05:41:08,638 --> 05:41:13,280
wraps around the delicate interior of an
8596
05:41:10,958 --> 05:41:15,440
operating system thereby protecting it
8597
05:41:13,280 --> 05:41:17,520
from accidental damage. Hence it is
8598
05:41:15,440 --> 05:41:19,920
named as shell. So there are two types
8599
05:41:17,520 --> 05:41:22,558
of shell basically the bond shell and
8600
05:41:19,920 --> 05:41:24,718
the C shell. So the prompt for the bond
8601
05:41:22,558 --> 05:41:28,320
shell is shown by the dollar symbol and
8602
05:41:24,718 --> 05:41:31,680
its derivatives are pix corn and bash.
8603
05:41:28,320 --> 05:41:34,638
Pix shell is also known as SH. Con shell
8604
05:41:31,680 --> 05:41:37,520
is also known as SH and the bornag again
8605
05:41:34,638 --> 05:41:39,760
shell is now known as bash. And the bash
8606
05:41:37,520 --> 05:41:41,760
is the most popular shell. The second
8607
05:41:39,760 --> 05:41:43,600
type of shell is the C shell. And the
8608
05:41:41,760 --> 05:41:45,600
prompt for this shell is shown by the
8609
05:41:43,600 --> 05:41:47,920
percentage sign. And there are two
8610
05:41:45,600 --> 05:41:50,798
subcategories for this that is the C
8611
05:41:47,920 --> 05:41:54,240
shell which is also known as CSH and the
8612
05:41:50,798 --> 05:41:56,160
top C shell which is also known as TCSH.
8613
05:41:54,240 --> 05:41:58,558
So now the question is what is shell
8614
05:41:56,160 --> 05:42:00,558
scripting? So shell scripting is writing
8615
05:41:58,558 --> 05:42:02,798
a series of commands for the shell to
8616
05:42:00,558 --> 05:42:05,040
execute. It can combine lengthy and
8617
05:42:02,798 --> 05:42:07,280
repetitive sequences of commands into a
8618
05:42:05,040 --> 05:42:09,840
single and a simple script which can be
8619
05:42:07,280 --> 05:42:12,000
stored and executed any time. So this
8620
05:42:09,840 --> 05:42:14,320
reduces the effort required by the end
8621
05:42:12,000 --> 05:42:16,320
user. So let us understand the various
8622
05:42:14,320 --> 05:42:18,320
steps in creating a shell script. So
8623
05:42:16,320 --> 05:42:21,120
what you do is first you create a file
8624
05:42:18,320 --> 05:42:22,878
using the vi editor or any other editor
8625
05:42:21,120 --> 05:42:24,480
and you name the script with an
8626
05:42:22,878 --> 05:42:26,638
extension.sh.
8627
05:42:24,480 --> 05:42:28,718
So we will also have a look at it like
8628
05:42:26,638 --> 05:42:30,878
we will execute a shell script but I'll
8629
05:42:28,718 --> 05:42:32,958
just tell you a few steps of how to do
8630
05:42:30,878 --> 05:42:35,840
it. Then we have to start the script
8631
05:42:32,958 --> 05:42:39,520
with the symbol such as hash exclamation
8632
05:42:35,840 --> 05:42:42,160
mark and the /bin /sh.
8633
05:42:39,520 --> 05:42:44,000
So hash exclamation is an operator
8634
05:42:42,160 --> 05:42:46,160
called the shebang which directs the
8635
05:42:44,000 --> 05:42:48,638
script to the interpreter location. So
8636
05:42:46,160 --> 05:42:50,798
if we use the command hash exclamation
8637
05:42:48,638 --> 05:42:52,958
mark/bin/sh
8638
05:42:50,798 --> 05:42:55,920
the script gets directed to the bond
8639
05:42:52,958 --> 05:42:57,680
shell. Then once we open this file, we
8640
05:42:55,920 --> 05:42:59,520
have to write some code. We have to save
8641
05:42:57,680 --> 05:43:01,680
it. And for executing, we have to just
8642
05:42:59,520 --> 05:43:03,360
type the command bash and the file
8643
05:43:01,680 --> 05:43:05,360
name.sh.
8644
05:43:03,360 --> 05:43:08,080
I'll just show you how do you do it.
8645
05:43:05,360 --> 05:43:10,878
Here I have the g terminal or the g bash
8646
05:43:08,080 --> 05:43:14,920
opened here. So we have to type say for
8647
05:43:10,878 --> 05:43:14,920
example abc.sh.
8648
05:43:15,600 --> 05:43:21,600
We have to write something here. So what
8649
05:43:18,160 --> 05:43:23,360
we'll do is I have a simple program
8650
05:43:21,600 --> 05:43:25,520
which calculates the sum of the digits
8651
05:43:23,360 --> 05:43:27,520
of a number. It accepts a number from a
8652
05:43:25,520 --> 05:43:30,638
user and it calculates the sum of its
8653
05:43:27,520 --> 05:43:32,958
digits and it displays the result. So
8654
05:43:30,638 --> 05:43:35,040
this is a very simple program. I'll just
8655
05:43:32,958 --> 05:43:38,958
write it here.
8656
05:43:35,040 --> 05:43:41,200
I'll just save it. WQ. Okay. So it is
8657
05:43:38,958 --> 05:43:44,240
saved. And now we have to just run this
8658
05:43:41,200 --> 05:43:46,638
script using the command bash. Let me
8659
05:43:44,240 --> 05:43:49,200
just check whether I have inserted.
8660
05:43:46,638 --> 05:43:50,878
Okay, so we are missing out on a very
8661
05:43:49,200 --> 05:43:53,440
important thing here. We have to type
8662
05:43:50,878 --> 05:43:56,000
shebang operator. Okay, so hash
8663
05:43:53,440 --> 05:43:57,840
exclamation/bin
8664
05:43:56,000 --> 05:44:00,400
/sh.
8665
05:43:57,840 --> 05:44:03,920
We have written whatever we wanted.
8666
05:44:00,400 --> 05:44:06,638
Okay, so we have saved it and now bash a
8667
05:44:03,920 --> 05:44:10,240
b c.sh.
8668
05:44:06,638 --> 05:44:13,840
So it says enter a number 88.
8669
05:44:10,240 --> 05:44:16,000
So the sum of digits of 88 is 16. So
8670
05:44:13,840 --> 05:44:17,760
this is how you write a shell script and
8671
05:44:16,000 --> 05:44:19,760
you run a shell script. So this was a
8672
05:44:17,760 --> 05:44:21,840
very simple program but you can write
8673
05:44:19,760 --> 05:44:25,120
any program that you want and you can
8674
05:44:21,840 --> 05:44:27,840
run it using the bash. So we have come
8675
05:44:25,120 --> 05:44:30,400
to the final part of this session that
8676
05:44:27,840 --> 05:44:32,240
is the git commands and before knowing
8677
05:44:30,400 --> 05:44:35,120
the git commands we'll quickly brush up
8678
05:44:32,240 --> 05:44:37,520
a few things about git. What is git? So,
8679
05:44:35,120 --> 05:44:39,920
Git is a free open-source distributed
8680
05:44:37,520 --> 05:44:42,080
version control system tool designed to
8681
05:44:39,920 --> 05:44:43,760
handle everything from small to very
8682
05:44:42,080 --> 05:44:45,760
large projects with speed and
8683
05:44:43,760 --> 05:44:48,000
efficiency. So, Git has the
8684
05:44:45,760 --> 05:44:50,320
functionality, performance, security,
8685
05:44:48,000 --> 05:44:52,480
and flexibility that most teams and
8686
05:44:50,320 --> 05:44:54,080
individual developers need. It also
8687
05:44:52,480 --> 05:44:55,840
serves as an important distributed
8688
05:44:54,080 --> 05:44:58,400
version control tool that is used in
8689
05:44:55,840 --> 05:45:00,000
DevOps. Tools like Git enable the
8690
05:44:58,400 --> 05:45:02,160
communication between the development
8691
05:45:00,000 --> 05:45:03,840
and the operations team. So whenever
8692
05:45:02,160 --> 05:45:05,920
you're developing a large project with a
8693
05:45:03,840 --> 05:45:07,440
huge number of collaborators, it is very
8694
05:45:05,920 --> 05:45:09,360
important to have communication between
8695
05:45:07,440 --> 05:45:11,680
the collaborators while making changes
8696
05:45:09,360 --> 05:45:13,120
in the project. Commit messages and git
8697
05:45:11,680 --> 05:45:15,360
play a very important role in
8698
05:45:13,120 --> 05:45:17,840
communicating among the team. The bits
8699
05:45:15,360 --> 05:45:20,000
and pieces that we all deploy lies in
8700
05:45:17,840 --> 05:45:22,320
the version control system like git. So
8701
05:45:20,000 --> 05:45:23,920
to succeed in devops, you need to have
8702
05:45:22,320 --> 05:45:26,558
all the communication in the version
8703
05:45:23,920 --> 05:45:29,120
control and hence git plays a very vital
8704
05:45:26,558 --> 05:45:31,680
role in succeeding at DevOps. So this
8705
05:45:29,120 --> 05:45:34,000
was the definition of git and uh this is
8706
05:45:31,680 --> 05:45:36,558
the diagram that you must remember like
8707
05:45:34,000 --> 05:45:38,718
the working directory, the staging area,
8708
05:45:36,558 --> 05:45:41,200
the local repository and the remote
8709
05:45:38,718 --> 05:45:43,440
repository. You just need to remember
8710
05:45:41,200 --> 05:45:45,200
these things. So if you remember these
8711
05:45:43,440 --> 05:45:47,680
things then you will get a clear
8712
05:45:45,200 --> 05:45:50,240
understanding of what command is used to
8713
05:45:47,680 --> 05:45:52,320
do what things. So now we will have a
8714
05:45:50,240 --> 05:45:54,160
look at few of the g commands like as
8715
05:45:52,320 --> 05:45:57,360
you can see here we will cover a few
8716
05:45:54,160 --> 05:46:00,080
commands get config get init and so on
8717
05:45:57,360 --> 05:46:02,958
and few of these commands as well. Now
8718
05:46:00,080 --> 05:46:05,120
let us go to the get bash. So the first
8719
05:46:02,958 --> 05:46:07,840
command that we will see here is get
8720
05:46:05,120 --> 05:46:09,520
config command. Okay. So this command
8721
05:46:07,840 --> 05:46:11,360
sets the author name and the email
8722
05:46:09,520 --> 05:46:13,600
address respectively to be used with
8723
05:46:11,360 --> 05:46:16,400
your commits. So how do you do it? The
8724
05:46:13,600 --> 05:46:18,558
syntax is pretty simple like get get
8725
05:46:16,400 --> 05:46:21,600
config
8726
05:46:18,558 --> 05:46:24,080
hyphen global
8727
05:46:21,600 --> 05:46:27,600
user.name name
8728
05:46:24,080 --> 05:46:33,558
and the name say for example Edureka in
8729
05:46:27,600 --> 05:46:33,558
my case let's just say Arvin okay
8730
05:46:36,000 --> 05:46:40,558
this is the syntax that is used hyphen
8731
05:46:38,798 --> 05:46:42,878
global previously I just typed a single
8732
05:46:40,558 --> 05:46:45,280
hyphen there are two hyphens here you
8733
05:46:42,878 --> 05:46:48,718
have registered the username and now you
8734
05:46:45,280 --> 05:46:50,718
have to register the email so that is
8735
05:46:48,718 --> 05:46:54,080
get config
8736
05:46:50,718 --> 05:46:57,600
- global
8737
05:46:54,080 --> 05:47:02,600
user dot email
8738
05:46:57,600 --> 05:47:02,600
and the email address that is ervand
8739
05:47:05,840 --> 05:47:10,320
at ureka.co.
8740
05:47:08,000 --> 05:47:13,440
Okay,
8741
05:47:10,320 --> 05:47:15,600
so this works fine.
8742
05:47:13,440 --> 05:47:17,840
So the next command is the get init
8743
05:47:15,600 --> 05:47:20,480
command. So this command is used to
8744
05:47:17,840 --> 05:47:22,160
start a new repository. So this is a
8745
05:47:20,480 --> 05:47:24,878
very simple command. Simply type get
8746
05:47:22,160 --> 05:47:27,280
init like you can type the name of the
8747
05:47:24,878 --> 05:47:29,520
repository if you want else it will
8748
05:47:27,280 --> 05:47:32,558
initialize an empty repository without
8749
05:47:29,520 --> 05:47:34,480
any name. Okay. So here as you can see
8750
05:47:32,558 --> 05:47:36,160
here on desktop it has created a
8751
05:47:34,480 --> 05:47:38,080
repository
8752
05:47:36,160 --> 05:47:40,400
get a repository has been created on the
8753
05:47:38,080 --> 05:47:42,638
desktop with our command. So the next
8754
05:47:40,400 --> 05:47:44,320
command is the get clone command. So
8755
05:47:42,638 --> 05:47:47,200
this command is used to obtain a
8756
05:47:44,320 --> 05:47:49,440
repository from an existing URL. Say for
8757
05:47:47,200 --> 05:47:51,520
example uh let me just show you. I'll
8758
05:47:49,440 --> 05:47:54,160
clone a repository from my GitHub
8759
05:47:51,520 --> 05:47:56,080
account. Okay. So say for example this
8760
05:47:54,160 --> 05:47:58,320
is the repository game of life which is
8761
05:47:56,080 --> 05:48:00,718
available on my GitHub account. To clone
8762
05:47:58,320 --> 05:48:03,360
that URL I'll have to first go to this
8763
05:48:00,718 --> 05:48:06,160
tab clone or download. Click here and
8764
05:48:03,360 --> 05:48:08,638
then you'll get a link. Okay. Copy that
8765
05:48:06,160 --> 05:48:12,878
link clone with https. Okay. Copy that
8766
05:48:08,638 --> 05:48:16,320
link and paste it here. Get clone and
8767
05:48:12,878 --> 05:48:19,558
the repository. Paste.
8768
05:48:16,320 --> 05:48:19,558
Press enter.
8769
05:48:20,480 --> 05:48:24,798
Okay. So the repository is being cloned
8770
05:48:22,480 --> 05:48:28,558
here
8771
05:48:24,798 --> 05:48:31,520
and u it is still working and it is
8772
05:48:28,558 --> 05:48:34,000
done. Okay. So as you can see here the
8773
05:48:31,520 --> 05:48:37,120
game of life repository has been cloned.
8774
05:48:34,000 --> 05:48:39,280
So this was a very easy command.
8775
05:48:37,120 --> 05:48:42,000
Let me just clear the terminal. So the
8776
05:48:39,280 --> 05:48:44,160
next command is the get add command. So
8777
05:48:42,000 --> 05:48:46,480
this command adds a file to the staging
8778
05:48:44,160 --> 05:48:52,160
area. And the command for that is very
8779
05:48:46,480 --> 05:48:54,958
simple. Get add and the file name.
8780
05:48:52,160 --> 05:48:56,718
So this is a syntax for the add command.
8781
05:48:54,958 --> 05:48:59,040
And suppose if you have more than one
8782
05:48:56,718 --> 05:49:01,680
file to add to the staging area, you can
8783
05:48:59,040 --> 05:49:03,600
simply use the star option. Okay. So it
8784
05:49:01,680 --> 05:49:06,240
will add everything like more than one
8785
05:49:03,600 --> 05:49:08,240
files or multiple files. So this was
8786
05:49:06,240 --> 05:49:11,040
about the get add command. The next
8787
05:49:08,240 --> 05:49:13,280
command is the get commit command. So
8788
05:49:11,040 --> 05:49:15,920
this command records or snapshots the
8789
05:49:13,280 --> 05:49:18,400
file permanently in the version history.
8790
05:49:15,920 --> 05:49:20,240
So the syntax for this command is get
8791
05:49:18,400 --> 05:49:23,040
commit
8792
05:49:20,240 --> 05:49:25,680
hyphen m and any of the message that you
8793
05:49:23,040 --> 05:49:28,480
want to type.
8794
05:49:25,680 --> 05:49:31,760
Okay. So with each commit you can type a
8795
05:49:28,480 --> 05:49:33,840
message to notify. So this is the syntax
8796
05:49:31,760 --> 05:49:36,798
for this command. Let's just say there's
8797
05:49:33,840 --> 05:49:38,160
one more command called get commit- a.
8798
05:49:36,798 --> 05:49:40,400
So there's one more flag with this
8799
05:49:38,160 --> 05:49:42,558
command hyphen a. So this command
8800
05:49:40,400 --> 05:49:45,200
commits any files you have added with
8801
05:49:42,558 --> 05:49:47,920
the get add command and also commits any
8802
05:49:45,200 --> 05:49:50,000
files you have changed since then. So
8803
05:49:47,920 --> 05:49:52,320
this is the syntax for this command. Get
8804
05:49:50,000 --> 05:49:54,480
commit - a. Similarly there's one more
8805
05:49:52,320 --> 05:50:00,080
command like as you have seen earlier in
8806
05:49:54,480 --> 05:50:02,798
the Linux command. The rm command get rm
8807
05:50:00,080 --> 05:50:04,160
the file name. Okay. So this command
8808
05:50:02,798 --> 05:50:07,040
deletes the file from your working
8809
05:50:04,160 --> 05:50:09,760
directory and stages the deletion. This
8810
05:50:07,040 --> 05:50:11,280
was very easy command. get rm.
8811
05:50:09,760 --> 05:50:13,520
Similarly, there's one command called
8812
05:50:11,280 --> 05:50:15,840
get show
8813
05:50:13,520 --> 05:50:19,600
and here you have to specify the commit
8814
05:50:15,840 --> 05:50:21,680
id. Okay, so this command shows the meta
8815
05:50:19,600 --> 05:50:24,240
data and the content changes of the
8816
05:50:21,680 --> 05:50:27,200
specified commit. So this was about the
8817
05:50:24,240 --> 05:50:29,680
get show. The next command is the get
8818
05:50:27,200 --> 05:50:31,760
remote command. So this command is used
8819
05:50:29,680 --> 05:50:34,480
to connect your local repository to the
8820
05:50:31,760 --> 05:50:39,920
remote server. So for that the syntax is
8821
05:50:34,480 --> 05:50:39,920
very simple. Say for example get remote
8822
05:50:40,400 --> 05:50:45,320
add the variable name
8823
05:50:46,480 --> 05:50:51,240
and the remote server link.
8824
05:50:54,160 --> 05:50:58,080
This is the syntax to use the get
8825
05:50:56,480 --> 05:50:59,840
remote.
8826
05:50:58,080 --> 05:51:01,680
If you want to delete a branch on your
8827
05:50:59,840 --> 05:51:04,558
remote repository, so how will you do
8828
05:51:01,680 --> 05:51:06,320
it? So there's one command called get
8829
05:51:04,558 --> 05:51:08,080
push
8830
05:51:06,320 --> 05:51:11,440
origin
8831
05:51:08,080 --> 05:51:13,840
the remote server and the branch name.
8832
05:51:11,440 --> 05:51:15,600
Say for example B2 is the branch name.
8833
05:51:13,840 --> 05:51:17,920
So the next command is the get pull
8834
05:51:15,600 --> 05:51:20,240
command. So this command fetches and
8835
05:51:17,920 --> 05:51:23,280
merges changes on the remote server to
8836
05:51:20,240 --> 05:51:26,000
your working directory. So the syntax is
8837
05:51:23,280 --> 05:51:29,638
pretty simple. Get pull and the
8838
05:51:26,000 --> 05:51:29,638
repository link.
8839
05:51:30,400 --> 05:51:34,160
So this is a very simple command. The
8840
05:51:32,798 --> 05:51:36,558
next command that we are going to talk
8841
05:51:34,160 --> 05:51:39,040
about is the get branch command. This
8842
05:51:36,558 --> 05:51:41,360
command lists all the local branches in
8843
05:51:39,040 --> 05:51:44,798
your current repository and its syntax
8844
05:51:41,360 --> 05:51:47,360
is very simple. Just get and branch.
8845
05:51:44,798 --> 05:51:49,760
This is a very simple command and if you
8846
05:51:47,360 --> 05:51:51,600
want to create a new branch so for that
8847
05:51:49,760 --> 05:51:53,680
the command is get branch. Say for
8848
05:51:51,600 --> 05:51:56,558
example the new branch that you want to
8849
05:51:53,680 --> 05:51:58,958
create. So get branch and branch name.
8850
05:51:56,558 --> 05:52:01,520
And if you want to delete the feature
8851
05:51:58,958 --> 05:52:05,520
branch. So for that the command is get
8852
05:52:01,520 --> 05:52:08,958
branch - d and the branch name. Say for
8853
05:52:05,520 --> 05:52:11,120
example B1. So this was the usage of the
8854
05:52:08,958 --> 05:52:13,280
get branch command. The next command is
8855
05:52:11,120 --> 05:52:14,878
the get checkout. So this command is
8856
05:52:13,280 --> 05:52:17,440
used to switch from one branch to
8857
05:52:14,878 --> 05:52:21,840
another branch. And the syntax also is
8858
05:52:17,440 --> 05:52:23,840
very simple. Get checkout
8859
05:52:21,840 --> 05:52:26,480
and the branch name where you want to
8860
05:52:23,840 --> 05:52:30,638
switch. Okay. let's say for example B1
8861
05:52:26,480 --> 05:52:33,760
or B2 or even master.
8862
05:52:30,638 --> 05:52:35,680
So this is one use of checkout. So if
8863
05:52:33,760 --> 05:52:38,160
you want to create a new branch and you
8864
05:52:35,680 --> 05:52:41,760
want to switch to that branch. So for
8865
05:52:38,160 --> 05:52:45,600
that the syntax is get checkout - B and
8866
05:52:41,760 --> 05:52:47,360
the branch name B4. So this command
8867
05:52:45,600 --> 05:52:49,360
creates a branch and also switches to
8868
05:52:47,360 --> 05:52:53,080
that branch. There's one more command
8869
05:52:49,360 --> 05:52:53,080
called get merge.
8870
05:52:53,360 --> 05:52:57,360
So what this command does is this
8871
05:52:55,200 --> 05:52:59,680
command merges the specified branch
8872
05:52:57,360 --> 05:53:02,558
history into the current branch and the
8873
05:52:59,680 --> 05:53:05,958
syntax for that is get merge and the
8874
05:53:02,558 --> 05:53:05,958
branch name
8875
05:53:06,080 --> 05:53:12,160
branch name. So this is a very simple
8876
05:53:09,280 --> 05:53:14,638
command like get merge and the branch
8877
05:53:12,160 --> 05:53:18,958
name. There's one last command that we
8878
05:53:14,638 --> 05:53:21,040
will have a look at that is get rebase.
8879
05:53:18,958 --> 05:53:22,798
So what this command does is this
8880
05:53:21,040 --> 05:53:24,558
command will move all your work from
8881
05:53:22,798 --> 05:53:26,958
your current branch to the master
8882
05:53:24,558 --> 05:53:28,798
branch. They look like as if they are
8883
05:53:26,958 --> 05:53:31,440
developed sequentially but they are
8884
05:53:28,798 --> 05:53:33,840
developed parallelly. So the syntax for
8885
05:53:31,440 --> 05:53:36,798
rebase is get rebase and the branch
8886
05:53:33,840 --> 05:53:41,400
name.
8887
05:53:36,798 --> 05:53:41,400
So this was the syntax for get rebase
8888
05:53:45,360 --> 05:53:50,240
what a Linux file system is. Now when we
8889
05:53:48,000 --> 05:53:52,400
talk about Linux file system, the first
8890
05:53:50,240 --> 05:53:55,040
thing we need to know is what it is.
8891
05:53:52,400 --> 05:53:57,680
Right? So Linux file system is a set of
8892
05:53:55,040 --> 05:54:00,080
processes that controls how, where, when
8893
05:53:57,680 --> 05:54:02,400
data that is stored and retrieved from a
8894
05:54:00,080 --> 05:54:03,840
storage device. How do you store it?
8895
05:54:02,400 --> 05:54:06,160
Where do you store it? When do you store
8896
05:54:03,840 --> 05:54:09,280
it? All of those are basically taken
8897
05:54:06,160 --> 05:54:11,280
care of by the file system. Right? So a
8898
05:54:09,280 --> 05:54:13,600
good file system is extremely essential
8899
05:54:11,280 --> 05:54:15,360
for everyday system processes. Right? A
8900
05:54:13,600 --> 05:54:17,360
Linux file system is basically a
8901
05:54:15,360 --> 05:54:19,760
structured collection of different files
8902
05:54:17,360 --> 05:54:22,240
on a disk drive, right? Or a partition.
8903
05:54:19,760 --> 05:54:24,798
So what you can see is that the file
8904
05:54:22,240 --> 05:54:27,440
system helps in basically making all the
8905
05:54:24,798 --> 05:54:30,080
files present in the Linux system into
8906
05:54:27,440 --> 05:54:32,240
much more structured collected set of
8907
05:54:30,080 --> 05:54:34,638
files. And as you know in Linux
8908
05:54:32,240 --> 05:54:36,958
everything is a file. Be it your
8909
05:54:34,638 --> 05:54:40,160
devices, be it your applications,
8910
05:54:36,958 --> 05:54:42,240
everything in Linux is a file. Right? So
8911
05:54:40,160 --> 05:54:44,320
file systems on Linux basically control
8912
05:54:42,240 --> 05:54:46,160
how and where the data is stored along
8913
05:54:44,320 --> 05:54:48,400
with the fact that every partition
8914
05:54:46,160 --> 05:54:50,958
consists of file system of their own
8915
05:54:48,400 --> 05:54:52,798
just like in Windows you have C drive, D
8916
05:54:50,958 --> 05:54:55,840
drive and all of that based on name
8917
05:54:52,798 --> 05:54:58,000
spaces right in Python there is no CD
8918
05:54:55,840 --> 05:55:00,320
drive although you can have partitions
8919
05:54:58,000 --> 05:55:03,280
but these partitions will basically have
8920
05:55:00,320 --> 05:55:05,280
their own set of file systems right and
8921
05:55:03,280 --> 05:55:07,520
the main thing is that file systems
8922
05:55:05,280 --> 05:55:10,558
helps us store data systematically. So
8923
05:55:07,520 --> 05:55:12,718
this is what a Linux file system is.
8924
05:55:10,558 --> 05:55:14,878
Next up we talk about the different
8925
05:55:12,718 --> 05:55:16,480
types of Linux file system. Now when we
8926
05:55:14,878 --> 05:55:18,558
talk about the different fi types of
8927
05:55:16,480 --> 05:55:21,200
Linux file systems there are there are
8928
05:55:18,558 --> 05:55:26,240
approximately six types. The first is
8929
05:55:21,200 --> 05:55:28,878
the ext. So ext is basically ext 234
8930
05:55:26,240 --> 05:55:31,600
which basically stands for extended file
8931
05:55:28,878 --> 05:55:34,320
system. Now ext2 was the first Linux
8932
05:55:31,600 --> 05:55:37,040
file system that allows managing 2TB of
8933
05:55:34,320 --> 05:55:38,718
data. But at the current moment, ext4 is
8934
05:55:37,040 --> 05:55:41,840
the fastest file system that you can
8935
05:55:38,718 --> 05:55:44,160
have on Linux. Next up, we have the JFS.
8936
05:55:41,840 --> 05:55:46,558
JFS basically stands for the journal
8937
05:55:44,160 --> 05:55:49,040
file system. Journal file system is
8938
05:55:46,558 --> 05:55:52,400
basically developed by IBM along with
8939
05:55:49,040 --> 05:55:57,240
Unix, right? So JFS is an alternative to
8940
05:55:52,400 --> 05:55:57,240
the ext file system. Extremely
8941
05:55:59,920 --> 05:56:03,920
limited. The third kind of file system
8942
05:56:01,920 --> 05:56:07,040
that you have is the Razer FS file
8943
05:56:03,920 --> 05:56:09,920
system. So earlier Razer FS was used as
8944
05:56:07,040 --> 05:56:13,360
a default file systems for Linux SUV.
8945
05:56:09,920 --> 05:56:16,240
But now they shifted to ext3. But what
8946
05:56:13,360 --> 05:56:18,240
Razer FS does is that it dynamically
8947
05:56:16,240 --> 05:56:20,558
supports the file extension but has
8948
05:56:18,240 --> 05:56:22,718
certain performance drawbacks which is
8949
05:56:20,558 --> 05:56:26,558
why now people have again moved back to
8950
05:56:22,718 --> 05:56:30,320
EXC3 from Razer FS. So next up we have
8951
05:56:26,558 --> 05:56:32,878
the XFS. So when it comes to XFS you can
8952
05:56:30,320 --> 05:56:35,360
see that XFS was considered a high-speed
8953
05:56:32,878 --> 05:56:37,440
GFS which is the journal file system in
8954
05:56:35,360 --> 05:56:40,160
high speeded which is developed for
8955
05:56:37,440 --> 05:56:44,320
parallel IO processing. Now one example
8956
05:56:40,160 --> 05:56:48,160
where XFS is used is basically by NASA.
8957
05:56:44,320 --> 05:56:50,878
The next one is the BTRFS. Now BTRFS
8958
05:56:48,160 --> 05:56:53,200
basically stands for B3 file system. It
8959
05:56:50,878 --> 05:56:55,360
is basically a file system which is used
8960
05:56:53,200 --> 05:56:58,240
for fault tolerance repairs of the
8961
05:56:55,360 --> 05:57:00,080
system etc. Next up we have the swap
8962
05:56:58,240 --> 05:57:02,160
file system which is the last kind of
8963
05:57:00,080 --> 05:57:04,878
file system. So when it comes to swap
8964
05:57:02,160 --> 05:57:07,840
file system, swap file systems are used
8965
05:57:04,878 --> 05:57:10,080
for memory paging in Linux OSS, right?
8966
05:57:07,840 --> 05:57:11,920
So memory paging only comes into play
8967
05:57:10,080 --> 05:57:14,160
when there is the system hibernation
8968
05:57:11,920 --> 05:57:16,558
going on. So a system that never goes
8969
05:57:14,160 --> 05:57:20,400
into hibernate is required to have swap
8970
05:57:16,558 --> 05:57:22,958
space equal to RAM space, right? So swap
8971
05:57:20,400 --> 05:57:24,958
space is always equal to RAM space for
8972
05:57:22,958 --> 05:57:26,798
systems that never go into hibernation.
8973
05:57:24,958 --> 05:57:29,120
Up next we have the file system
8974
05:57:26,798 --> 05:57:30,638
architecture. Now when we talk about
8975
05:57:29,120 --> 05:57:33,120
architecture there are a lot of things
8976
05:57:30,638 --> 05:57:34,480
we need to know. Let's let's get going.
8977
05:57:33,120 --> 05:57:36,558
The first thing you need to know about
8978
05:57:34,480 --> 05:57:39,520
the file system architecture is that it
8979
05:57:36,558 --> 05:57:41,680
is a hierarchical file structure and it
8980
05:57:39,520 --> 05:57:44,480
can manage and provide for non
8981
05:57:41,680 --> 05:57:46,320
nonvolatile storage data along with the
8982
05:57:44,480 --> 05:57:49,280
fact that the name space describes
8983
05:57:46,320 --> 05:57:51,760
logical structure of the f. I'll tell
8984
05:57:49,280 --> 05:57:53,600
you all about what all of these means.
8985
05:57:51,760 --> 05:57:55,520
And finally, we see that advanced
8986
05:57:53,600 --> 05:57:57,840
information about the partitions is
8987
05:57:55,520 --> 05:57:59,920
always stored. So let's say for example,
8988
05:57:57,840 --> 05:58:01,760
this is your architecture where you have
8989
05:57:59,920 --> 05:58:04,320
the kernel, you have the virtual file
8990
05:58:01,760 --> 05:58:06,400
system and you also have the different
8991
05:58:04,320 --> 05:58:08,878
file systems that you want right along
8992
05:58:06,400 --> 05:58:11,120
with the hardware in the end. So let's
8993
05:58:08,878 --> 05:58:13,360
go through what I just explained you. So
8994
05:58:11,120 --> 05:58:15,360
when I talk about hierarchal structure
8995
05:58:13,360 --> 05:58:17,440
what I mean is that this system
8996
05:58:15,360 --> 05:58:18,958
basically has a root directory and that
8997
05:58:17,440 --> 05:58:21,600
root directory has certain
8998
05:58:18,958 --> 05:58:23,840
subdirectories right. So all other
8999
05:58:21,600 --> 05:58:25,200
subdirectories can be accessed from the
9000
05:58:23,840 --> 05:58:28,240
root directory. So this is what
9001
05:58:25,200 --> 05:58:31,120
hierarchical structure means right. So
9002
05:58:28,240 --> 05:58:33,600
when I talk about uh the fact that it
9003
05:58:31,120 --> 05:58:35,840
can provide for nonvatile storage data
9004
05:58:33,600 --> 05:58:39,120
when I talk about nonvatile storage data
9005
05:58:35,840 --> 05:58:41,840
I talk about RAM I talk about ROM right.
9006
05:58:39,120 --> 05:58:43,840
So basically this file system is bas
9007
05:58:41,840 --> 05:58:46,240
designed in such a way that it can
9008
05:58:43,840 --> 05:58:48,958
manage and provide space for all
9009
05:58:46,240 --> 05:58:51,840
volatile data. Right? All systems
9010
05:58:48,958 --> 05:58:53,760
require a name space. So name space is
9011
05:58:51,840 --> 05:58:56,320
something that defines the naming
9012
05:58:53,760 --> 05:58:58,718
process, the length of the file name or
9013
05:58:56,320 --> 05:59:02,240
a subset of characters that you have. So
9014
05:58:58,718 --> 05:59:04,160
this nameace is also used for logically
9015
05:59:02,240 --> 05:59:06,958
defining the structure of the file that
9016
05:59:04,160 --> 05:59:08,878
you have. Right? And finally we see that
9017
05:59:06,958 --> 05:59:11,200
the data structure needs to support a
9018
05:59:08,878 --> 05:59:13,200
hierarchical directory structure right.
9019
05:59:11,200 --> 05:59:16,638
So the structure is used to describe the
9020
05:59:13,200 --> 05:59:19,360
available and use disk space right for a
9021
05:59:16,638 --> 05:59:21,600
particular block. So finally we see that
9022
05:59:19,360 --> 05:59:23,280
the advanced data that the structure
9023
05:59:21,600 --> 05:59:25,120
stores or represents contains
9024
05:59:23,280 --> 05:59:27,760
information about the file system stored
9025
05:59:25,120 --> 05:59:30,480
on the drive right. So this information
9026
05:59:27,760 --> 05:59:32,878
that is contained about the partitions
9027
05:59:30,480 --> 05:59:35,280
is completely distinct and independent
9028
05:59:32,878 --> 05:59:38,718
from other file system metadata. Now
9029
05:59:35,280 --> 05:59:41,760
let's look at this architecture we have.
9030
05:59:38,718 --> 05:59:44,160
So the file system requires an API to
9031
05:59:41,760 --> 05:59:46,638
access the function calls or to interact
9032
05:59:44,160 --> 05:59:48,958
with file systems. Right? So API
9033
05:59:46,638 --> 05:59:51,280
facilitates tasks such as creating,
9034
05:59:48,958 --> 05:59:53,680
deleting and copying the files. When I
9035
05:59:51,280 --> 05:59:56,798
talk about API, I mean application
9036
05:59:53,680 --> 05:59:58,798
programming interface. So the first two
9037
05:59:56,798 --> 06:00:01,600
parts of the given system file system
9038
05:59:58,798 --> 06:00:04,160
together make up the Linux virtual file
9039
06:00:01,600 --> 06:00:06,480
system and it provides a single set of
9040
06:00:04,160 --> 06:00:07,920
commands that you have. So next up we
9041
06:00:06,480 --> 06:00:10,638
talk about the different file system
9042
06:00:07,920 --> 06:00:12,958
directories that are there. So let's get
9043
06:00:10,638 --> 06:00:14,718
going. As you can see the topmost file
9044
06:00:12,958 --> 06:00:16,878
directory that you have is the root
9045
06:00:14,718 --> 06:00:18,798
directory and you can basically access
9046
06:00:16,878 --> 06:00:20,638
any of these other directories that are
9047
06:00:18,798 --> 06:00:23,840
there from the root directory itself.
9048
06:00:20,638 --> 06:00:27,920
You can see there's bin, dev, etc. USR,
9049
06:00:23,840 --> 06:00:30,798
home, lib, sbin, temp where all of these
9050
06:00:27,920 --> 06:00:32,480
files have certain functions, right? All
9051
06:00:30,798 --> 06:00:34,718
of these directories have certain
9052
06:00:32,480 --> 06:00:37,360
functions. They store some sort of
9053
06:00:34,718 --> 06:00:39,040
information about the system, right? So,
9054
06:00:37,360 --> 06:00:40,878
let's take a look at some of the file
9055
06:00:39,040 --> 06:00:42,958
directories that are there. So, starting
9056
06:00:40,878 --> 06:00:44,958
off, we talk about bin. Now, when we
9057
06:00:42,958 --> 06:00:47,360
talk about bin, the bin directory
9058
06:00:44,958 --> 06:00:49,120
contains mostly binaries. Now when I
9059
06:00:47,360 --> 06:00:51,040
talk about binaries, binaries is
9060
06:00:49,120 --> 06:00:53,520
basically some of the applications and
9061
06:00:51,040 --> 06:00:56,638
programs that you can run. So the ls
9062
06:00:53,520 --> 06:00:59,520
command which is basically the list of
9063
06:00:56,638 --> 06:01:01,520
the files that you have. So the ls
9064
06:00:59,520 --> 06:01:04,240
command that you have on Linux and other
9065
06:01:01,520 --> 06:01:06,320
basic tools are also present in this
9066
06:01:04,240 --> 06:01:08,240
directory which is the bin directory.
9067
06:01:06,320 --> 06:01:10,080
Right? Then we talk about the dev
9068
06:01:08,240 --> 06:01:11,840
directory. Now when we talk about dev
9069
06:01:10,080 --> 06:01:14,878
directory, we see that the dev directory
9070
06:01:11,840 --> 06:01:17,600
contains device files. Right? So many of
9071
06:01:14,878 --> 06:01:19,760
these are generated at boot time or even
9072
06:01:17,600 --> 06:01:22,480
on the fly, right? So you don't really
9073
06:01:19,760 --> 06:01:24,638
have existing device files already
9074
06:01:22,480 --> 06:01:27,200
present. So some of them are generated
9075
06:01:24,638 --> 06:01:30,160
on the fly or when you boot the system,
9076
06:01:27,200 --> 06:01:32,718
right? Next up we have the etc. Now this
9077
06:01:30,160 --> 06:01:35,920
is fairly important because unlike the
9078
06:01:32,718 --> 06:01:38,480
fact that etc stands for etc. here etc
9079
06:01:35,920 --> 06:01:40,958
stands for everything to configure. So
9080
06:01:38,480 --> 06:01:43,680
everything to configure because it
9081
06:01:40,958 --> 06:01:46,558
contains most if not all the systemwide
9082
06:01:43,680 --> 06:01:48,878
configuration calls right so all of the
9083
06:01:46,558 --> 06:01:50,798
users the passwords the machines that
9084
06:01:48,878 --> 06:01:54,000
are there on your network the user the
9085
06:01:50,798 --> 06:01:56,718
password all of these are present in the
9086
06:01:54,000 --> 06:01:58,638
etc directory uh then we have the home
9087
06:01:56,718 --> 06:02:00,480
directory so when we talk about home
9088
06:01:58,638 --> 06:02:02,718
directory you can see that you find your
9089
06:02:00,480 --> 06:02:06,080
users personal directories here for
9090
06:02:02,718 --> 06:02:08,400
example if let's say home/cor contains
9091
06:02:06,080 --> 06:02:10,878
my directories home/get guest will
9092
06:02:08,400 --> 06:02:13,680
contain another guests directory on the
9093
06:02:10,878 --> 06:02:16,080
same system. Then we come to lib. Now
9094
06:02:13,680 --> 06:02:18,080
lib is basically short for libraries.
9095
06:02:16,080 --> 06:02:20,480
All the libraries are found in this
9096
06:02:18,080 --> 06:02:22,638
directory. Libraries are basically files
9097
06:02:20,480 --> 06:02:25,120
containing code that your application
9098
06:02:22,638 --> 06:02:28,000
may or may not need during runtime.
9099
06:02:25,120 --> 06:02:29,760
Right? So the library under root it
9100
06:02:28,000 --> 06:02:31,680
contains all the important kernel
9101
06:02:29,760 --> 06:02:33,440
modules. As you can see there are two
9102
06:02:31,680 --> 06:02:36,878
different lib directories. So one is
9103
06:02:33,440 --> 06:02:39,040
under root and one is again under where
9104
06:02:36,878 --> 06:02:41,120
right now before we get to that we can
9105
06:02:39,040 --> 06:02:42,878
see another directory which is the media
9106
06:02:41,120 --> 06:02:44,718
directory. Now as you can understand
9107
06:02:42,878 --> 06:02:47,040
media directory is the directory where
9108
06:02:44,718 --> 06:02:49,360
external storage will automatically be
9109
06:02:47,040 --> 06:02:51,440
mounted when you try and plug it in or
9110
06:02:49,360 --> 06:02:53,280
try to access it. Right? So media
9111
06:02:51,440 --> 06:02:55,840
directory is the directory where if you
9112
06:02:53,280 --> 06:02:57,760
connect storage device or an SD it'll
9113
06:02:55,840 --> 06:03:00,958
automatically get mounted in your
9114
06:02:57,760 --> 06:03:02,718
system. Right? So these are the basic
9115
06:03:00,958 --> 06:03:05,760
directories that are there. Let's move
9116
06:03:02,718 --> 06:03:07,840
on to features of Linux file system. Now
9117
06:03:05,760 --> 06:03:10,000
when I talk about features, the basic
9118
06:03:07,840 --> 06:03:12,718
three features that I can think about is
9119
06:03:10,000 --> 06:03:15,360
the fact that Linux is case sensitive.
9120
06:03:12,718 --> 06:03:17,440
Now case sensitivity is because of the
9121
06:03:15,360 --> 06:03:19,680
fact that it distinguishes between
9122
06:03:17,440 --> 06:03:21,680
lowerase and uppercase characters,
9123
06:03:19,680 --> 06:03:25,120
right? So there can be a file which is
9124
06:03:21,680 --> 06:03:26,878
named T S text with T capital and there
9125
06:03:25,120 --> 06:03:28,320
can be another file which has got the
9126
06:03:26,878 --> 06:03:30,400
same name but none of the capital
9127
06:03:28,320 --> 06:03:33,440
letters. So these are two different
9128
06:03:30,400 --> 06:03:35,680
files in Linux right you don't need to
9129
06:03:33,440 --> 06:03:38,160
rename them you can have case sensitive
9130
06:03:35,680 --> 06:03:40,400
files. Next up we can see that Linux has
9131
06:03:38,160 --> 06:03:42,480
various hidden files that are there. Now
9132
06:03:40,400 --> 06:03:44,798
Linux distinguishes between standard
9133
06:03:42,480 --> 06:03:47,200
files and hidden files. Most
9134
06:03:44,798 --> 06:03:50,000
configuration files are hidden in Linux
9135
06:03:47,200 --> 06:03:52,320
OS. Right? So usually we don't need to
9136
06:03:50,000 --> 06:03:54,400
access or read these hidden files. The
9137
06:03:52,320 --> 06:03:56,718
hidden files are represented by a dot
9138
06:03:54,400 --> 06:03:58,958
before they are filed in. Right? So I'll
9139
06:03:56,718 --> 06:04:00,480
show you how you basically access hidden
9140
06:03:58,958 --> 06:04:02,798
files or you can basically check out
9141
06:04:00,480 --> 06:04:04,320
where the hidden files are. Next up we
9142
06:04:02,798 --> 06:04:06,160
see the different partitions,
9143
06:04:04,320 --> 06:04:09,360
directories and drives that are present
9144
06:04:06,160 --> 06:04:11,520
in Linux. Right? So Linux does not use
9145
06:04:09,360 --> 06:04:13,840
drive letters to organize the drive as
9146
06:04:11,520 --> 06:04:16,480
Windows does. Right? Like local dis C,
9147
06:04:13,840 --> 06:04:18,320
local disc. Linux does not have that. In
9148
06:04:16,480 --> 06:04:20,798
Linux, we cannot tell whether we are
9149
06:04:18,320 --> 06:04:23,040
addressing a partition, a network or an
9150
06:04:20,798 --> 06:04:24,798
ordinary directory because all of the
9151
06:04:23,040 --> 06:04:27,520
files, all of the directories that are
9152
06:04:24,798 --> 06:04:29,920
there, every application, every uh
9153
06:04:27,520 --> 06:04:32,718
device, all of everything that you have
9154
06:04:29,920 --> 06:04:34,558
is a file, right? Even the file which
9155
06:04:32,718 --> 06:04:37,440
has different commands is a different
9156
06:04:34,558 --> 06:04:39,360
file. Even a command like ls is a
9157
06:04:37,440 --> 06:04:41,920
different file which is present in bin.
9158
06:04:39,360 --> 06:04:45,120
And we'll check that out in a while.
9159
06:04:41,920 --> 06:04:48,240
Right? So next up, let's come to the
9160
06:04:45,120 --> 06:04:50,400
demo for Linux file system.
9161
06:04:48,240 --> 06:04:53,840
So basically when you go into Linux,
9162
06:04:50,400 --> 06:04:55,920
this is your interface that you have. So
9163
06:04:53,840 --> 06:04:58,798
where can you find your files? You go to
9164
06:04:55,920 --> 06:05:00,558
files. You can also check out your
9165
06:04:58,798 --> 06:05:02,240
directories from the terminal. And that
9166
06:05:00,558 --> 06:05:04,798
is basically what we're going to do. Now
9167
06:05:02,240 --> 06:05:07,920
here here you can see that there are no
9168
06:05:04,798 --> 06:05:09,600
such partitions as such, right? You
9169
06:05:07,920 --> 06:05:11,840
don't have a C drive, you don't have a D
9170
06:05:09,600 --> 06:05:14,558
drive. So where do you find your system
9171
06:05:11,840 --> 06:05:17,120
files like in C? So you can just go to
9172
06:05:14,558 --> 06:05:18,558
other locations go to computer and as
9173
06:05:17,120 --> 06:05:20,000
soon as you go to computer you can see
9174
06:05:18,558 --> 06:05:24,400
that these are the files that are there
9175
06:05:20,000 --> 06:05:27,120
the bin file dev file etc home lib and
9176
06:05:24,400 --> 06:05:29,520
you can basically go into these files.
9177
06:05:27,120 --> 06:05:32,480
So basically some of these files have
9178
06:05:29,520 --> 06:05:34,320
restricted access. So let's just go and
9179
06:05:32,480 --> 06:05:37,200
see how you can access them through the
9180
06:05:34,320 --> 06:05:39,360
terminal. So you basically go to your
9181
06:05:37,200 --> 06:05:42,638
terminal and let's just check out check
9182
06:05:39,360 --> 06:05:44,240
out a few Linux commands now. So to
9183
06:05:42,638 --> 06:05:47,040
basically see the files that you have in
9184
06:05:44,240 --> 06:05:49,440
your system just type in ls right and if
9185
06:05:47,040 --> 06:05:52,558
you want to move into the directory you
9186
06:05:49,440 --> 06:05:56,000
have to put cd right choose directory
9187
06:05:52,558 --> 06:06:00,080
and let's say desktop right and then
9188
06:05:56,000 --> 06:06:02,080
let's say ls again. So this is basically
9189
06:06:00,080 --> 06:06:04,000
how you cd into the desktop directory.
9190
06:06:02,080 --> 06:06:06,798
Now if you want to move into another
9191
06:06:04,000 --> 06:06:09,760
directory all you need to do is the cd
9192
06:06:06,798 --> 06:06:12,080
space dot dot and you move back here and
9193
06:06:09,760 --> 06:06:14,798
if you see ls now you are back to square
9194
06:06:12,080 --> 06:06:17,760
one where you can choose anything else
9195
06:06:14,798 --> 06:06:21,040
right so if you want to clear this you
9196
06:06:17,760 --> 06:06:23,360
can just type clear
9197
06:06:21,040 --> 06:06:26,638
and you'll basically have your terminal
9198
06:06:23,360 --> 06:06:29,600
good is new right so basically you want
9199
06:06:26,638 --> 06:06:32,798
to know what is the user that you are in
9200
06:06:29,600 --> 06:06:35,798
called right so all you need to is type
9201
06:06:32,798 --> 06:06:35,798
in
9202
06:06:39,600 --> 06:06:44,240
right so this is the name of the user
9203
06:06:42,000 --> 06:06:45,920
that I have created and it's called KB
9204
06:06:44,240 --> 06:06:48,718
and all you need to do to find out which
9205
06:06:45,920 --> 06:06:51,280
user system you are currently on is just
9206
06:06:48,718 --> 06:06:54,080
type in who am I right moment you do
9207
06:06:51,280 --> 06:06:55,920
that your system user will be shown to
9208
06:06:54,080 --> 06:06:59,440
you so let's go back and check out
9209
06:06:55,920 --> 06:07:01,840
something else so now you basically see
9210
06:06:59,440 --> 06:07:04,400
if you type ls this is all the
9211
06:07:01,840 --> 06:07:06,798
directories that you have in your system
9212
06:07:04,400 --> 06:07:10,638
like we talked about bin with your bin
9213
06:07:06,798 --> 06:07:13,440
files with your library files the dev
9214
06:07:10,638 --> 06:07:15,760
file the etc home all of these are there
9215
06:07:13,440 --> 06:07:17,840
now what we can do is check out some of
9216
06:07:15,760 --> 06:07:20,320
these directories that we have ready so
9217
06:07:17,840 --> 06:07:22,480
let's get going so let's check out what
9218
06:07:20,320 --> 06:07:26,160
is there in the bin file that we have
9219
06:07:22,480 --> 06:07:29,520
right so let's do let's choose the
9220
06:07:26,160 --> 06:07:31,840
directory bin and choose it we can do cd
9221
06:07:29,520 --> 06:07:34,000
bin now we are side bin. Let's check out
9222
06:07:31,840 --> 06:07:36,320
the files that are there. So, as you can
9223
06:07:34,000 --> 06:07:39,600
see, these are the various files that
9224
06:07:36,320 --> 06:07:41,840
are present in the bin. Right? If you
9225
06:07:39,600 --> 06:07:44,480
can check properly, you will also see
9226
06:07:41,840 --> 06:07:48,000
that the ls command that we have is also
9227
06:07:44,480 --> 06:07:50,638
a file that is present in the bin file.
9228
06:07:48,000 --> 06:07:53,200
I repeat, in the bin directory. So, a
9229
06:07:50,638 --> 06:07:56,878
command itself is also a file. Now, this
9230
06:07:53,200 --> 06:07:59,600
basically shows us that everything in
9231
06:07:56,878 --> 06:08:01,600
Linux is basically a file. Right? Now
9232
06:07:59,600 --> 06:08:02,878
apart from ls I can show you some other
9233
06:08:01,600 --> 06:08:05,680
files which we talked about which are
9234
06:08:02,878 --> 06:08:08,080
directories as well like mount itself is
9235
06:08:05,680 --> 06:08:10,958
another file which is present in bit and
9236
06:08:08,080 --> 06:08:13,200
is a directory in itself as well. So as
9237
06:08:10,958 --> 06:08:17,520
you can see ls is a file. So let's go
9238
06:08:13,200 --> 06:08:20,320
back to our right. So let's now check
9239
06:08:17,520 --> 06:08:22,718
out let's clear this out. Right. So
9240
06:08:20,320 --> 06:08:25,360
let's check out this command called cat.
9241
06:08:22,718 --> 06:08:29,760
Right. So cat stands for concatenate.
9242
06:08:25,360 --> 06:08:31,600
Now what concatenate does is basically
9243
06:08:29,760 --> 06:08:34,080
takes any file and it shows you the
9244
06:08:31,600 --> 06:08:36,638
binary and whatever is there. So this is
9245
06:08:34,080 --> 06:08:39,600
basically the binary encoded file for
9246
06:08:36,638 --> 06:08:42,320
your ls file which is present in the bin
9247
06:08:39,600 --> 06:08:44,080
directory. Right? So even for a command
9248
06:08:42,320 --> 06:08:46,558
like this you will basically have a
9249
06:08:44,080 --> 06:08:49,760
binary encoded file which is there.
9250
06:08:46,558 --> 06:08:51,520
Right? So this is what cat does. It
9251
06:08:49,760 --> 06:08:53,200
takes a file and shows you the contents
9252
06:08:51,520 --> 06:08:55,680
of it. So the machine understandable
9253
06:08:53,200 --> 06:08:59,680
language that is this right now is shown
9254
06:08:55,680 --> 06:09:03,160
to you. Right? So let's go back and
9255
06:08:59,680 --> 06:09:03,160
clear this out.
9256
06:09:04,878 --> 06:09:09,760
Right? So let's now check out another
9257
06:09:07,520 --> 06:09:11,840
command which is a cb command. Let's say
9258
06:09:09,760 --> 06:09:14,000
you want to repeat let's say you want to
9259
06:09:11,840 --> 06:09:16,240
copy the contents of file into another
9260
06:09:14,000 --> 06:09:18,240
file that you make. Right? So let's
9261
06:09:16,240 --> 06:09:20,240
check out what you do for that and you
9262
06:09:18,240 --> 06:09:23,200
need the copy command which is written
9263
06:09:20,240 --> 06:09:25,120
by CP. So first you write sudo. So
9264
06:09:23,200 --> 06:09:27,840
sseudo is basically command which gives
9265
06:09:25,120 --> 06:09:30,080
you permission to access administrator
9266
06:09:27,840 --> 06:09:36,638
files. Files that you do not get access
9267
06:09:30,080 --> 06:09:39,680
to generally right. So sudo cp and ls is
9268
06:09:36,638 --> 06:09:43,600
the file I want to copy into my new file
9269
06:09:39,680 --> 06:09:46,480
which is korak. And that's it. It's been
9270
06:09:43,600 --> 06:09:49,360
copied. Now basically since I copied the
9271
06:09:46,480 --> 06:09:51,360
contents of ls into this new file which
9272
06:09:49,360 --> 06:09:54,798
is called korak. Let's see what happens
9273
06:09:51,360 --> 06:09:57,760
when you pseudo into Korak instead.
9274
06:09:54,798 --> 06:10:01,680
Right? So as you can see different files
9275
06:09:57,760 --> 06:10:04,080
in ls are basically now here copied into
9276
06:10:01,680 --> 06:10:07,200
the file which is called korok. Right?
9277
06:10:04,080 --> 06:10:10,200
So this is how you copy files. Let's go
9278
06:10:07,200 --> 06:10:10,200
back.
9279
06:10:11,680 --> 06:10:17,200
So next up let's just talk about another
9280
06:10:14,558 --> 06:10:21,840
command that we have called rm. Right?
9281
06:10:17,200 --> 06:10:27,280
So let's say sudo rm
9282
06:10:21,840 --> 06:10:29,200
ls right now let's go let's say ls. So
9283
06:10:27,280 --> 06:10:31,920
as you can see we've just removed the
9284
06:10:29,200 --> 06:10:34,558
file ls right first what we did is we
9285
06:10:31,920 --> 06:10:37,040
copied the contents of ls into gor and
9286
06:10:34,558 --> 06:10:39,120
now you can see we've removed file ls
9287
06:10:37,040 --> 06:10:42,558
and this is basically not there in the
9288
06:10:39,120 --> 06:10:45,200
directory anymore. Now basically as you
9289
06:10:42,558 --> 06:10:47,200
can see there's no ls. So let's check
9290
06:10:45,200 --> 06:10:49,200
out Korak because that's the file we
9291
06:10:47,200 --> 06:10:51,440
copied it into. As you can see, Korak
9292
06:10:49,200 --> 06:10:54,558
has all the files that were present in
9293
06:10:51,440 --> 06:10:57,280
the ls file, right? So to change that
9294
06:10:54,558 --> 06:10:59,520
back to ls, all you need to do is pseudo
9295
06:10:57,280 --> 06:11:06,240
cporak
9296
06:10:59,520 --> 06:11:09,600
and ls, right? And clear it out. And
9297
06:11:06,240 --> 06:11:12,000
let's just check ls now. Now if you go
9298
06:11:09,600 --> 06:11:14,638
check ls, now the copy of contents of
9299
06:11:12,000 --> 06:11:17,040
kor are now in ls. And that is how you
9300
06:11:14,638 --> 06:11:18,958
can basically copy paste any of the
9301
06:11:17,040 --> 06:11:21,360
contents in your folder into any other
9302
06:11:18,958 --> 06:11:23,920
folder. Right? So let's check out
9303
06:11:21,360 --> 06:11:26,080
something else now. So let's just try
9304
06:11:23,920 --> 06:11:28,400
something else. So since we know that
9305
06:11:26,080 --> 06:11:31,520
every single thing in Linux is basically
9306
06:11:28,400 --> 06:11:34,240
a file. So the command just like ls the
9307
06:11:31,520 --> 06:11:36,240
command cat is also a file. So can you
9308
06:11:34,240 --> 06:11:38,638
really concatenate
9309
06:11:36,240 --> 06:11:41,120
the cat folder? You can write cat. Let's
9310
06:11:38,638 --> 06:11:43,280
see what happen. Right. So this is
9311
06:11:41,120 --> 06:11:45,120
exactly what happens. You go on and on
9312
06:11:43,280 --> 06:11:47,680
and on and this is basically your cat
9313
06:11:45,120 --> 06:11:51,280
folder and it keeps on going until you
9314
06:11:47,680 --> 06:11:53,040
do this. So we'll just clear this out.
9315
06:11:51,280 --> 06:11:56,000
So you can basically concatenate the
9316
06:11:53,040 --> 06:11:58,878
concatenate file with the same command.
9317
06:11:56,000 --> 06:12:00,558
Right? So this is pretty interesting. So
9318
06:11:58,878 --> 06:12:03,360
let's not go check out some other
9319
06:12:00,558 --> 06:12:08,240
directories that are there. Right? So
9320
06:12:03,360 --> 06:12:12,320
cdv/ dot you go back go to ls. Let's
9321
06:12:08,240 --> 06:12:17,360
check out let's say your library
9322
06:12:12,320 --> 06:12:20,320
right or the sbin that you have.
9323
06:12:17,360 --> 06:12:23,360
So these are the sbin files that you
9324
06:12:20,320 --> 06:12:26,878
have. So let's check them out. Let's see
9325
06:12:23,360 --> 06:12:29,440
if we can really do something here.
9326
06:12:26,878 --> 06:12:31,680
Right. So there is this command called
9327
06:12:29,440 --> 06:12:35,280
add user which is also a file which is
9328
06:12:31,680 --> 06:12:37,200
present in the sbin directory. Right? So
9329
06:12:35,280 --> 06:12:40,200
let's see what happens when you have add
9330
06:12:37,200 --> 06:12:40,200
user.
9331
06:12:42,160 --> 06:12:46,320
So let's basically say we want to create
9332
06:12:44,480 --> 06:12:48,638
a new user. That is basically the
9333
06:12:46,320 --> 06:12:50,558
command for adding a new user. So let's
9334
06:12:48,638 --> 06:12:55,040
do sudo because you need administrator
9335
06:12:50,558 --> 06:12:59,600
permissions sudo and then add user
9336
06:12:55,040 --> 06:13:05,878
and let's say new user's name.
9337
06:12:59,600 --> 06:13:05,878
Right? So this is going to be
9338
06:13:08,000 --> 06:13:15,600
right. So basically what you need is
9339
06:13:11,760 --> 06:13:19,000
full name let's say
9340
06:13:15,600 --> 06:13:19,000
you can just
9341
06:13:19,280 --> 06:13:25,120
right so now you basically have created
9342
06:13:22,080 --> 06:13:27,280
a new user called dedurea which has a
9343
06:13:25,120 --> 06:13:29,360
full name of corp and you can basically
9344
06:13:27,280 --> 06:13:31,920
skip these you want to add all of the
9345
06:13:29,360 --> 06:13:34,400
room number workphone and home number if
9346
06:13:31,920 --> 06:13:36,400
you want to you can do that but the
9347
06:13:34,400 --> 06:13:38,558
entire point of this is to show you how
9348
06:13:36,400 --> 06:13:41,600
you create new user from an existing
9349
06:13:38,558 --> 06:13:44,798
user, right? So, basically, let's go
9350
06:13:41,600 --> 06:13:47,200
back and check something else out.
9351
06:13:44,798 --> 06:13:50,958
Right? Then, let's go back into the
9352
06:13:47,200 --> 06:13:53,760
directory and do ls. Let's check out
9353
06:13:50,958 --> 06:13:57,760
some other directories. Now, let's cd
9354
06:13:53,760 --> 06:14:00,718
into let's say user directory,
9355
06:13:57,760 --> 06:14:04,080
right? So, as you can see here, there's
9356
06:14:00,718 --> 06:14:08,000
a separate bin that is there here inside
9357
06:14:04,080 --> 06:14:11,520
the usr directory as well. So if we cd
9358
06:14:08,000 --> 06:14:14,798
into the bin directory that it has see
9359
06:14:11,520 --> 06:14:18,320
what's there. So as you can see the bin
9360
06:14:14,798 --> 06:14:21,120
directory is kind of similar to your
9361
06:14:18,320 --> 06:14:22,718
root bin directory that is there. Now if
9362
06:14:21,120 --> 06:14:26,000
you can check there are most of the
9363
06:14:22,718 --> 06:14:29,120
files that you see here are already
9364
06:14:26,000 --> 06:14:31,680
there in the root bin directory. Right?
9365
06:14:29,120 --> 06:14:33,840
So what is basically different and which
9366
06:14:31,680 --> 06:14:35,760
directory are you using when you
9367
06:14:33,840 --> 06:14:38,958
basically store files? where is the file
9368
06:14:35,760 --> 06:14:41,680
getting stored right so to do that you
9369
06:14:38,958 --> 06:14:45,360
will basically have to
9370
06:14:41,680 --> 06:14:48,160
type in this command let's say which ls
9371
06:14:45,360 --> 06:14:50,638
are you using so you use the ls command
9372
06:14:48,160 --> 06:14:56,638
which is stored in the user directory
9373
06:14:50,638 --> 06:14:59,600
right same let's go for which cat right
9374
06:14:56,638 --> 06:15:02,400
which concatenate same here in the user
9375
06:14:59,600 --> 06:15:05,360
directory which
9376
06:15:02,400 --> 06:15:07,680
cp so all of these are they're present
9377
06:15:05,360 --> 06:15:10,080
inside the user directory, right? And
9378
06:15:07,680 --> 06:15:12,798
not in the root bin directory that you
9379
06:15:10,080 --> 06:15:14,718
have. Although the files in the root bin
9380
06:15:12,798 --> 06:15:16,798
directory and your user bin directory
9381
06:15:14,718 --> 06:15:18,718
are kind of similar except there are
9382
06:15:16,798 --> 06:15:22,480
certain more files that are present in
9383
06:15:18,718 --> 06:15:24,080
the user directory. Right? So let's now
9384
06:15:22,480 --> 06:15:26,878
go check out some of the other
9385
06:15:24,080 --> 06:15:30,080
directories that are there. So let's
9386
06:15:26,878 --> 06:15:33,200
just cd back
9387
06:15:30,080 --> 06:15:36,080
cd back here.
9388
06:15:33,200 --> 06:15:37,920
Right. So let's check out some of the
9389
06:15:36,080 --> 06:15:39,600
other directories that you have. So the
9390
06:15:37,920 --> 06:15:41,680
boot directory will consist of files
9391
06:15:39,600 --> 06:15:43,920
that you have to boot right that you
9392
06:15:41,680 --> 06:15:45,840
need to boot. Now the temp directory is
9393
06:15:43,920 --> 06:15:48,480
the directory which has temporary files
9394
06:15:45,840 --> 06:15:50,638
that are present there right. The media
9395
06:15:48,480 --> 06:15:53,200
directory is basically the directory
9396
06:15:50,638 --> 06:15:55,120
which lets you connect or mount any
9397
06:15:53,200 --> 06:15:58,718
external storage device uh
9398
06:15:55,120 --> 06:16:01,680
automatically. So if you CD into media
9399
06:15:58,718 --> 06:16:03,760
and check out what's in there, there is
9400
06:16:01,680 --> 06:16:06,400
no other external storage device that is
9401
06:16:03,760 --> 06:16:09,600
in there right now. So there's nothing
9402
06:16:06,400 --> 06:16:11,760
in the media file also. So let's check
9403
06:16:09,600 --> 06:16:14,400
out some other directories that are
9404
06:16:11,760 --> 06:16:16,878
there. Right? So let's check out the
9405
06:16:14,400 --> 06:16:18,878
home directory. So home as we talked
9406
06:16:16,878 --> 06:16:21,920
about is the directory which contains
9407
06:16:18,878 --> 06:16:24,958
the user's personal directories. Right?
9408
06:16:21,920 --> 06:16:27,680
So if you l into this you will see that
9409
06:16:24,958 --> 06:16:31,200
there is another new user that's been
9410
06:16:27,680 --> 06:16:33,520
created which is right along with the KB
9411
06:16:31,200 --> 06:16:35,760
user that was there. Now this has only
9412
06:16:33,520 --> 06:16:39,440
been created because we've used the add
9413
06:16:35,760 --> 06:16:41,920
user command right so this is basically
9414
06:16:39,440 --> 06:16:45,280
showing you all the users that are
9415
06:16:41,920 --> 06:16:50,958
present. Now if you want to let's say ls
9416
06:16:45,280 --> 06:16:53,600
into them cd kb and ls into this you can
9417
06:16:50,958 --> 06:16:57,920
see that your personal directory and
9418
06:16:53,600 --> 06:17:00,400
files are here right so next up let's
9419
06:16:57,920 --> 06:17:04,878
just check out
9420
06:17:00,400 --> 06:17:07,040
some other folders let's cd
9421
06:17:04,878 --> 06:17:10,240
right
9422
06:17:07,040 --> 06:17:13,120
so let's check out dev which is the
9423
06:17:10,240 --> 06:17:15,840
devices Right? If you check out the
9424
06:17:13,120 --> 06:17:19,760
devices, so if you go into devices, what
9425
06:17:15,840 --> 06:17:22,160
you can see is SDA and SDA1. So these
9426
06:17:19,760 --> 06:17:24,480
these four that you see here are the
9427
06:17:22,160 --> 06:17:26,958
various virtual drives that you have,
9428
06:17:24,480 --> 06:17:29,040
virtual discs that you have on Linux,
9429
06:17:26,958 --> 06:17:34,400
right? So these are the various devices
9430
06:17:29,040 --> 06:17:38,320
you have. So if you go back, let's say,
9431
06:17:34,400 --> 06:17:43,798
let's clear it out. Right? So and
9432
06:17:38,320 --> 06:17:43,798
finally let's go check out what proc is
9433
06:17:44,240 --> 06:17:51,040
right. So this is basically a file which
9434
06:17:47,520 --> 06:17:53,200
is not really there. Right now proc is
9435
06:17:51,040 --> 06:17:56,000
basically something which is created
9436
06:17:53,200 --> 06:17:57,840
every time your system starts up. It's
9437
06:17:56,000 --> 06:18:00,480
not there when your system shut down.
9438
06:17:57,840 --> 06:18:02,638
Every time it starts up it has a file
9439
06:18:00,480 --> 06:18:04,718
called proc. Now this proc file will
9440
06:18:02,638 --> 06:18:07,040
basically have information related to
9441
06:18:04,718 --> 06:18:08,958
all the ongoing processes that you have
9442
06:18:07,040 --> 06:18:11,680
the memory management hardware
9443
06:18:08,958 --> 06:18:14,878
management hardware configurations. So
9444
06:18:11,680 --> 06:18:17,440
every Linux system has a proc file no
9445
06:18:14,878 --> 06:18:19,360
matter which version it is right
9446
06:18:17,440 --> 06:18:25,200
whenever you start up a Linux system you
9447
06:18:19,360 --> 06:18:27,920
will have a proc file. So let's go back
9448
06:18:25,200 --> 06:18:32,240
let's check out our network directory
9449
06:18:27,920 --> 06:18:37,680
now. So for network directory we have to
9450
06:18:32,240 --> 06:18:40,000
cd into etc. right
9451
06:18:37,680 --> 06:18:43,120
if you will as into this you can see
9452
06:18:40,000 --> 06:18:46,240
that networks right here. Now you can cd
9453
06:18:43,120 --> 06:18:49,760
into networks
9454
06:18:46,240 --> 06:18:54,080
right. So this is basically what you
9455
06:18:49,760 --> 06:18:57,440
have. This is your network. Now what you
9456
06:18:54,080 --> 06:18:59,840
need to find from here is the different
9457
06:18:57,440 --> 06:19:04,638
files that you have. So these are the
9458
06:18:59,840 --> 06:19:06,400
different files. Let's say you dive into
9459
06:19:04,638 --> 06:19:09,840
this,
9460
06:19:06,400 --> 06:19:12,320
right? And you listen to this. You can
9461
06:19:09,840 --> 06:19:15,200
have these files,
9462
06:19:12,320 --> 06:19:18,798
right? And you can just check the VPN
9463
06:19:15,200 --> 06:19:20,558
connection using let's say
9464
06:19:18,798 --> 06:19:23,558
cd
9465
06:19:20,558 --> 06:19:23,558
open.
9466
06:19:32,080 --> 06:19:37,440
Right. So finally what we'll do is check
9467
06:19:34,558 --> 06:19:40,718
out where the hidden files are there. So
9468
06:19:37,440 --> 06:19:43,200
you can just so as you can see this is
9469
06:19:40,718 --> 06:19:46,160
basically the computer where you have
9470
06:19:43,200 --> 06:19:48,080
all your directories and you have all of
9471
06:19:46,160 --> 06:19:49,760
these are visible and you have hidden
9472
06:19:48,080 --> 06:19:52,240
files because Linux allows you to have
9473
06:19:49,760 --> 06:19:53,520
hidden files. So to check out the hidden
9474
06:19:52,240 --> 06:19:57,760
files that you have, all you have to do
9475
06:19:53,520 --> 06:20:02,040
is Ctrl H, right?
9476
06:19:57,760 --> 06:20:02,040
All these are basically
9477
06:20:02,638 --> 06:20:08,080
right. So as you can see these are all
9478
06:20:04,878 --> 06:20:11,040
authenticated files and
9479
06:20:08,080 --> 06:20:14,160
so if you just go into this and do Ctrl
9480
06:20:11,040 --> 06:20:17,600
H, you can see the number of files that
9481
06:20:14,160 --> 06:20:21,360
are there have increased. Right? These
9482
06:20:17,600 --> 06:20:23,520
are other files that are there. Right?
9483
06:20:21,360 --> 06:20:25,760
So just to see the files which are
9484
06:20:23,520 --> 06:20:29,320
hidden in Linux, all you need to do is
9485
06:20:25,760 --> 06:20:29,320
Ctrl H.
9486
06:20:33,360 --> 06:20:38,400
Now let's talk about RPM. So the full
9487
06:20:36,240 --> 06:20:41,200
form of the RPM is Redhead Package
9488
06:20:38,400 --> 06:20:44,240
Manager. The files used by this program
9489
06:20:41,200 --> 06:20:47,440
have an extension of RPM. RPM was
9490
06:20:44,240 --> 06:20:50,558
originally created in 1997. It is free
9491
06:20:47,440 --> 06:20:52,878
and released under GPL license. It is
9492
06:20:50,558 --> 06:20:57,600
default packaging for distribution which
9493
06:20:52,878 --> 06:21:00,718
comes under RL centers Fedora etc. So to
9494
06:20:57,600 --> 06:21:04,878
maintain packages by maintaining I mean
9495
06:21:00,718 --> 06:21:08,320
adding updating deleting packages in RL
9496
06:21:04,878 --> 06:21:10,878
CentOS or Fedora we use RPM. So if you
9497
06:21:08,320 --> 06:21:13,680
want to install any package in CentOS
9498
06:21:10,878 --> 06:21:15,840
there are commands like RPM minus IBH
9499
06:21:13,680 --> 06:21:18,558
then the name of the RPM. For example,
9500
06:21:15,840 --> 06:21:22,000
if you have got MySQL RPM with version
9501
06:21:18,558 --> 06:21:26,320
5.7. So let us suppose the name of the
9502
06:21:22,000 --> 06:21:28,718
MySQL RPM is MySQL 5.7.
9503
06:21:26,320 --> 06:21:30,558
RPM. So this is just pseudo name which
9504
06:21:28,718 --> 06:21:33,360
I'm creating right now. So what you have
9505
06:21:30,558 --> 06:21:36,240
to do is RPM minus IBH and then the name
9506
06:21:33,360 --> 06:21:39,200
of the RPM file mySQL527.
9507
06:21:36,240 --> 06:21:41,440
RPM. It will install your package. So
9508
06:21:39,200 --> 06:21:43,840
let's check out the features first.
9509
06:21:41,440 --> 06:21:46,558
First feature is crypto. The packages in
9510
06:21:43,840 --> 06:21:49,760
Appium can be verified cryptographically
9511
06:21:46,558 --> 06:21:52,400
by MD5 checks sum and GPG key. So to
9512
06:21:49,760 --> 06:21:56,160
check the integrity of any file we have
9513
06:21:52,400 --> 06:21:58,240
got MD5 sum. So to verify that package
9514
06:21:56,160 --> 06:22:01,440
has not been changed from the source to
9515
06:21:58,240 --> 06:22:03,600
your machine we use MD5 and then to
9516
06:22:01,440 --> 06:22:07,120
authenticate that whether it is from
9517
06:22:03,600 --> 06:22:09,680
correct source and there's no one behind
9518
06:22:07,120 --> 06:22:12,480
the source and IP spoofing it and
9519
06:22:09,680 --> 06:22:15,200
getting into your system you need GPG
9520
06:22:12,480 --> 06:22:18,240
key so you take a GPG key from that
9521
06:22:15,200 --> 06:22:21,120
machine then install it authentication
9522
06:22:18,240 --> 06:22:23,600
source archives is also available which
9523
06:22:21,120 --> 06:22:25,760
helps in authentication so you helps
9524
06:22:23,600 --> 06:22:27,360
helps in patches also. Patches can be
9525
06:22:25,760 --> 06:22:30,400
applied which helps in updating the
9526
06:22:27,360 --> 06:22:33,040
process faster and easier. So if you
9527
06:22:30,400 --> 06:22:35,440
have patches you don't have to reinstall
9528
06:22:33,040 --> 06:22:37,680
your system. You just have to change
9529
06:22:35,440 --> 06:22:40,798
particular some few files and just to
9530
06:22:37,680 --> 06:22:42,718
rebuild it, restart it. It's not that
9531
06:22:40,798 --> 06:22:44,878
you again going to compile your whole
9532
06:22:42,718 --> 06:22:47,440
program and then going to restart. It is
9533
06:22:44,878 --> 06:22:49,440
automated and installation time
9534
06:22:47,440 --> 06:22:51,680
verification. It is done for the
9535
06:22:49,440 --> 06:22:54,958
dependencies like if I have got a
9536
06:22:51,680 --> 06:22:57,920
package and it is dependent on 15 or 20
9537
06:22:54,958 --> 06:23:00,400
different other packages. So it asks you
9538
06:22:57,920 --> 06:23:03,280
to download them to carry on with the
9539
06:23:00,400 --> 06:23:06,400
installation of your current package. So
9540
06:23:03,280 --> 06:23:09,120
basic tasks for RP is the basic task for
9541
06:23:06,400 --> 06:23:11,920
any package manager installation
9542
06:23:09,120 --> 06:23:14,638
updation uninstallation query and
9543
06:23:11,920 --> 06:23:16,798
authentication. So we need to check how
9544
06:23:14,638 --> 06:23:19,520
to install a particular package, how to
9545
06:23:16,798 --> 06:23:21,760
update an existing package, how to
9546
06:23:19,520 --> 06:23:23,760
remove the currently installed package,
9547
06:23:21,760 --> 06:23:26,638
get information about the package, what
9548
06:23:23,760 --> 06:23:28,558
is the version which it is using, things
9549
06:23:26,638 --> 06:23:30,878
which it depends on and then
9550
06:23:28,558 --> 06:23:33,280
authentication to verify the package for
9551
06:23:30,878 --> 06:23:35,440
the security reasons that the package is
9552
06:23:33,280 --> 06:23:38,480
from authenticated source. Red Hat
9553
06:23:35,440 --> 06:23:40,798
developed RPM packages can be found at
9554
06:23:38,480 --> 06:23:44,160
Red Hat Enterprise Linux CD rooms, Red
9555
06:23:40,798 --> 06:23:46,878
Hat network or Red Hat Erata page having
9556
06:23:44,160 --> 06:23:49,520
list of packages. So if you go to any of
9557
06:23:46,878 --> 06:23:51,920
this link on internet, I'm just going
9558
06:23:49,520 --> 06:23:54,320
over there and with I'm going to search
9559
06:23:51,920 --> 06:23:56,878
MySQL. So it gives me all the versions
9560
06:23:54,320 --> 06:24:01,360
of the MySQL. So it suggest that it has
9561
06:23:56,878 --> 06:24:04,160
found 95 RPMs very old ones 5.0 since
9562
06:24:01,360 --> 06:24:06,798
2009. So we can see there are the
9563
06:24:04,160 --> 06:24:11,040
packages MySQL client programs and C
9564
06:24:06,798 --> 06:24:14,718
libraries for 64bit machines. This one
9565
06:24:11,040 --> 06:24:18,160
is for 32-bit machine. I386 for i686.
9566
06:24:14,718 --> 06:24:20,240
x86 64 is for 64-bit architectured
9567
06:24:18,160 --> 06:24:22,080
machines. So there are different RPMs
9568
06:24:20,240 --> 06:24:25,120
for different machines. Now how to
9569
06:24:22,080 --> 06:24:28,878
install? So to install minus I is the
9570
06:24:25,120 --> 06:24:30,958
option but we probably go for V also
9571
06:24:28,878 --> 06:24:32,638
because it is the verbose mode and it
9572
06:24:30,958 --> 06:24:35,280
suggest that okay something is going on
9573
06:24:32,638 --> 06:24:38,320
because if you just install any RPM
9574
06:24:35,280 --> 06:24:40,558
package with RPM minus I it will be
9575
06:24:38,320 --> 06:24:43,200
installing it but there will be no
9576
06:24:40,558 --> 06:24:46,798
status bar in it that okay 100% this is
9577
06:24:43,200 --> 06:24:48,480
now 10% 20% 50% 100%. So to get that
9578
06:24:46,798 --> 06:24:51,120
feel that okay your software is being
9579
06:24:48,480 --> 06:24:54,160
updated or software is being installed
9580
06:24:51,120 --> 06:24:56,878
use verbose also and then print hash
9581
06:24:54,160 --> 06:25:00,878
marks of the package archive as as it is
9582
06:24:56,878 --> 06:25:05,040
unpacked we use minus h ussually we use
9583
06:25:00,878 --> 06:25:07,120
minus ih now check the rpm signature to
9584
06:25:05,040 --> 06:25:09,920
check the signature we have this command
9585
06:25:07,120 --> 06:25:11,840
minus minus check sig so it checks the
9586
06:25:09,920 --> 06:25:14,878
pgp signature before installing any
9587
06:25:11,840 --> 06:25:17,440
package if its integrity and origin is
9588
06:25:14,878 --> 06:25:20,558
Okay, because at the back background it
9589
06:25:17,440 --> 06:25:23,440
checks for your MD5 sum as well as your
9590
06:25:20,558 --> 06:25:25,600
GPG key. So if integrity and origin is
9591
06:25:23,440 --> 06:25:28,000
okay then one can go ahead install that
9592
06:25:25,600 --> 06:25:31,360
package. If you have any query on that
9593
06:25:28,000 --> 06:25:33,520
package minus q is the option. So it is
9594
06:25:31,360 --> 06:25:36,000
pretty straightforward till now. If you
9595
06:25:33,520 --> 06:25:38,480
want to have a query on package it's
9596
06:25:36,000 --> 06:25:39,840
minus q. If you want to install that's
9597
06:25:38,480 --> 06:25:42,400
little bit different when you want to
9598
06:25:39,840 --> 06:25:44,718
uninstall a package it is like eradicate
9599
06:25:42,400 --> 06:25:46,878
minus. So we will come up to that. It
9600
06:25:44,718 --> 06:25:48,878
checks the dependencies of the package.
9601
06:25:46,878 --> 06:25:51,440
If package is dependent on some other
9602
06:25:48,878 --> 06:25:54,878
packages to ignore these dependencies,
9603
06:25:51,440 --> 06:25:58,080
use minus minus node depths. So rp minus
9604
06:25:54,878 --> 06:26:00,240
q - node depths and the package name.
9605
06:25:58,080 --> 06:26:03,120
One can check if a particular package is
9606
06:26:00,240 --> 06:26:06,798
already installed or not. To do that
9607
06:26:03,120 --> 06:26:08,878
just add minus l. So minus l is for list
9608
06:26:06,798 --> 06:26:11,920
all the installed packages. So if it is
9609
06:26:08,878 --> 06:26:14,160
installed rpm minusql. Now to install
9610
06:26:11,920 --> 06:26:16,638
all the packages which are there to view
9611
06:26:14,160 --> 06:26:20,000
all the installed packages use minus
9612
06:26:16,638 --> 06:26:21,760
command. So RPM minus QA. So one can
9613
06:26:20,000 --> 06:26:24,240
list all the recently installed RPM
9614
06:26:21,760 --> 06:26:26,320
packages. One can shorten the list to
9615
06:26:24,240 --> 06:26:28,718
check for recently installed by adding
9616
06:26:26,320 --> 06:26:30,798
minus minus last which will return the
9617
06:26:28,718 --> 06:26:33,520
last package installed on the machine.
9618
06:26:30,798 --> 06:26:36,958
Upgrade up a package. You need to do it
9619
06:26:33,520 --> 06:26:40,320
minus u rpm minus uvh. V is again for
9620
06:26:36,958 --> 06:26:42,160
purpose and h for hash. So I minus uvh
9621
06:26:40,320 --> 06:26:44,240
and then your package will be upgraded.
9622
06:26:42,160 --> 06:26:46,718
Now to remove a package as we have
9623
06:26:44,240 --> 06:26:49,680
discussed it is minus e rather than
9624
06:26:46,718 --> 06:26:52,000
minus r or minus uninstall. So it is
9625
06:26:49,680 --> 06:26:54,558
like eradicate. To remove a package use
9626
06:26:52,000 --> 06:26:56,958
minus e option. In case you don't want
9627
06:26:54,558 --> 06:26:59,600
to remove the dependent packages you
9628
06:26:56,958 --> 06:27:02,240
just want to remove your package then
9629
06:26:59,600 --> 06:27:04,240
apply minus minus node deps in it. To
9630
06:27:02,240 --> 06:27:07,360
find the package to which particular
9631
06:27:04,240 --> 06:27:09,920
file belongs to use minus f in your
9632
06:27:07,360 --> 06:27:11,360
query. So f will give you file name. To
9633
06:27:09,920 --> 06:27:14,478
find the details about a particular
9634
06:27:11,360 --> 06:27:17,360
installed package again rpm minus 2 i
9635
06:27:14,478 --> 06:27:20,240
and the package name to verify an rpm
9636
06:27:17,360 --> 06:27:22,798
package use minus capital v p option
9637
06:27:20,240 --> 06:27:26,080
because small p v is for verbose. So use
9638
06:27:22,798 --> 06:27:28,798
minus hyphen capital v option. RPM
9639
06:27:26,080 --> 06:27:30,878
capital V P and package name will give
9640
06:27:28,798 --> 06:27:33,920
you the verification of the package. So
9641
06:27:30,878 --> 06:27:36,400
to verify all the packages use A rather
9642
06:27:33,920 --> 06:27:39,040
than P just remove P because P is for
9643
06:27:36,400 --> 06:27:40,798
specific package name. If you go for A
9644
06:27:39,040 --> 06:27:43,680
it will verify all the packages in the
9645
06:27:40,798 --> 06:27:46,240
system. So this RPM demo can be done on
9646
06:27:43,680 --> 06:27:48,798
CentOS or Fedora machine. Right now in
9647
06:27:46,240 --> 06:27:51,680
our setup you're using one. So let's
9648
06:27:48,798 --> 06:27:54,718
check it out how it is being done. So if
9649
06:27:51,680 --> 06:27:58,320
I'm going to install RPM minus IVH, you
9650
06:27:54,718 --> 06:28:02,478
can see those hashtags coming. So if
9651
06:27:58,320 --> 06:28:04,878
you're not using minus vh in there or h
9652
06:28:02,478 --> 06:28:07,040
is in there these will not be coming to
9653
06:28:04,878 --> 06:28:09,520
verify whether a package is there in the
9654
06:28:07,040 --> 06:28:12,320
files or not just use rpm minus minus
9655
06:28:09,520 --> 06:28:13,840
verify to query on a particular package
9656
06:28:12,320 --> 06:28:17,760
that what are the things which are there
9657
06:28:13,840 --> 06:28:20,400
in the package rpm minusql httpd. So we
9658
06:28:17,760 --> 06:28:23,040
know that httpd is there for hosting web
9659
06:28:20,400 --> 06:28:24,958
servers. So this is if you go to etc
9660
06:28:23,040 --> 06:28:26,798
folder this is how it looks when it is
9661
06:28:24,958 --> 06:28:29,200
being installed. So it gives you all the
9662
06:28:26,798 --> 06:28:32,718
files which is packaged in the RPM
9663
06:28:29,200 --> 06:28:35,760
folder and inside any RPM. Now let's
9664
06:28:32,718 --> 06:28:38,798
talk about Yum. So RPM was the package
9665
06:28:35,760 --> 06:28:40,400
manager. Yum is again the another which
9666
06:28:38,798 --> 06:28:43,520
is being used in the free versions of
9667
06:28:40,400 --> 06:28:46,080
the CentOS. So if you don't have that
9668
06:28:43,520 --> 06:28:48,240
RPM files and you want to install from
9669
06:28:46,080 --> 06:28:50,958
the source repository which you are not
9670
06:28:48,240 --> 06:28:54,000
because in RPM files you need to have
9671
06:28:50,958 --> 06:28:56,000
that RPM downloaded. If you don't want
9672
06:28:54,000 --> 06:28:58,080
to download RPM, you don't want to take
9673
06:28:56,000 --> 06:29:00,638
that headache of downloading. RPM from
9674
06:28:58,080 --> 06:29:04,240
internet, what you can use is you can
9675
06:29:00,638 --> 06:29:07,440
use yum. So yum was created in 2003 and
9676
06:29:04,240 --> 06:29:10,400
is primary choice for RPM based dro. So
9677
06:29:07,440 --> 06:29:13,280
wherever we are using RPM based dro like
9678
06:29:10,400 --> 06:29:16,718
Santos, Fedora, Yum is the repository
9679
06:29:13,280 --> 06:29:18,878
for it. We tend to do in Yum is we just
9680
06:29:16,718 --> 06:29:20,798
write the package name which we
9681
06:29:18,878 --> 06:29:23,600
understand. So I don't know the version
9682
06:29:20,798 --> 06:29:26,798
of my SQL. I just go for yum install
9683
06:29:23,600 --> 06:29:29,520
MySQL. It will search whether MySQL is
9684
06:29:26,798 --> 06:29:32,240
there in the repository. It will come up
9685
06:29:29,520 --> 06:29:35,120
with a specific version number. It will
9686
06:29:32,240 --> 06:29:37,760
suggest okay, it is there. Install it
9687
06:29:35,120 --> 06:29:40,000
via this command. When you do that, you
9688
06:29:37,760 --> 06:29:42,400
don't know where that RPM package is
9689
06:29:40,000 --> 06:29:44,798
kept or whether even RPM package is kept
9690
06:29:42,400 --> 06:29:47,200
or not. It automatically downloads that
9691
06:29:44,798 --> 06:29:50,240
package and installs it. So, installing
9692
06:29:47,200 --> 06:29:52,478
and updating the packages are simpler.
9693
06:29:50,240 --> 06:29:54,558
software dependencies are taken care of
9694
06:29:52,478 --> 06:29:56,958
and installed along with it because if
9695
06:29:54,558 --> 06:29:59,440
we are using RPM package we have to
9696
06:29:56,958 --> 06:30:02,080
install all those dependency by ourself
9697
06:29:59,440 --> 06:30:04,958
but in yum it is just like appgget it
9698
06:30:02,080 --> 06:30:08,320
will install all those dependencies. So
9699
06:30:04,958 --> 06:30:11,520
we have two things RPM and yum the same
9700
06:30:08,320 --> 06:30:15,040
thing which rpm and yum is is almost
9701
06:30:11,520 --> 06:30:17,280
synonym to dpkg and aptgate. So if you
9702
06:30:15,040 --> 06:30:20,878
want any package to be installed
9703
06:30:17,280 --> 06:30:24,400
manually in Ubuntu or any Dia Linux DBN
9704
06:30:20,878 --> 06:30:26,878
dro what we tend to do is we use DPG
9705
06:30:24,400 --> 06:30:30,080
command to install it and the extension
9706
06:30:26,878 --> 06:30:32,958
of the file is dep similar to what we
9707
06:30:30,080 --> 06:30:36,400
have in sent to us where we use the same
9708
06:30:32,958 --> 06:30:39,600
mechanism we use RPM minus IB and the
9709
06:30:36,400 --> 06:30:43,280
extension of the file is RPM and in the
9710
06:30:39,600 --> 06:30:44,080
same way the Y has replaced RPM to some
9711
06:30:43,280 --> 06:30:47,040
extent
9712
06:30:44,080 --> 06:30:50,240
Appgate has replaced DPKG to some
9713
06:30:47,040 --> 06:30:52,320
extent. So let's talk about Yum first.
9714
06:30:50,240 --> 06:30:55,360
The software dependencies are taken care
9715
06:30:52,320 --> 06:30:58,320
of and installed along with it. Yum is
9716
06:30:55,360 --> 06:31:01,360
primarily in command line interface but
9717
06:30:58,320 --> 06:31:03,520
GUI based wrappers also exist but it is
9718
06:31:01,360 --> 06:31:05,440
pretty simple in command line interface.
9719
06:31:03,520 --> 06:31:07,680
It's easy to use in command line
9720
06:31:05,440 --> 06:31:11,360
interface. It is the official package
9721
06:31:07,680 --> 06:31:13,200
manager of Red Hat and CentOS. So RPM is
9722
06:31:11,360 --> 06:31:16,000
there but this is the official package
9723
06:31:13,200 --> 06:31:18,718
manager. This is the package manager. So
9724
06:31:16,000 --> 06:31:21,280
RPM and Yum. RPM is the package manager
9725
06:31:18,718 --> 06:31:23,600
which installs the package while Yum is
9726
06:31:21,280 --> 06:31:26,798
the repository management tool which
9727
06:31:23,600 --> 06:31:29,280
will fetch the package. So to get MySQL
9728
06:31:26,798 --> 06:31:32,400
installed you need to find it on
9729
06:31:29,280 --> 06:31:34,878
internet where you can get RPM files.
9730
06:31:32,400 --> 06:31:37,120
But if you want to install it via you
9731
06:31:34,878 --> 06:31:38,958
don't need file. go yourself take the
9732
06:31:37,120 --> 06:31:42,558
pain by yourself and search it on
9733
06:31:38,958 --> 06:31:44,638
internet where the profile is downloaded
9734
06:31:42,558 --> 06:31:46,798
and then install it. So you don't need
9735
06:31:44,638 --> 06:31:49,200
to do that in the in here you just need
9736
06:31:46,798 --> 06:31:51,520
to list the files okay whether it is
9737
06:31:49,200 --> 06:31:53,920
listed or not if it is there in the
9738
06:31:51,520 --> 06:31:55,840
source repository you can install it and
9739
06:31:53,920 --> 06:31:58,320
you don't need to know what was the
9740
06:31:55,840 --> 06:32:00,798
source of it where it has installed that
9741
06:31:58,320 --> 06:32:03,200
headache is of yum repository yum
9742
06:32:00,798 --> 06:32:05,680
fetches appropriate package as required
9743
06:32:03,200 --> 06:32:08,958
by our our Linux which is compatible
9744
06:32:05,680 --> 06:32:12,878
with our Linux in RBM it can be that I
9745
06:32:08,958 --> 06:32:17,840
have like in centus 7 the default python
9746
06:32:12,878 --> 06:32:20,878
version is 2.7 but by mistake I go and I
9747
06:32:17,840 --> 06:32:23,200
don't use yum I install it via RPM and
9748
06:32:20,878 --> 06:32:25,280
install Python version 2.4 4 which is a
9749
06:32:23,200 --> 06:32:28,160
very old version so it is not
9750
06:32:25,280 --> 06:32:30,798
compatible. So to not to take care which
9751
06:32:28,160 --> 06:32:32,478
is not to take headache of what is the
9752
06:32:30,798 --> 06:32:35,360
compatible version of the software with
9753
06:32:32,478 --> 06:32:37,760
this Linux distro it is advisable to use
9754
06:32:35,360 --> 06:32:39,760
the repository manager. RPM can alert
9755
06:32:37,760 --> 06:32:43,040
you to dependencies but is unable to
9756
06:32:39,760 --> 06:32:45,040
source additional packages. So in RPM it
9757
06:32:43,040 --> 06:32:48,320
will check these are the dependencies
9758
06:32:45,040 --> 06:32:51,200
which need to be taken care of. It will
9759
06:32:48,320 --> 06:32:53,280
invoke a alert to you that you need to
9760
06:32:51,200 --> 06:32:55,360
install these packages first but it will
9761
06:32:53,280 --> 06:32:57,840
not give you the source directory or
9762
06:32:55,360 --> 06:33:00,798
source from where to get these services
9763
06:32:57,840 --> 06:33:03,360
or these packages. But yum finds out all
9764
06:33:00,798 --> 06:33:05,040
the dependencies and also the additional
9765
06:33:03,360 --> 06:33:08,400
packages installs them if you're
9766
06:33:05,040 --> 06:33:10,958
installing any package v. Yum by default
9767
06:33:08,400 --> 06:33:12,958
has multiple repository location in its
9768
06:33:10,958 --> 06:33:15,520
configuration file and it fetches
9769
06:33:12,958 --> 06:33:18,638
packages for installation. So how to
9770
06:33:15,520 --> 06:33:21,040
install using yum? Use command install
9771
06:33:18,638 --> 06:33:23,760
to install a package using yum. So if I
9772
06:33:21,040 --> 06:33:26,400
need to install anything just do yum
9773
06:33:23,760 --> 06:33:29,520
install python. I don't need to give the
9774
06:33:26,400 --> 06:33:34,320
version of it. If I'm going to use 2.4
9775
06:33:29,520 --> 06:33:37,200
2.6 like by default in py centtos 5 2.4
9776
06:33:34,320 --> 06:33:41,040
was there by default 2.6 was there in
9777
06:33:37,200 --> 06:33:44,478
centto 6. Now in centtos 7 it is 2.7.
9778
06:33:41,040 --> 06:33:47,680
But if you want to go for 3.5 3.6 6 or
9779
06:33:44,478 --> 06:33:50,958
3.7 of version of Python you need RBM
9780
06:33:47,680 --> 06:33:53,520
for that but via Yum repository or you
9781
06:33:50,958 --> 06:33:55,760
need to tweak Yum repository a bit you
9782
06:33:53,520 --> 06:33:58,160
need to go to the yum source repository
9783
06:33:55,760 --> 06:34:00,558
d and then tweak go over there so the
9784
06:33:58,160 --> 06:34:02,958
first syntax is yum install python it
9785
06:34:00,558 --> 06:34:04,558
will ask you if you are interested to
9786
06:34:02,958 --> 06:34:07,440
install this package or not just
9787
06:34:04,558 --> 06:34:09,440
question on it if you don't want if you
9788
06:34:07,440 --> 06:34:12,240
are writing a cell script and you want
9789
06:34:09,440 --> 06:34:14,320
it to be installed by itself just insert
9790
06:34:12,240 --> 06:34:16,718
minus y command the same thing happens
9791
06:34:14,320 --> 06:34:20,000
with appgget 2. Same thing happens with
9792
06:34:16,718 --> 06:34:22,000
yum 2. y minus y install package name
9793
06:34:20,000 --> 06:34:24,558
python. It will be installed and it will
9794
06:34:22,000 --> 06:34:27,120
suppress the confirmation question and
9795
06:34:24,558 --> 06:34:29,040
it will take the input as yes that okay
9796
06:34:27,120 --> 06:34:32,160
yes has been already been provided
9797
06:34:29,040 --> 06:34:35,040
install it automatically to remove yum
9798
06:34:32,160 --> 06:34:37,520
remove package name and again to provide
9799
06:34:35,040 --> 06:34:39,680
confirmation and suppress the
9800
06:34:37,520 --> 06:34:43,920
confirmation and automatically do is it
9801
06:34:39,680 --> 06:34:45,760
yum minus y then list package names. So
9802
06:34:43,920 --> 06:34:47,360
if you want to check whe the specific
9803
06:34:45,760 --> 06:34:50,400
package is there in the source
9804
06:34:47,360 --> 06:34:52,240
repository or not yum list any specific
9805
06:34:50,400 --> 06:34:55,760
package name. So it is checking for open
9806
06:34:52,240 --> 06:34:58,160
s which is my SSH server which listens
9807
06:34:55,760 --> 06:34:59,920
on port 22 and if you want to connect
9808
06:34:58,160 --> 06:35:02,558
from one machine to another there is a
9809
06:34:59,920 --> 06:35:04,718
service called user bin SSH.
9810
06:35:02,558 --> 06:35:06,718
So that enables you to SSH from one
9811
06:35:04,718 --> 06:35:09,440
machine to another machine which we just
9812
06:35:06,718 --> 06:35:12,000
had example of SSH username at the rate
9813
06:35:09,440 --> 06:35:13,680
your machine name IP. So that's the
9814
06:35:12,000 --> 06:35:17,200
package we are searching for. Yum list
9815
06:35:13,680 --> 06:35:19,680
open SSH. So to list all the available
9816
06:35:17,200 --> 06:35:22,798
packages installed use installed keyword
9817
06:35:19,680 --> 06:35:24,718
yum list installed and if you want to
9818
06:35:22,798 --> 06:35:28,558
check all the packages which are there
9819
06:35:24,718 --> 06:35:31,440
in yum repository just write down yum
9820
06:35:28,558 --> 06:35:33,360
list. Use command if you want to search
9821
06:35:31,440 --> 06:35:35,360
any package use command search to find
9822
06:35:33,360 --> 06:35:37,920
all available packages to match the name
9823
06:35:35,360 --> 06:35:39,680
of package specified. If I don't know
9824
06:35:37,920 --> 06:35:43,200
the exact version of it or exact name of
9825
06:35:39,680 --> 06:35:45,040
it, yum search SSH or open SSH anything.
9826
06:35:43,200 --> 06:35:47,040
So it provides the exact package name
9827
06:35:45,040 --> 06:35:48,958
which needs to be installed to find
9828
06:35:47,040 --> 06:35:51,200
which package provides a particular file
9829
06:35:48,958 --> 06:35:52,638
because if you are seeing some file in a
9830
06:35:51,200 --> 06:35:56,878
system which you haven't created and it
9831
06:35:52,638 --> 06:35:59,680
is there by some package. You can search
9832
06:35:56,878 --> 06:36:02,878
the originator package for the file name
9833
06:35:59,680 --> 06:36:05,200
using command yum provides file name.
9834
06:36:02,878 --> 06:36:07,360
again for updating any specific package
9835
06:36:05,200 --> 06:36:09,920
for right now I have using Python 2.6
9836
06:36:07,360 --> 06:36:12,558
six I want to update to Python 2.7 yum
9837
06:36:09,920 --> 06:36:14,478
update package name if that update is
9838
06:36:12,558 --> 06:36:16,400
available there it will update it
9839
06:36:14,478 --> 06:36:18,240
automatically and to check update for
9840
06:36:16,400 --> 06:36:21,360
which packages are available you can
9841
06:36:18,240 --> 06:36:22,958
write command yum check update if you
9842
06:36:21,360 --> 06:36:25,120
want to update the whole system just
9843
06:36:22,958 --> 06:36:27,600
like Ubuntu update update and update
9844
06:36:25,120 --> 06:36:29,760
upgrade was there yum update is there in
9845
06:36:27,600 --> 06:36:32,798
sent to us to list all the enabled
9846
06:36:29,760 --> 06:36:35,200
repository in yum we use command repol
9847
06:36:32,798 --> 06:36:37,600
so to check what are the repositories
9848
06:36:35,200 --> 06:36:40,878
which are there in my rum yum source
9849
06:36:37,600 --> 06:36:43,040
directory yum repol list to view both
9850
06:36:40,878 --> 06:36:45,120
enabled and disabled one because few
9851
06:36:43,040 --> 06:36:47,760
repositories are commented. So to check
9852
06:36:45,120 --> 06:36:50,400
all those yum list all to install a
9853
06:36:47,760 --> 06:36:53,040
specific repository yum minus minus
9854
06:36:50,400 --> 06:36:55,200
enable repo the repository name which
9855
06:36:53,040 --> 06:36:57,840
was disabled. So enable that repo and
9856
06:36:55,200 --> 06:36:59,920
the package name. So to view all those
9857
06:36:57,840 --> 06:37:02,478
commands the other few commands in yum
9858
06:36:59,920 --> 06:37:04,558
are yum history check what are the
9859
06:37:02,478 --> 06:37:07,280
things which you have executed in yum
9860
06:37:04,558 --> 06:37:09,120
previously yum clean all. So it removes
9861
06:37:07,280 --> 06:37:11,520
all the caset packages and header
9862
06:37:09,120 --> 06:37:14,080
created to resolve the dependencies. Yum
9863
06:37:11,520 --> 06:37:16,160
group list which lists yum groups group
9864
06:37:14,080 --> 06:37:19,520
info group installed and then group
9865
06:37:16,160 --> 06:37:22,240
remove demo about the yum commands which
9866
06:37:19,520 --> 06:37:24,400
we have just gone through. So we have
9867
06:37:22,240 --> 06:37:27,440
search we have checked that to list a
9868
06:37:24,400 --> 06:37:29,200
package it was the command yum list. So
9869
06:37:27,440 --> 06:37:32,878
we are just listing the package with yum
9870
06:37:29,200 --> 06:37:36,160
list open ssh. Now it is going for all
9871
06:37:32,878 --> 06:37:38,718
the packages all the repository it has
9872
06:37:36,160 --> 06:37:42,798
probably it is going to FTP server of IT
9873
06:37:38,718 --> 06:37:44,878
Madras. So FTPATM.ac.in
9874
06:37:42,798 --> 06:37:49,120
and from there it is checking for the
9875
06:37:44,878 --> 06:37:51,440
open SSH update a package. So again yum
9876
06:37:49,120 --> 06:37:53,360
update open SSH was there. So if there
9877
06:37:51,440 --> 06:37:56,000
are any update available as per the
9878
06:37:53,360 --> 06:37:58,798
source repository it will update it.
9879
06:37:56,000 --> 06:38:02,160
Install a package. This is a pretty cool
9880
06:37:58,798 --> 06:38:04,798
package in Linux. It enables you to run
9881
06:38:02,160 --> 06:38:09,360
all those executables of C of Windows
9882
06:38:04,798 --> 06:38:12,400
machine. So XPR FIFA fan or NFS fan. So
9883
06:38:09,360 --> 06:38:16,080
you won't be able to get those things on
9884
06:38:12,400 --> 06:38:18,160
Linux distributions because FIFA or NFS
9885
06:38:16,080 --> 06:38:20,160
doesn't supports Linux distributions. So
9886
06:38:18,160 --> 06:38:22,638
if you want to run Linux distribution
9887
06:38:20,160 --> 06:38:25,680
too, you just need to install wine. The
9888
06:38:22,638 --> 06:38:28,320
wine application enables you to run exe
9889
06:38:25,680 --> 06:38:31,600
also. So actually these windows files
9890
06:38:28,320 --> 06:38:35,200
are executable formats exe format. So
9891
06:38:31,600 --> 06:38:37,680
wine enables you to run your exe files.
9892
06:38:35,200 --> 06:38:40,400
So what it has done is y install wine
9893
06:38:37,680 --> 06:38:42,958
and then it will be installed. So right
9894
06:38:40,400 --> 06:38:45,600
now yum history tells you about what are
9895
06:38:42,958 --> 06:38:48,240
the things which have been done in last
9896
06:38:45,600 --> 06:38:51,200
time. So it says that yum history has
9897
06:38:48,240 --> 06:38:54,478
got 34 commands in it. Last one was
9898
06:38:51,200 --> 06:38:57,520
install libx11 development package and
9899
06:38:54,478 --> 06:38:59,120
before that it was update. So access is
9900
06:38:57,520 --> 06:39:01,040
also defined. Date and time is also
9901
06:38:59,120 --> 06:39:04,080
defined. Now how to search for a
9902
06:39:01,040 --> 06:39:06,400
package? So it is yum search open ssh
9903
06:39:04,080 --> 06:39:08,478
which it has been done. It is now
9904
06:39:06,400 --> 06:39:10,638
searching for the package. What are the
9905
06:39:08,478 --> 06:39:12,718
packages available with the name open
9906
06:39:10,638 --> 06:39:14,320
ssh. You can see there are many
9907
06:39:12,718 --> 06:39:17,120
different packages which are available
9908
06:39:14,320 --> 06:39:20,400
for open ssh. Choose any one of them.
9909
06:39:17,120 --> 06:39:22,878
OpenSS server, open SSHS client, LDAP,
9910
06:39:20,400 --> 06:39:25,600
gsi based, pearlbased, anything which
9911
06:39:22,878 --> 06:39:27,840
you want. If you just want to open ss
9912
06:39:25,600 --> 06:39:30,320
server on your machine, install using
9913
06:39:27,840 --> 06:39:33,040
open sss server x8664.
9914
06:39:30,320 --> 06:39:36,000
Now let's get back to DPKG. Debian
9915
06:39:33,040 --> 06:39:38,478
packages. DPKG is the main package
9916
06:39:36,000 --> 06:39:41,680
management system in Debian and similar
9917
06:39:38,478 --> 06:39:44,798
oss. It is used to install, build,
9918
06:39:41,680 --> 06:39:48,320
remove and manage packages. package for
9919
06:39:44,798 --> 06:39:51,920
it has an extension of deb at the end.
9920
06:39:48,320 --> 06:39:54,558
PPKG is low-level tool. Apt is commonly
9921
06:39:51,920 --> 06:39:56,638
used as highle tool as it can deal with
9922
06:39:54,558 --> 06:39:59,440
complex tasks involved in package
9923
06:39:56,638 --> 06:40:02,878
manual. The DPKG database is located
9924
06:39:59,440 --> 06:40:05,920
under where lib dpkg. So dpkg is almost
9925
06:40:02,878 --> 06:40:08,718
similar to what rpm is there in centtos
9926
06:40:05,920 --> 06:40:11,360
and yum is similar to what is apt get is
9927
06:40:08,718 --> 06:40:13,760
there in ubuntu. So how to install?
9928
06:40:11,360 --> 06:40:17,280
Again just like RPM we used to install
9929
06:40:13,760 --> 06:40:20,400
via RPM minus I. So similarly DPKG minus
9930
06:40:17,280 --> 06:40:22,958
I package name. So if I have that DBN
9931
06:40:20,400 --> 06:40:24,958
package with me like if I need to do any
9932
06:40:22,958 --> 06:40:27,600
installation via RPM I need to have that
9933
06:40:24,958 --> 06:40:30,320
RPM package. So similarly I need to have
9934
06:40:27,600 --> 06:40:33,280
DVN package to be installed by DPKG. So
9935
06:40:30,320 --> 06:40:36,000
I'm installing Python 2.7 DBN. So DPKG
9936
06:40:33,280 --> 06:40:38,558
minus I Python 2.7 deb. So to check
9937
06:40:36,000 --> 06:40:40,478
whether your dpkg demon package has been
9938
06:40:38,558 --> 06:40:43,520
installed or not you can use command
9939
06:40:40,478 --> 06:40:45,120
dpkg minus s python. It will check if
9940
06:40:43,520 --> 06:40:47,040
the package is installed and if it is
9941
06:40:45,120 --> 06:40:49,840
installed it will return. Again to list
9942
06:40:47,040 --> 06:40:51,840
package tpkg minus l package name. If
9943
06:40:49,840 --> 06:40:54,320
you want to list all the packages don't
9944
06:40:51,840 --> 06:40:56,958
add the package name. If you just want
9945
06:40:54,320 --> 06:41:00,478
the content which is being used in
9946
06:40:56,958 --> 06:41:03,280
python 2.7 file like the last time which
9947
06:41:00,478 --> 06:41:06,080
we saw for httpd we list all the file
9948
06:41:03,280 --> 06:41:08,958
names of httpd. Similarly over here we
9949
06:41:06,080 --> 06:41:11,680
did that with RPM minus QF. Now in this
9950
06:41:08,958 --> 06:41:14,160
scenario we can do it with DPKG minus C.
9951
06:41:11,680 --> 06:41:17,360
To remove a package just like in RPM we
9952
06:41:14,160 --> 06:41:20,478
did by RPM minus E. We have got DPKG
9953
06:41:17,360 --> 06:41:21,920
minus R the package name. And now it is
9954
06:41:20,478 --> 06:41:24,160
not required to give the Debian
9955
06:41:21,920 --> 06:41:26,400
extension of it. Now installing the
9956
06:41:24,160 --> 06:41:28,080
packages from the directory itself. So
9957
06:41:26,400 --> 06:41:30,718
we need to install all the packages
9958
06:41:28,080 --> 06:41:32,878
which are there in the directory minus R
9959
06:41:30,718 --> 06:41:35,760
because it will install all the package
9960
06:41:32,878 --> 06:41:37,520
recursively. So use command minus r and
9961
06:41:35,760 --> 06:41:39,840
then minus minus install and the
9962
06:41:37,520 --> 06:41:41,280
directory name. So it will install all
9963
06:41:39,840 --> 06:41:43,520
the packages which are there in the
9964
06:41:41,280 --> 06:41:45,600
directory. So if you have got 15
9965
06:41:43,520 --> 06:41:47,920
packages which you need to install, you
9966
06:41:45,600 --> 06:41:49,920
can do this. You can put all those 15
9967
06:41:47,920 --> 06:41:52,160
packages in the directory and then
9968
06:41:49,920 --> 06:41:53,840
install recursively using directory. You
9969
06:41:52,160 --> 06:41:55,440
don't need to give name of each and
9970
06:41:53,840 --> 06:41:57,840
every package at the time of the
9971
06:41:55,440 --> 06:42:00,478
installation. Now to update a package
9972
06:41:57,840 --> 06:42:03,360
like we have to update Python you need
9973
06:42:00,478 --> 06:42:06,878
to do dpkg minus u a specific package
9974
06:42:03,360 --> 06:42:10,638
name. Now let's check the demo. So gpkg
9975
06:42:06,878 --> 06:42:14,000
minus s python. Now let's check the dpkg
9976
06:42:10,638 --> 06:42:16,240
minus s python. So it suggest python is
9977
06:42:14,000 --> 06:42:18,718
not installed and has got no information
9978
06:42:16,240 --> 06:42:21,280
on it because this file has not been
9979
06:42:18,718 --> 06:42:23,920
installed using debian package. If I ask
9980
06:42:21,280 --> 06:42:26,400
app to install python for me, it will
9981
06:42:23,920 --> 06:42:29,400
check and install the python version to
9982
06:42:26,400 --> 06:42:29,400
2.7.
9983
06:42:30,080 --> 06:42:35,120
So now I have installed python 2.7. It
9984
06:42:32,638 --> 06:42:37,360
is unpacking and linking all those
9985
06:42:35,120 --> 06:42:40,718
libraries and processing things up for
9986
06:42:37,360 --> 06:42:42,558
me. Now let's do py dpkg. The thing
9987
06:42:40,718 --> 06:42:44,718
which I have done is dpkg minus s
9988
06:42:42,558 --> 06:42:47,360
python. Now it suggests package name is
9989
06:42:44,718 --> 06:42:50,160
python. Status installed. Okay,
9990
06:42:47,360 --> 06:42:51,600
installed. Priority is optional. It
9991
06:42:50,160 --> 06:42:53,600
gives all the information about the
9992
06:42:51,600 --> 06:42:55,360
package. I have done it get because I
9993
06:42:53,600 --> 06:42:58,558
don't have the tpn package right now
9994
06:42:55,360 --> 06:43:00,878
with me. So now dpkg minus l python.
9995
06:42:58,558 --> 06:43:03,200
Let's run this command and check what
9996
06:43:00,878 --> 06:43:07,440
does it give. So it gives me the python
9997
06:43:03,200 --> 06:43:09,840
version of 2.7.15. Now let's get to apt
9998
06:43:07,440 --> 06:43:11,600
because you would be using app package
9999
06:43:09,840 --> 06:43:14,240
manager very frequently rather than
10000
06:43:11,600 --> 06:43:16,558
using dpkg. Appget is the command line
10001
06:43:14,240 --> 06:43:19,200
interface to handle package using app
10002
06:43:16,558 --> 06:43:21,200
library. Just like the yum library it we
10003
06:43:19,200 --> 06:43:25,200
used to have sent to us. We have got app
10004
06:43:21,200 --> 06:43:27,600
library in debian based dros Linux
10005
06:43:25,200 --> 06:43:30,080
distros. It is the default package
10006
06:43:27,600 --> 06:43:32,638
management system for debian like dros
10007
06:43:30,080 --> 06:43:35,040
like Ubuntu. It is an efficient way of
10008
06:43:32,638 --> 06:43:37,760
handling packages in your system. Rather
10009
06:43:35,040 --> 06:43:40,000
than using TPKG it is advisable to use
10010
06:43:37,760 --> 06:43:42,878
app because dependencies are managed
10011
06:43:40,000 --> 06:43:44,798
automatically. Upgrades and removals are
10012
06:43:42,878 --> 06:43:46,878
handled carefully to maintain the
10013
06:43:44,798 --> 06:43:49,440
stability of the system and it has an
10014
06:43:46,878 --> 06:43:51,600
external UI support with tools like
10015
06:43:49,440 --> 06:43:53,120
synaptic aptitude. But right now we are
10016
06:43:51,600 --> 06:43:55,600
not using any tool like synaptic or
10017
06:43:53,120 --> 06:43:57,760
aptitude. We going via command line
10018
06:43:55,600 --> 06:44:00,558
interface. Now let's understand few
10019
06:43:57,760 --> 06:44:02,558
commands first. App cacher app cacher is
10020
06:44:00,558 --> 06:44:05,440
a command line interface to search for
10021
06:44:02,558 --> 06:44:07,840
app software packages. This tool is used
10022
06:44:05,440 --> 06:44:10,240
to search software packages and get
10023
06:44:07,840 --> 06:44:12,878
information about them. One can search
10024
06:44:10,240 --> 06:44:14,718
for a package without having exact name
10025
06:44:12,878 --> 06:44:17,280
of the package. If you even have some
10026
06:44:14,718 --> 06:44:19,280
pattern of it, you can get it from the
10027
06:44:17,280 --> 06:44:22,320
app cachet. The data is fetched from
10028
06:44:19,280 --> 06:44:26,160
different sources listed in sources list
10029
06:44:22,320 --> 06:44:28,320
file. So as we saw in yum yum repo list
10030
06:44:26,160 --> 06:44:30,478
was there. Similarly, we have app get
10031
06:44:28,320 --> 06:44:32,558
source list over here. So it has got a
10032
06:44:30,478 --> 06:44:35,280
number of links from where it searches
10033
06:44:32,558 --> 06:44:37,760
for its packages and installs it. where
10034
06:44:35,280 --> 06:44:40,320
cache app archives contains already
10035
06:44:37,760 --> 06:44:42,718
downloaded packages to avoid downloading
10036
06:44:40,320 --> 06:44:45,920
them again. If one needs to reinstall a
10037
06:44:42,718 --> 06:44:47,920
package after removing it. So now uses
10038
06:44:45,920 --> 06:44:49,440
of some of the app caching command. How
10039
06:44:47,920 --> 06:44:52,160
to list and search a package using app
10040
06:44:49,440 --> 06:44:53,920
caching? Use command package names to
10041
06:44:52,160 --> 06:44:57,040
list package starting with particular
10042
06:44:53,920 --> 06:44:58,478
string. So example if you just want to
10043
06:44:57,040 --> 06:45:01,440
search all the packages which are
10044
06:44:58,478 --> 06:45:04,320
starting with open might it be open SSL
10045
06:45:01,440 --> 06:45:07,520
might it be open SSH anything what you
10046
06:45:04,320 --> 06:45:10,558
need to do is apt cache package names
10047
06:45:07,520 --> 06:45:13,280
and open open SSL or Python anything so
10048
06:45:10,558 --> 06:45:14,718
that will fetch all the package names
10049
06:45:13,280 --> 06:45:17,200
you search for a package with a
10050
06:45:14,718 --> 06:45:19,760
particular name apt cass search python
10051
06:45:17,200 --> 06:45:22,400
use command show to get details about a
10052
06:45:19,760 --> 06:45:24,240
package if I want to get all the details
10053
06:45:22,400 --> 06:45:26,798
about specific package I would use apt
10054
06:45:24,240 --> 06:45:29,120
Caches show Python check the dependency
10055
06:45:26,798 --> 06:45:30,878
of a package like if I install Python
10056
06:45:29,120 --> 06:45:33,200
what are the other packages which will
10057
06:45:30,878 --> 06:45:35,840
be installed which are required in
10058
06:45:33,200 --> 06:45:38,000
support of Python to enable Python to
10059
06:45:35,840 --> 06:45:40,400
run. What are the other packages which
10060
06:45:38,000 --> 06:45:42,718
are required to run? We can get that via
10061
06:45:40,400 --> 06:45:45,840
app caches show package Python. Now to
10062
06:45:42,718 --> 06:45:47,680
update a package use app get update
10063
06:45:45,840 --> 06:45:50,000
specific package name. So if you are to
10064
06:45:47,680 --> 06:45:52,478
update Python we will be using app get
10065
06:45:50,000 --> 06:45:55,680
update Python. If we have to upgrade the
10066
06:45:52,478 --> 06:45:58,160
whole system app get update simple and
10067
06:45:55,680 --> 06:46:00,718
then if we want to install a package but
10068
06:45:58,160 --> 06:46:02,958
prevent from upgrading if already
10069
06:46:00,718 --> 06:46:05,520
installed use minus minus no upgrade
10070
06:46:02,958 --> 06:46:07,760
options. Now to install a package app
10071
06:46:05,520 --> 06:46:09,920
get install package name. It was for
10072
06:46:07,760 --> 06:46:12,160
updation. Now let's go how to install a
10073
06:46:09,920 --> 06:46:14,400
package. Rather than using update just
10074
06:46:12,160 --> 06:46:16,638
use app get install package name. If you
10075
06:46:14,400 --> 06:46:18,958
want to install multiple packages, app
10076
06:46:16,638 --> 06:46:22,638
get install multiple packages, Python,
10077
06:46:18,958 --> 06:46:24,400
MySQL, Open SSH, anything. And again,
10078
06:46:22,638 --> 06:46:26,558
you might need to provide minus Y with
10079
06:46:24,400 --> 06:46:29,520
it. In some of the previous version like
10080
06:46:26,558 --> 06:46:31,360
in 16.04, it used to ask for the
10081
06:46:29,520 --> 06:46:33,520
confirmation to install multiple
10082
06:46:31,360 --> 06:46:35,840
packages having a particular string use
10083
06:46:33,520 --> 06:46:37,360
wild card. So all the packages in the
10084
06:46:35,840 --> 06:46:39,840
source.list
10085
06:46:37,360 --> 06:46:41,280
which is having star name as regular
10086
06:46:39,840 --> 06:46:44,080
expression in it, it will install all
10087
06:46:41,280 --> 06:46:46,320
those packages. Now apppt get upgrade.
10088
06:46:44,080 --> 06:46:48,478
If you want to upgrade the system, you
10089
06:46:46,320 --> 06:46:50,320
can use command app get upgrade. It may
10090
06:46:48,478 --> 06:46:52,958
remove or update some of your installed
10091
06:46:50,320 --> 06:46:55,040
packages. If you want to upgrade only
10092
06:46:52,958 --> 06:46:57,680
some specific package of your system,
10093
06:46:55,040 --> 06:46:59,360
you can use appgget install python minus
10094
06:46:57,680 --> 06:47:01,680
minus will only upgrade python. It will
10095
06:46:59,360 --> 06:47:03,520
not upgrade its dependent packages. Now
10096
06:47:01,680 --> 06:47:05,760
if you want to remove app get remove
10097
06:47:03,520 --> 06:47:07,680
specific package name. If you want to
10098
06:47:05,760 --> 06:47:10,558
remove all the configuration files
10099
06:47:07,680 --> 06:47:12,638
associated with it, what app does is apt
10100
06:47:10,558 --> 06:47:14,478
stores the configuration file because in
10101
06:47:12,638 --> 06:47:15,520
future if you reinstall the package, you
10102
06:47:14,478 --> 06:47:17,120
don't have to take care of the
10103
06:47:15,520 --> 06:47:18,958
configuration again. But if you want to
10104
06:47:17,120 --> 06:47:21,120
remove configuration file along with
10105
06:47:18,958 --> 06:47:23,360
package, apt get remove minus minus
10106
06:47:21,120 --> 06:47:25,600
package. So removing a package doesn't
10107
06:47:23,360 --> 06:47:27,440
remove state configuration file to
10108
06:47:25,600 --> 06:47:30,798
remove configuration file along with it
10109
06:47:27,440 --> 06:47:32,478
append with purge option. Use command
10110
06:47:30,798 --> 06:47:34,080
download to download a package without
10111
06:47:32,478 --> 06:47:36,080
installing it. So if you are download
10112
06:47:34,080 --> 06:47:38,080
the package just get apt get download
10113
06:47:36,080 --> 06:47:40,160
python. So if you want to get into the
10114
06:47:38,080 --> 06:47:42,160
source code of any package because we
10115
06:47:40,160 --> 06:47:44,478
are using Linux distribution everything
10116
06:47:42,160 --> 06:47:47,200
is open source over here we can view
10117
06:47:44,478 --> 06:47:48,958
source code packages of any package. So
10118
06:47:47,200 --> 06:47:50,958
in that scenario we can use app get
10119
06:47:48,958 --> 06:47:53,360
source python. So it will unpack the
10120
06:47:50,958 --> 06:47:55,840
source code of the python. So to check
10121
06:47:53,360 --> 06:47:58,558
for the dependencies we can use command
10122
06:47:55,840 --> 06:48:00,798
apt get check. So if you have to check
10123
06:47:58,558 --> 06:48:03,680
the dependencies of Python packages
10124
06:48:00,798 --> 06:48:06,878
upgrade check Python to install build
10125
06:48:03,680 --> 06:48:08,400
dependencies use build options. So it is
10126
06:48:06,878 --> 06:48:10,400
there that whenever you are building
10127
06:48:08,400 --> 06:48:12,478
your product or any software where there
10128
06:48:10,400 --> 06:48:14,638
are many built dependencies of it to get
10129
06:48:12,478 --> 06:48:17,120
that apt get buildup Python. So let's
10130
06:48:14,638 --> 06:48:20,798
get into the demo of apt. So the first
10131
06:48:17,120 --> 06:48:24,000
thing is apt caches show package SSH. So
10132
06:48:20,798 --> 06:48:27,280
let's run it our own system. Apt caches
10133
06:48:24,000 --> 06:48:30,638
so package. Let us go for open SSH. So
10134
06:48:27,280 --> 06:48:33,200
it says there is no open SSH. Now we
10135
06:48:30,638 --> 06:48:35,360
have installed Python. Now it is showing
10136
06:48:33,200 --> 06:48:37,440
all the packages of the Python. A long
10137
06:48:35,360 --> 06:48:39,440
list. So what are the packages which has
10138
06:48:37,440 --> 06:48:41,440
it has installed? It has installed any
10139
06:48:39,440 --> 06:48:43,600
JSON that might be used for the JSON
10140
06:48:41,440 --> 06:48:46,878
conversion from dictionary to JSON in
10141
06:48:43,600 --> 06:48:49,440
Python. Mod Python modisgi. Modisi is
10142
06:48:46,878 --> 06:48:51,280
usually utilized for web servers. If
10143
06:48:49,440 --> 06:48:53,760
you're hosting your Python packages
10144
06:48:51,280 --> 06:48:56,160
online, Mod Visgy, Mod Python are being
10145
06:48:53,760 --> 06:48:58,080
used. So it lists all the packages which
10146
06:48:56,160 --> 06:49:01,120
are installed along with the Python
10147
06:48:58,080 --> 06:49:03,440
package. So rather than showing show
10148
06:49:01,120 --> 06:49:05,680
package, it is showing package names and
10149
06:49:03,440 --> 06:49:07,920
these are default commands. If I'm
10150
06:49:05,680 --> 06:49:10,000
writing package and using tab, it will
10151
06:49:07,920 --> 06:49:12,000
be giving package names by default. So
10152
06:49:10,000 --> 06:49:14,718
these are the package names which are
10153
06:49:12,000 --> 06:49:17,360
installed along with Python. So Python
10154
06:49:14,718 --> 06:49:19,600
RPM is there, cryptodoc is there, http
10155
06:49:17,360 --> 06:49:22,080
library is there, feed parser is there.
10156
06:49:19,600 --> 06:49:23,920
So there are many packages like that. We
10157
06:49:22,080 --> 06:49:27,360
have already seen how to install
10158
06:49:23,920 --> 06:49:30,160
package. Now check how to app get remove
10159
06:49:27,360 --> 06:49:32,958
minus minus purge python. So it is
10160
06:49:30,160 --> 06:49:35,040
asking me for yes or no. Let's do no.
10161
06:49:32,958 --> 06:49:37,280
And now what I will do is I'm just
10162
06:49:35,040 --> 06:49:39,520
appending minus y. Now it will not ask
10163
06:49:37,280 --> 06:49:40,798
me for yes or no. By default it has
10164
06:49:39,520 --> 06:49:42,638
taken that okay I have given a
10165
06:49:40,798 --> 06:49:44,878
confirmation for deletion of this
10166
06:49:42,638 --> 06:49:47,040
package as I have supplied minus y
10167
06:49:44,878 --> 06:49:49,600
command. If you can see the last line it
10168
06:49:47,040 --> 06:49:50,958
says purging configuration files. So all
10169
06:49:49,600 --> 06:49:53,360
the configuration files have been
10170
06:49:50,958 --> 06:49:56,320
deleted. Now let's try the previous
10171
06:49:53,360 --> 06:49:58,320
command app cacher package names. So you
10172
06:49:56,320 --> 06:50:00,638
can see even if I have not installed
10173
06:49:58,320 --> 06:50:03,040
these packages, these are getting from
10174
06:50:00,638 --> 06:50:05,200
the caches. It says that if you install
10175
06:50:03,040 --> 06:50:07,200
Python, these are the packages which
10176
06:50:05,200 --> 06:50:09,760
will be installed along with it. So you
10177
06:50:07,200 --> 06:50:11,840
don't need to install any package to
10178
06:50:09,760 --> 06:50:13,680
check what are the dependencies and what
10179
06:50:11,840 --> 06:50:16,080
are the files which will be installed if
10180
06:50:13,680 --> 06:50:19,040
I install Python. I'm going to install
10181
06:50:16,080 --> 06:50:22,478
app get install Python 3. So you can see
10182
06:50:19,040 --> 06:50:25,200
that I already have Python 3.6.5 in my
10183
06:50:22,478 --> 06:50:28,080
machine. So it is not installing Python
10184
06:50:25,200 --> 06:50:30,320
3 and it also suggest that few of the
10185
06:50:28,080 --> 06:50:34,080
packages are no more required this
10186
06:50:30,320 --> 06:50:37,520
Python 2.7. And if I run command app
10187
06:50:34,080 --> 06:50:40,000
auto remove it will clean my disk space.
10188
06:50:37,520 --> 06:50:43,040
It is suggesting that these packages are
10189
06:50:40,000 --> 06:50:44,638
no more required. Python 2, Python 2.7
10190
06:50:43,040 --> 06:50:46,638
minimal, Python minimal, lip python
10191
06:50:44,638 --> 06:50:50,080
standard library because I already have
10192
06:50:46,638 --> 06:50:51,920
Python 3.6.5 6.5 it's 18.04 2.7 is the
10193
06:50:50,080 --> 06:50:54,000
older version of it. So I don't need
10194
06:50:51,920 --> 06:50:57,440
these packages. Now I'm cleaning this
10195
06:50:54,000 --> 06:51:00,718
off. Let's try app get update. So you
10196
06:50:57,440 --> 06:51:03,760
can see it has gone to security.
10197
06:51:00,718 --> 06:51:05,600
Archive. Unbuntu.com. These are the
10198
06:51:03,760 --> 06:51:07,280
source list repositories which it has
10199
06:51:05,600 --> 06:51:09,840
and it is installing packages from
10200
06:51:07,280 --> 06:51:12,718
there. Now it is updating itself. It is
10201
06:51:09,840 --> 06:51:14,400
checking if any new version is there. It
10202
06:51:12,718 --> 06:51:16,320
will be updating itself. Now it is
10203
06:51:14,400 --> 06:51:18,718
reading the package list. Everything is
10204
06:51:16,320 --> 06:51:21,600
done. Similarly, if I want to upgrade,
10205
06:51:18,718 --> 06:51:23,920
it suggest me these many packages will
10206
06:51:21,600 --> 06:51:26,558
be upgraded if I run this command. So,
10207
06:51:23,920 --> 06:51:29,200
you can see how Linux community is
10208
06:51:26,558 --> 06:51:31,600
working. There's a lot huge community
10209
06:51:29,200 --> 06:51:34,000
and is working all day and there are
10210
06:51:31,600 --> 06:51:36,240
many updates coming every day. Now, it
10211
06:51:34,000 --> 06:51:38,320
has started upgrading it. So there are
10212
06:51:36,240 --> 06:51:40,320
commands like appgget check app get
10213
06:51:38,320 --> 06:51:43,320
install python with minus minus no
10214
06:51:40,320 --> 06:51:43,320
upgrade.
10215
06:51:47,280 --> 06:51:52,878
What is DNS? Well DNS stands for domain
10216
06:51:50,958 --> 06:51:55,280
name system and its main responsibility
10217
06:51:52,878 --> 06:51:57,520
is to translate internet domain and the
10218
06:51:55,280 --> 06:52:00,478
host names to IP addresses and vice
10219
06:51:57,520 --> 06:52:02,558
versa. Well, most of you might know that
10220
06:52:00,478 --> 06:52:05,280
every physical machine connected to the
10221
06:52:02,558 --> 06:52:07,520
internet is identified by an IP address.
10222
06:52:05,280 --> 06:52:09,600
But most of you might not know that
10223
06:52:07,520 --> 06:52:11,840
these IPs are unique only inside that
10224
06:52:09,600 --> 06:52:13,760
same domain. Right? And another fact
10225
06:52:11,840 --> 06:52:15,360
that you might not be aware of is that
10226
06:52:13,760 --> 06:52:18,000
when you type in a URL in your web
10227
06:52:15,360 --> 06:52:19,760
browser, then it uh you know
10228
06:52:18,000 --> 06:52:22,240
automatically gets converted to the
10229
06:52:19,760 --> 06:52:23,920
equivalent IP address of that server
10230
06:52:22,240 --> 06:52:25,680
which you're trying to access. Supposing
10231
06:52:23,920 --> 06:52:27,440
you're trying to access google.com, then
10232
06:52:25,680 --> 06:52:30,000
when you type in google.com in your
10233
06:52:27,440 --> 06:52:32,558
browser, then it would be automatically
10234
06:52:30,000 --> 06:52:34,798
converted to Google's IP address, right?
10235
06:52:32,558 --> 06:52:36,958
and only based on the IP address is the
10236
06:52:34,798 --> 06:52:39,120
system able to fetch Google's server and
10237
06:52:36,958 --> 06:52:42,600
display uh you know give you the results
10238
06:52:39,120 --> 06:52:42,600
on your screen.
10239
06:52:42,638 --> 06:52:47,520
Well, uh can anybody tell me why that
10240
06:52:45,040 --> 06:52:48,878
happens? Why do we do that? Why does
10241
06:52:47,520 --> 06:52:50,400
there why is there an internal
10242
06:52:48,878 --> 06:52:52,000
conversion into an IP address that
10243
06:52:50,400 --> 06:52:55,000
happens? Can anybody guess why that
10244
06:52:52,000 --> 06:52:55,000
happens?
10245
06:52:57,040 --> 06:53:02,240
Well, uh that is because uh the URL or
10246
06:52:59,920 --> 06:53:05,920
the fully qualified domain names like
10247
06:53:02,240 --> 06:53:07,840
google.com, facebook.com, yahoo.com, all
10248
06:53:05,920 --> 06:53:09,680
these uh.coms, right? These are the
10249
06:53:07,840 --> 06:53:11,760
addresses of any server or machine on
10250
06:53:09,680 --> 06:53:13,680
the internet. Okay? And uh they are
10251
06:53:11,760 --> 06:53:16,478
however only easy to remember by the
10252
06:53:13,680 --> 06:53:18,798
humans only for us. For computers
10253
06:53:16,478 --> 06:53:19,920
however it's easier to remember for them
10254
06:53:18,798 --> 06:53:21,760
it's easier to remember in the form of
10255
06:53:19,920 --> 06:53:23,760
IP addresses. So whatever we have
10256
06:53:21,760 --> 06:53:25,680
google.com has an equivalent IP address.
10257
06:53:23,760 --> 06:53:28,798
facebook.com has another equivalent IP
10258
06:53:25,680 --> 06:53:30,958
address. So every single uh site and
10259
06:53:28,798 --> 06:53:32,718
every single URL has an equivalent IP
10260
06:53:30,958 --> 06:53:35,120
address, right? They would be hosted on
10261
06:53:32,718 --> 06:53:37,680
a server and to access that server, you
10262
06:53:35,120 --> 06:53:39,920
have to access uh that server's IP
10263
06:53:37,680 --> 06:53:45,000
address. So that's how things work in
10264
06:53:39,920 --> 06:53:45,000
the background. And uh yeah
10265
06:53:46,160 --> 06:53:51,200
so this task of uh translating between
10266
06:53:48,718 --> 06:53:53,840
the IP addresses and the domain names is
10267
06:53:51,200 --> 06:53:55,840
what is done by this uh by this tool
10268
06:53:53,840 --> 06:53:58,240
called DNS. Okay. So the domain name
10269
06:53:55,840 --> 06:54:00,400
system does that and uh well it's a big
10270
06:53:58,240 --> 06:54:02,240
benefit and people nowadays might not
10271
06:54:00,400 --> 06:54:04,000
realize the thing okay any newcomers
10272
06:54:02,240 --> 06:54:06,240
might not know because without the
10273
06:54:04,000 --> 06:54:08,080
invention of uh DNS our lives would have
10274
06:54:06,240 --> 06:54:09,920
been very difficult because back in the
10275
06:54:08,080 --> 06:54:13,280
80s '90s at that time when we didn't
10276
06:54:09,920 --> 06:54:15,280
have the DNS then if we had to uh access
10277
06:54:13,280 --> 06:54:17,520
each and every website with the help of
10278
06:54:15,280 --> 06:54:19,600
just by giving the uh host name so for
10279
06:54:17,520 --> 06:54:22,478
example if I want to access google.com
10280
06:54:19,600 --> 06:54:24,558
back in the 80s or '90s right instead of
10281
06:54:22,478 --> 06:54:27,200
giving the IP address I if I had to give
10282
06:54:24,558 --> 06:54:29,200
the Google say google.com then I have to
10283
06:54:27,200 --> 06:54:30,718
specify this in the hosts file okay I
10284
06:54:29,200 --> 06:54:33,440
have to map the IP address and the host
10285
06:54:30,718 --> 06:54:35,360
name in the in the host file and doing
10286
06:54:33,440 --> 06:54:37,200
that today seems a very tedious task
10287
06:54:35,360 --> 06:54:40,000
because we have so many websites and we
10288
06:54:37,200 --> 06:54:41,760
have so many uh IP address which we have
10289
06:54:40,000 --> 06:54:43,520
to manually feed and uh this is a manual
10290
06:54:41,760 --> 06:54:45,680
task right so to to eliminate this
10291
06:54:43,520 --> 06:54:48,958
overhead we came up with a DNS and boy
10292
06:54:45,680 --> 06:54:51,600
now it's a very big uh help and a lot of
10293
06:54:48,958 --> 06:54:55,040
our effort is saved so that's the thing
10294
06:54:51,600 --> 06:54:56,478
and talking of how DNS works It works on
10295
06:54:55,040 --> 06:54:58,400
a concept which is very similar to a
10296
06:54:56,478 --> 06:55:01,200
client or a server network communication
10297
06:54:58,400 --> 06:55:04,320
architecture. Okay. So here our systems
10298
06:55:01,200 --> 06:55:06,478
will be the u DNS client. Okay. Now
10299
06:55:04,320 --> 06:55:09,360
supposing I'm accessing internet. Then I
10300
06:55:06,478 --> 06:55:11,200
would be a DNS client first of all and
10301
06:55:09,360 --> 06:55:12,958
then I'll be sending these requests to
10302
06:55:11,200 --> 06:55:15,280
the server. Okay. I'll be sending the
10303
06:55:12,958 --> 06:55:17,360
request to the DNS server by specifying
10304
06:55:15,280 --> 06:55:20,400
the host name. uh if I type in
10305
06:55:17,360 --> 06:55:22,958
google.com in my URL in my uh in my web
10306
06:55:20,400 --> 06:55:25,120
browser then that you then that host
10307
06:55:22,958 --> 06:55:27,040
name would go to DNS server it would the
10308
06:55:25,120 --> 06:55:28,718
DNS server would resolve to google.com
10309
06:55:27,040 --> 06:55:30,878
to a particular IP address. Similarly,
10310
06:55:28,718 --> 06:55:33,360
if I type any other uh website like
10311
06:55:30,878 --> 06:55:35,280
facebook.com or yahoo.com DNS server
10312
06:55:33,360 --> 06:55:37,200
would do the task of converting that
10313
06:55:35,280 --> 06:55:38,958
that host name into its equivalent IP
10314
06:55:37,200 --> 06:55:42,400
address and then give back that IP
10315
06:55:38,958 --> 06:55:44,080
address to us. Okay. And uh the very act
10316
06:55:42,400 --> 06:55:47,360
of uh sending a request is called a
10317
06:55:44,080 --> 06:55:49,040
lookup request. Okay. And what you get
10318
06:55:47,360 --> 06:55:50,638
back from the DNS server in the form of
10319
06:55:49,040 --> 06:55:52,240
an IP address that's going to look up
10320
06:55:50,638 --> 06:55:54,080
response.
10321
06:55:52,240 --> 06:55:56,958
So these are the two things that uh are
10322
06:55:54,080 --> 06:55:59,040
involved. And wherever you you configure
10323
06:55:56,958 --> 06:56:00,558
the DNS server in whichever environment
10324
06:55:59,040 --> 06:56:02,400
or whichever machine that's generally
10325
06:56:00,558 --> 06:56:04,160
called a DNS server. Okay. It can even
10326
06:56:02,400 --> 06:56:06,638
it can even be a running environment.
10327
06:56:04,160 --> 06:56:08,558
And similarly every uh system that tries
10328
06:56:06,638 --> 06:56:11,200
to access that particular server that
10329
06:56:08,558 --> 06:56:12,638
they are called DNS clients. So we don't
10330
06:56:11,200 --> 06:56:14,718
have much of a configuration to do from
10331
06:56:12,638 --> 06:56:15,680
the DNS client side. But of course DNS
10332
06:56:14,718 --> 06:56:18,000
server side we have a lot of
10333
06:56:15,680 --> 06:56:21,478
configuration to do.
10334
06:56:18,000 --> 06:56:21,478
Excuse me guys.
10335
06:56:21,760 --> 06:56:25,280
Yeah. So that's about uh this example.
10336
06:56:24,080 --> 06:56:28,400
And another thing that I want to show
10337
06:56:25,280 --> 06:56:31,440
you is that u this concept of DNS lookup
10338
06:56:28,400 --> 06:56:33,600
request. Okay. Now if you see this image
10339
06:56:31,440 --> 06:56:35,360
over here you can see that uh over here
10340
06:56:33,600 --> 06:56:37,920
I've specified lookup request and lookup
10341
06:56:35,360 --> 06:56:39,360
response. Okay. But over here this DNS
10342
06:56:37,920 --> 06:56:41,600
client is making a request in the form
10343
06:56:39,360 --> 06:56:44,240
of an IP address. Right. And then the
10344
06:56:41,600 --> 06:56:46,320
server is giving back the DNS response
10345
06:56:44,240 --> 06:56:49,280
in the form of a fully qualified domain
10346
06:56:46,320 --> 06:56:51,120
name. So in my case DNS.van.com
10347
06:56:49,280 --> 06:56:53,600
is a fully qualified domain name that I
10348
06:56:51,120 --> 06:56:55,600
have set for my demonstration on this
10349
06:56:53,600 --> 06:56:57,920
system of mine. Okay, on this uh virtual
10350
06:56:55,600 --> 06:57:00,000
machine. Now,
10351
06:56:57,920 --> 06:57:01,440
now you might ask the question why am I
10352
06:57:00,000 --> 06:57:03,920
specifying IP address? Now that's
10353
06:57:01,440 --> 06:57:05,520
because uh the fact that of course you
10354
06:57:03,920 --> 06:57:08,080
people know right you can either enter
10355
06:57:05,520 --> 06:57:10,638
the IP address or the host name. So to
10356
06:57:08,080 --> 06:57:13,440
represent that I've entered this and
10357
06:57:10,638 --> 06:57:15,280
when you enter the host name into your
10358
06:57:13,440 --> 06:57:17,200
web browser and when you and when the
10359
06:57:15,280 --> 06:57:18,558
server gets back to you with the IP
10360
06:57:17,200 --> 06:57:21,200
address and that's called a forward
10361
06:57:18,558 --> 06:57:22,638
lookup. Okay. So it resolves the host
10362
06:57:21,200 --> 06:57:25,520
name or the domain name to the IP
10363
06:57:22,638 --> 06:57:27,440
address. Uh whereas the reverse lookup
10364
06:57:25,520 --> 06:57:29,600
this one resolves resolves the IP
10365
06:57:27,440 --> 06:57:31,760
address to the host name. So in this
10366
06:57:29,600 --> 06:57:33,440
case when I send an IP address supposing
10367
06:57:31,760 --> 06:57:34,958
I know the IP address of a machine but I
10368
06:57:33,440 --> 06:57:37,920
don't know the uh host name or the
10369
06:57:34,958 --> 06:57:39,600
domain name then in that case what I get
10370
06:57:37,920 --> 06:57:41,440
back the lookup response I get back from
10371
06:57:39,600 --> 06:57:43,120
the server that would be a reverse
10372
06:57:41,440 --> 06:57:44,958
lookup right so there are there can be
10373
06:57:43,120 --> 06:57:46,478
two kinds of uh ways in which you can
10374
06:57:44,958 --> 06:57:50,638
access and look up so that these are the
10375
06:57:46,478 --> 06:57:52,718
two things with respect to DNS
10376
06:57:50,638 --> 06:57:55,440
now the uh question that can arise in
10377
06:57:52,718 --> 06:57:57,440
your mind is that u where does the DNS
10378
06:57:55,440 --> 06:57:59,920
server get the IP addresses of the host
10379
06:57:57,440 --> 06:58:02,000
name Right? You can ask that from where
10380
06:57:59,920 --> 06:58:03,840
how if there are so many websites, if
10381
06:58:02,000 --> 06:58:05,680
there are uh so many domain names, if
10382
06:58:03,840 --> 06:58:08,080
there are so many IP addresses for those
10383
06:58:05,680 --> 06:58:11,520
uh systems inside a particular domain,
10384
06:58:08,080 --> 06:58:13,440
how would our DNS server access that
10385
06:58:11,520 --> 06:58:14,958
particular uh IP address or that
10386
06:58:13,440 --> 06:58:17,840
particular server? You can ask me that
10387
06:58:14,958 --> 06:58:20,000
question. And to explain that question
10388
06:58:17,840 --> 06:58:23,280
is what I'm going to explain in this uh
10389
06:58:20,000 --> 06:58:25,120
next slide. Right? So here first of all
10390
06:58:23,280 --> 06:58:26,718
we have a local system. Now let's assume
10391
06:58:25,120 --> 06:58:29,600
it's me. Okay? Okay, I'm trying to
10392
06:58:26,718 --> 06:58:32,240
access a new uh website, okay, which has
10393
06:58:29,600 --> 06:58:34,320
not been which is a very new website. So
10394
06:58:32,240 --> 06:58:36,718
or let's ignore the fact that it's a new
10395
06:58:34,320 --> 06:58:38,000
website. The f uh let's just consider
10396
06:58:36,718 --> 06:58:39,760
that we are going to try to access
10397
06:58:38,000 --> 06:58:42,558
google.com. Okay, so when we try to
10398
06:58:39,760 --> 06:58:44,798
access google.com then that request
10399
06:58:42,558 --> 06:58:46,240
would first of all go to a resolver.
10400
06:58:44,798 --> 06:58:48,320
Okay, now the resolver is nothing but
10401
06:58:46,240 --> 06:58:51,120
your ISP server and it's basically built
10402
06:58:48,320 --> 06:58:53,520
into your network operating system and
10403
06:58:51,120 --> 06:58:55,920
the IP address of google.com would be
10404
06:58:53,520 --> 06:58:58,000
built inside resolver. Okay, it would be
10405
06:58:55,920 --> 06:58:59,680
present as the cache memory and uh since
10406
06:58:58,000 --> 06:59:01,200
the IP address would be present, the
10407
06:58:59,680 --> 06:59:02,558
host name would be resolved and the
10408
06:59:01,200 --> 06:59:05,280
response would be it would come back to
10409
06:59:02,558 --> 06:59:07,120
you. But in case if there's a new
10410
06:59:05,280 --> 06:59:09,760
website which is been newly newly
10411
06:59:07,120 --> 06:59:11,280
published and if that website if that IP
10412
06:59:09,760 --> 06:59:13,520
address is not in your resolver, what
10413
06:59:11,280 --> 06:59:16,000
happens? Google.com is famous, right?
10414
06:59:13,520 --> 06:59:17,520
But Google.com is uh you know there's no
10415
06:59:16,000 --> 06:59:19,280
guarantee that the website that you're
10416
06:59:17,520 --> 06:59:20,878
talking about is has been accessed by
10417
06:59:19,280 --> 06:59:22,478
someone in your ISP and it's on there in
10418
06:59:20,878 --> 06:59:27,840
a DNS cache. What would happen at that
10419
06:59:22,478 --> 06:59:29,600
time? So at that time the entire uh we
10420
06:59:27,840 --> 06:59:31,680
have the we have a different root
10421
06:59:29,600 --> 06:59:33,920
hierarchy of DNS right so those would be
10422
06:59:31,680 --> 06:59:35,840
accessed now that's where the whole
10423
06:59:33,920 --> 06:59:38,320
concept of DNS comes into the picture
10424
06:59:35,840 --> 06:59:40,160
and that's where we have first of all
10425
06:59:38,320 --> 06:59:42,240
something called as the root server okay
10426
06:59:40,160 --> 06:59:45,120
now the root server sits at the top of
10427
06:59:42,240 --> 06:59:47,360
the DNS hierarchy okay and uh there are
10428
06:59:45,120 --> 06:59:49,200
about 13 sets of these root servers
10429
06:59:47,360 --> 06:59:51,760
placed strategically around the world
10430
06:59:49,200 --> 06:59:53,040
and about 12 organizations access these
10431
06:59:51,760 --> 06:59:55,520
you know they control these these root
10432
06:59:53,040 --> 06:59:58,878
servers and the thing with these root
10433
06:59:55,520 --> 07:00:01,760
servers is that they will not tell you
10434
06:59:58,878 --> 07:00:03,840
which exactly which IP address your host
10435
07:00:01,760 --> 07:00:06,558
name is resolved to. Okay, if you
10436
07:00:03,840 --> 07:00:08,400
specify uh vart.com, it's not going to
10437
07:00:06,558 --> 07:00:10,000
return back with the IP address of that
10438
07:00:08,400 --> 07:00:12,160
particular domain. What the root server
10439
07:00:10,000 --> 07:00:14,718
will do is it will point you to another
10440
07:00:12,160 --> 07:00:16,798
server. Okay, and that is called the top
10441
07:00:14,718 --> 07:00:18,878
level domain servers also called TLD
10442
07:00:16,798 --> 07:00:20,958
servers. Okay, now when they point back
10443
07:00:18,878 --> 07:00:22,638
to the TLD servers, the TLDD servers
10444
07:00:20,958 --> 07:00:25,120
will have further information. So they
10445
07:00:22,638 --> 07:00:27,440
can point you to a direction where you
10446
07:00:25,120 --> 07:00:30,240
will get the IP address. So the root
10447
07:00:27,440 --> 07:00:33,360
server will point you back to the TL
10448
07:00:30,240 --> 07:00:34,958
server in which your domain may be
10449
07:00:33,360 --> 07:00:36,878
hosted. Okay, the domain that you're
10450
07:00:34,958 --> 07:00:39,840
trying to access that may be hosted in
10451
07:00:36,878 --> 07:00:42,240
one of the domains over here and these
10452
07:00:39,840 --> 07:00:44,000
one of these domains are what make up
10453
07:00:42,240 --> 07:00:46,000
these 13 set of root servers. So from
10454
07:00:44,000 --> 07:00:48,478
the 13 you shortlist one of them and
10455
07:00:46,000 --> 07:00:50,958
those come to the resolver. It tries to
10456
07:00:48,478 --> 07:00:53,360
access the top level domain servers and
10457
07:00:50,958 --> 07:00:55,760
these tople domain servers they store
10458
07:00:53,360 --> 07:01:00,000
information of these tople domains such
10459
07:00:55,760 --> 07:01:01,360
as.com or the.net or the.org org domains
10460
07:01:00,000 --> 07:01:03,600
all these domains right so whether it's
10461
07:01:01,360 --> 07:01:05,360
facebook.com or google.com those kinds
10462
07:01:03,600 --> 07:01:07,520
of those kind of information or details
10463
07:01:05,360 --> 07:01:11,120
will be present in the top level domain
10464
07:01:07,520 --> 07:01:13,440
servers now even now you cannot totally
10465
07:01:11,120 --> 07:01:14,718
resolve to a particular domain's IP
10466
07:01:13,440 --> 07:01:16,478
address supposing I want to access a
10467
07:01:14,718 --> 07:01:19,040
particular IP address inside a domain
10468
07:01:16,478 --> 07:01:21,440
that I cannot get it here I just by this
10469
07:01:19,040 --> 07:01:23,840
time the top level domain only uh it
10470
07:01:21,440 --> 07:01:27,120
only knows this particular domain is
10471
07:01:23,840 --> 07:01:29,360
hosted under these uh servers okay so
10472
07:01:27,120 --> 07:01:33,360
what the TLD will do is it would again
10473
07:01:29,360 --> 07:01:35,040
return back the particular domain or uh
10474
07:01:33,360 --> 07:01:37,200
let's say let's call it authoritative
10475
07:01:35,040 --> 07:01:40,080
name server okay the TLD would return
10476
07:01:37,200 --> 07:01:42,080
this name server back to the resolver so
10477
07:01:40,080 --> 07:01:44,160
based on that information the resolver
10478
07:01:42,080 --> 07:01:46,478
would again query the authoritative name
10479
07:01:44,160 --> 07:01:48,878
server okay now the name servers is what
10480
07:01:46,478 --> 07:01:51,840
knows everything about the domain
10481
07:01:48,878 --> 07:01:53,680
including the IP address so the root
10482
07:01:51,840 --> 07:01:55,680
server would return back the top level
10483
07:01:53,680 --> 07:01:58,798
domain servers such as the com or the
10484
07:01:55,680 --> 07:02:01,120
net or theorg and these tople dom domain
10485
07:01:58,798 --> 07:02:04,718
servers they will return back the
10486
07:02:01,120 --> 07:02:06,160
domains where your IP address is part of
10487
07:02:04,718 --> 07:02:07,920
right and uh that is through the
10488
07:02:06,160 --> 07:02:10,160
authoritative name servers and yeah
10489
07:02:07,920 --> 07:02:12,958
that's how things happen and then the
10490
07:02:10,160 --> 07:02:14,478
resolver would finally get uh short uh
10491
07:02:12,958 --> 07:02:16,558
you know get to the IP address inside
10492
07:02:14,478 --> 07:02:18,558
your authoritative name server and uh
10493
07:02:16,558 --> 07:02:21,280
finally it would it would store the IP
10494
07:02:18,558 --> 07:02:23,040
address in its cache locally for later
10495
07:02:21,280 --> 07:02:25,520
use so the next time somebody else is
10496
07:02:23,040 --> 07:02:27,760
trying to access this website in your uh
10497
07:02:25,520 --> 07:02:29,520
you know through your ISP then they can
10498
07:02:27,760 --> 07:02:30,878
uh instead straight away access that
10499
07:02:29,520 --> 07:02:33,920
website with the IP address since it
10500
07:02:30,878 --> 07:02:36,000
would already be present in the cache
10501
07:02:33,920 --> 07:02:37,920
and yeah finally once it's present in
10502
07:02:36,000 --> 07:02:40,638
the resolver the resolver would send the
10503
07:02:37,920 --> 07:02:46,200
response back to the local system. So
10504
07:02:40,638 --> 07:02:46,200
this is how a DNS server works. Okay.
10505
07:02:46,478 --> 07:02:50,080
Now uh if you guys have understood this
10506
07:02:48,400 --> 07:02:52,558
part then you're all set. You can
10507
07:02:50,080 --> 07:02:54,878
understand exactly how how to set up
10508
07:02:52,558 --> 07:02:57,040
your DNS server which uh which which
10509
07:02:54,878 --> 07:02:59,280
server to use. Right. So speaking of
10510
07:02:57,040 --> 07:03:02,080
which server we have a lot of uh DNS
10511
07:02:59,280 --> 07:03:03,520
servers available in the market and we
10512
07:03:02,080 --> 07:03:05,440
what I'm going to use in my session is
10513
07:03:03,520 --> 07:03:07,040
that of a bind DNS server. So bind is
10514
07:03:05,440 --> 07:03:09,040
one of the most popular and one of the
10515
07:03:07,040 --> 07:03:11,040
earliest DNS servers which was in use
10516
07:03:09,040 --> 07:03:14,718
and it's basically a name server and it
10517
07:03:11,040 --> 07:03:17,280
also be configured for mail service and
10518
07:03:14,718 --> 07:03:19,280
uh I'm going to use bind. However you
10519
07:03:17,280 --> 07:03:22,478
can uh try out unbound or you can try
10520
07:03:19,280 --> 07:03:26,400
out power DNS. We have a number of name
10521
07:03:22,478 --> 07:03:29,120
uh DNS servers. So moving on to uh how
10522
07:03:26,400 --> 07:03:31,520
to configure a bind DNS server. I can
10523
07:03:29,120 --> 07:03:34,160
show you that in 10 simple steps. Okay.
10524
07:03:31,520 --> 07:03:37,920
Now let's see how uh we do that. Now
10525
07:03:34,160 --> 07:03:40,478
that's the next topic. And uh the 10 the
10526
07:03:37,920 --> 07:03:44,160
10 steps that are involved are mentioned
10527
07:03:40,478 --> 07:03:46,160
here. Right. And first of all the most
10528
07:03:44,160 --> 07:03:48,240
obvious of the steps is this one. You
10529
07:03:46,160 --> 07:03:50,320
have to install bind because bind is a
10530
07:03:48,240 --> 07:03:52,558
DNS service and we'll have to install
10531
07:03:50,320 --> 07:03:54,958
bind with the help of yum command in
10532
07:03:52,558 --> 07:03:56,798
cententos machines. Uh if you're however
10533
07:03:54,958 --> 07:04:00,400
doing this on a Ubuntu machine it would
10534
07:03:56,798 --> 07:04:02,638
be apt get install bind. Right. So this
10535
07:04:00,400 --> 07:04:06,558
is the first step. The second step would
10536
07:04:02,638 --> 07:04:08,958
be to add a static IP address. Uh now
10537
07:04:06,558 --> 07:04:12,478
can anybody uh guess why we add a static
10538
07:04:08,958 --> 07:04:13,840
IP address to your u uh machine to the
10539
07:04:12,478 --> 07:04:16,718
to the system where you're configuring
10540
07:04:13,840 --> 07:04:19,718
the DNS server?
10541
07:04:16,718 --> 07:04:19,718
Anybody?
10542
07:04:20,878 --> 07:04:27,360
Well uh see the reason for that is uh
10543
07:04:23,120 --> 07:04:28,878
because when we reboot our uh machine so
10544
07:04:27,360 --> 07:04:31,120
sometimes if your server crashes and
10545
07:04:28,878 --> 07:04:32,638
then it reboots then at that time you
10546
07:04:31,120 --> 07:04:35,680
don't want your IP address to change
10547
07:04:32,638 --> 07:04:37,920
right. So for that purpose you say boot
10548
07:04:35,680 --> 07:04:39,520
protocol is static. Okay. So initially
10549
07:04:37,920 --> 07:04:40,558
by default when you're trying to
10550
07:04:39,520 --> 07:04:42,718
configure it for the first time you'd
10551
07:04:40,558 --> 07:04:45,200
find DHCP over here that's uh stands for
10552
07:04:42,718 --> 07:04:47,200
dynamic host control protocol which
10553
07:04:45,200 --> 07:04:50,000
would assign a dynamic IP address every
10554
07:04:47,200 --> 07:04:52,478
time you reboot your server. But uh when
10555
07:04:50,000 --> 07:04:53,840
you change it to static then what IP
10556
07:04:52,478 --> 07:04:55,680
address you set here this is going to be
10557
07:04:53,840 --> 07:04:59,600
constant. It's not going to change.
10558
07:04:55,680 --> 07:05:01,760
Okay. So that's the uh uh need to assign
10559
07:04:59,600 --> 07:05:03,920
a static IP address. And that makes up
10560
07:05:01,760 --> 07:05:05,520
the uh second step. And along with these
10561
07:05:03,920 --> 07:05:08,478
you need you need to also add these two
10562
07:05:05,520 --> 07:05:10,878
lines of net mask and say which uh
10563
07:05:08,478 --> 07:05:13,920
subnet it belongs to. Okay. And the
10564
07:05:10,878 --> 07:05:17,280
gateway. So uh in my case my IP address
10565
07:05:13,920 --> 07:05:19,520
is 192.168.56.2
10566
07:05:17,280 --> 07:05:22,478
and this is what I've entered in my uh
10567
07:05:19,520 --> 07:05:25,040
ed0ero file which is present under uh
10568
07:05:22,478 --> 07:05:27,760
this directory sysconfig network
10569
07:05:25,040 --> 07:05:30,080
scripts. Right. And you also add the
10570
07:05:27,760 --> 07:05:32,000
gateway. Okay. Again, you add these
10571
07:05:30,080 --> 07:05:34,718
three lines and the rest remains the
10572
07:05:32,000 --> 07:05:37,440
same. And you of course change the f0
10573
07:05:34,718 --> 07:05:39,280
file. And uh moving on, the next step is
10574
07:05:37,440 --> 07:05:41,360
to assign a fully qualified domain name
10575
07:05:39,280 --> 07:05:42,958
for your server. Well, what's the point
10576
07:05:41,360 --> 07:05:46,160
in hosting a domain if you don't want to
10577
07:05:42,958 --> 07:05:48,000
give a domain name, right? So that's the
10578
07:05:46,160 --> 07:05:49,680
whole point of assigning it. And uh you
10579
07:05:48,000 --> 07:05:51,680
can simply assign a domain name a fully
10580
07:05:49,680 --> 07:05:55,200
qualified domain name by entering this
10581
07:05:51,680 --> 07:05:56,558
file, the HCIS config network file. And
10582
07:05:55,200 --> 07:05:58,320
uh you'll have two lines. You will have
10583
07:05:56,558 --> 07:05:59,920
networking is equal to yes. This will be
10584
07:05:58,320 --> 07:06:03,040
a line which would be initially there
10585
07:05:59,920 --> 07:06:04,718
and even the host name is equal to
10586
07:06:03,040 --> 07:06:06,638
followed by the current machine name
10587
07:06:04,718 --> 07:06:08,240
that would be the uh entry initially in
10588
07:06:06,638 --> 07:06:10,000
your system. Okay. So when you configure
10589
07:06:08,240 --> 07:06:11,360
it you can change it with the domain
10590
07:06:10,000 --> 07:06:13,600
name that you want to give. So in my
10591
07:06:11,360 --> 07:06:14,638
case I'm giving DNS1.van.com.
10592
07:06:13,600 --> 07:06:16,878
Okay. So you can uh change it
10593
07:06:14,638 --> 07:06:20,878
appropriate accordingly. You can do
10594
07:06:16,878 --> 07:06:22,478
that. Um so once you've set the uh fully
10595
07:06:20,878 --> 07:06:26,080
qualified domain name the next step is
10596
07:06:22,478 --> 07:06:29,760
to go to the uh hosts file and add the
10597
07:06:26,080 --> 07:06:31,360
entry. Okay this entry you've uh in your
10598
07:06:29,760 --> 07:06:33,440
uh
10599
07:06:31,360 --> 07:06:35,120
in this file right in your networks file
10600
07:06:33,440 --> 07:06:37,760
you've added the domain name you've said
10601
07:06:35,120 --> 07:06:39,120
uh this is your host name. Now you're
10602
07:06:37,760 --> 07:06:41,520
defining an IP address for that host
10603
07:06:39,120 --> 07:06:43,440
name over here in the hosts file right
10604
07:06:41,520 --> 07:06:45,840
that's the step here. These two lines
10605
07:06:43,440 --> 07:06:48,080
would uh be there by default. You don't
10606
07:06:45,840 --> 07:06:52,080
need to worry about that. And the fifth
10607
07:06:48,080 --> 07:06:53,360
step would be to go to your resolve.conf
10608
07:06:52,080 --> 07:06:55,920
file. Okay, this will again be present
10609
07:06:53,360 --> 07:06:58,160
under under the etsy directory and you
10610
07:06:55,920 --> 07:07:00,798
need to add these two lines. So you need
10611
07:06:58,160 --> 07:07:02,958
to say search and your domain name. Uh
10612
07:07:00,798 --> 07:07:05,280
you can ignore the DNS one part but you
10613
07:07:02,958 --> 07:07:06,878
got to uh put your domain name over
10614
07:07:05,280 --> 07:07:09,120
here. Uh in your case it can be anything
10615
07:07:06,878 --> 07:07:12,160
but in my case it's van.com otherwise it
10616
07:07:09,120 --> 07:07:13,520
can be google.com or yahoo.com
10617
07:07:12,160 --> 07:07:15,840
excuse me it can be anything like that.
10618
07:07:13,520 --> 07:07:18,080
And of course you should say name server
10619
07:07:15,840 --> 07:07:21,600
and point the IP address which you want
10620
07:07:18,080 --> 07:07:23,360
to act as the uh DNS server. Okay. And
10621
07:07:21,600 --> 07:07:25,680
uh this is one important step which has
10622
07:07:23,360 --> 07:07:27,760
to be configured even in the client's
10623
07:07:25,680 --> 07:07:30,320
even in your DNS uh client. Okay. So
10624
07:07:27,760 --> 07:07:33,520
supposing uh if I want to check later
10625
07:07:30,320 --> 07:07:35,120
what is the uh uh if my domain name is
10626
07:07:33,520 --> 07:07:37,040
working right that time I will have to
10627
07:07:35,120 --> 07:07:39,360
go to the resolve.confer file in my
10628
07:07:37,040 --> 07:07:41,040
client and add this particular line. I
10629
07:07:39,360 --> 07:07:43,040
will show you that later right? I will
10630
07:07:41,040 --> 07:07:44,478
show you that in my demonstration. So
10631
07:07:43,040 --> 07:07:45,760
just remember that it's a very important
10632
07:07:44,478 --> 07:07:47,600
uh step which you need to do even in
10633
07:07:45,760 --> 07:07:49,840
your clients. In fact this is the only
10634
07:07:47,600 --> 07:07:53,120
step that you have to do in your clients
10635
07:07:49,840 --> 07:07:55,760
in your DNS client side right. So then
10636
07:07:53,120 --> 07:07:58,798
this uh next step would be to go and
10637
07:07:55,760 --> 07:08:01,040
edit the named corner file. So from here
10638
07:07:58,798 --> 07:08:03,040
onwards is where the uh actual
10639
07:08:01,040 --> 07:08:04,320
configuration of bind starts. So till
10640
07:08:03,040 --> 07:08:06,558
here you were just configuring your own
10641
07:08:04,320 --> 07:08:09,520
network. the first five steps from the
10642
07:08:06,558 --> 07:08:11,280
sixth step onwards till the uh eighth
10643
07:08:09,520 --> 07:08:14,558
and in fact even the n till the eighth
10644
07:08:11,280 --> 07:08:16,878
step it's all about bind DNS okay so
10645
07:08:14,558 --> 07:08:20,558
this named corner file is a file that
10646
07:08:16,878 --> 07:08:21,760
comes when you install bind okay and uh
10647
07:08:20,558 --> 07:08:23,360
what you have to do is you have to enter
10648
07:08:21,760 --> 07:08:24,638
the named doc corner file and you'll
10649
07:08:23,360 --> 07:08:26,400
have a number of lines there which of
10650
07:08:24,638 --> 07:08:28,160
course I can't uh I I couldn't print all
10651
07:08:26,400 --> 07:08:30,878
the lines in my slide so I have just the
10652
07:08:28,160 --> 07:08:32,878
three lines which we have to uh change
10653
07:08:30,878 --> 07:08:34,718
so we have to edit these three lines and
10654
07:08:32,878 --> 07:08:36,320
the thing is initially when When you
10655
07:08:34,718 --> 07:08:38,478
open this file, you will have this uh
10656
07:08:36,320 --> 07:08:40,958
line, okay? Where in curly brackets, you
10657
07:08:38,478 --> 07:08:42,160
would have local host like it says here.
10658
07:08:40,958 --> 07:08:44,478
What you have to do is you have to
10659
07:08:42,160 --> 07:08:45,920
replace this local host with your IP
10660
07:08:44,478 --> 07:08:49,920
address. So in my case, I would be doing
10661
07:08:45,920 --> 07:08:52,558
it with uh 52 uh sorry.256.2.
10662
07:08:49,920 --> 07:08:54,160
That's my IP address, right? And uh
10663
07:08:52,558 --> 07:08:56,320
you'll have one more line for pointing
10664
07:08:54,160 --> 07:08:57,600
to the IPv6 port number. And this you
10665
07:08:56,320 --> 07:09:00,000
need to comment this. You don't need
10666
07:08:57,600 --> 07:09:01,680
this line anymore. Okay? And the third
10667
07:09:00,000 --> 07:09:04,160
line which you have to edit is that of
10668
07:09:01,680 --> 07:09:05,760
allow query. and you will have none
10669
07:09:04,160 --> 07:09:08,400
initially. You should replace this with
10670
07:09:05,760 --> 07:09:11,200
any. So that is the uh sixth step which
10671
07:09:08,400 --> 07:09:13,520
you have to uh configure. When you're
10672
07:09:11,200 --> 07:09:16,798
done with this, you can uh then go to
10673
07:09:13,520 --> 07:09:19,520
the other file in the Etsy which again
10674
07:09:16,798 --> 07:09:22,718
uh the file name is RFC.1912.zones.
10675
07:09:19,520 --> 07:09:25,360
And this of course comes from uh comes
10676
07:09:22,718 --> 07:09:27,680
when you install bind. And uh here is
10677
07:09:25,360 --> 07:09:29,920
where you define your zones. Okay. Now
10678
07:09:27,680 --> 07:09:31,520
there are two concepts of forward lookup
10679
07:09:29,920 --> 07:09:33,280
and reverse lookup. Right? So I told you
10680
07:09:31,520 --> 07:09:36,160
that when you enter the host name and
10681
07:09:33,280 --> 07:09:38,000
then uh you hit enter in your browser
10682
07:09:36,160 --> 07:09:39,680
then that's called a forward lookup. But
10683
07:09:38,000 --> 07:09:41,840
however if you enter the IP address
10684
07:09:39,680 --> 07:09:44,798
that's a reverse lookup. So if you want
10685
07:09:41,840 --> 07:09:46,638
people to query your server either uh in
10686
07:09:44,798 --> 07:09:49,680
the forward or the reverse fashion using
10687
07:09:46,638 --> 07:09:51,200
one of these uh uh lookup fashions. So
10688
07:09:49,680 --> 07:09:53,520
at that time for that purpose you have
10689
07:09:51,200 --> 07:09:55,280
to set up two different zones. So your
10690
07:09:53,520 --> 07:09:57,120
first zone would have the rules and
10691
07:09:55,280 --> 07:09:59,840
settings
10692
07:09:57,120 --> 07:10:02,320
for what should be returned to them when
10693
07:09:59,840 --> 07:10:05,040
they access you from the forward lookup
10694
07:10:02,320 --> 07:10:06,798
and when they access your server through
10695
07:10:05,040 --> 07:10:08,878
the lookup uh through the reverse lookup
10696
07:10:06,798 --> 07:10:11,920
then the settings for those would be
10697
07:10:08,878 --> 07:10:15,120
present under this uh zone. Okay. So
10698
07:10:11,920 --> 07:10:16,878
I've just defined that it's uh the I
10699
07:10:15,120 --> 07:10:18,878
I've just defined the forward lookup as
10700
07:10:16,878 --> 07:10:20,878
uh my domain name here. As you can see
10701
07:10:18,878 --> 07:10:23,120
it's in the form of van.com which is uh
10702
07:10:20,878 --> 07:10:25,280
like a domain name and for the reverse
10703
07:10:23,120 --> 07:10:28,958
lookup of course it would be from the IP
10704
07:10:25,280 --> 07:10:30,718
address. So for this reverse lookup I've
10705
07:10:28,958 --> 07:10:32,400
said it would be in the form of an IP
10706
07:10:30,718 --> 07:10:35,040
address and I've named it as
10707
07:10:32,400 --> 07:10:37,680
reverse.zone. Okay. And similarly file
10708
07:10:35,040 --> 07:10:40,160
would be forward zone. Okay. Now this
10709
07:10:37,680 --> 07:10:42,478
file RFC file this is going to be again
10710
07:10:40,160 --> 07:10:44,958
a very long u file and you'll have a lot
10711
07:10:42,478 --> 07:10:47,440
of lines there and uh these would be
10712
07:10:44,958 --> 07:10:48,958
this would be placed in there. So you
10713
07:10:47,440 --> 07:10:50,718
would understand this better when I open
10714
07:10:48,958 --> 07:10:52,320
the demonstration. So stick around till
10715
07:10:50,718 --> 07:10:54,798
then till you understand this completely
10716
07:10:52,320 --> 07:10:58,400
because it's a little tricky at uh this
10717
07:10:54,798 --> 07:11:01,680
step. Okay. And uh then moving on to the
10718
07:10:58,400 --> 07:11:02,958
next uh point uh the next step is the
10719
07:11:01,680 --> 07:11:04,638
configuring of the forward and the
10720
07:11:02,958 --> 07:11:06,240
reverse zones. So whatever we have
10721
07:11:04,638 --> 07:11:07,760
configured over here in step seven, we
10722
07:11:06,240 --> 07:11:09,680
have created the forward zones here.
10723
07:11:07,760 --> 07:11:11,920
We've created a new file forward.zone
10724
07:11:09,680 --> 07:11:14,400
and created a new file reverse.zone. We
10725
07:11:11,920 --> 07:11:15,920
have to add the uh we have to add the
10726
07:11:14,400 --> 07:11:18,240
rules over here. So that's what you're
10727
07:11:15,920 --> 07:11:20,320
doing here. You create one and then you
10728
07:11:18,240 --> 07:11:22,320
open them and you will have a basic
10729
07:11:20,320 --> 07:11:24,478
template and you'll have to edit that
10730
07:11:22,320 --> 07:11:26,000
template and replace that template with
10731
07:11:24,478 --> 07:11:28,080
your host name and your IP address. In
10732
07:11:26,000 --> 07:11:30,798
the forward dot zone you would replace
10733
07:11:28,080 --> 07:11:32,558
the uh template the template with your
10734
07:11:30,798 --> 07:11:34,400
domain name and in the reverse dozone
10735
07:11:32,558 --> 07:11:37,120
you would replace your template with
10736
07:11:34,400 --> 07:11:38,478
your uh IP address. So these are the two
10737
07:11:37,120 --> 07:11:41,040
things that you have to do and when you
10738
07:11:38,478 --> 07:11:43,120
do this your uh DNS server is uh well
10739
07:11:41,040 --> 07:11:45,120
and good. Okay. But however, you might
10740
07:11:43,120 --> 07:11:47,440
also want to change your group ownership
10741
07:11:45,120 --> 07:11:49,440
of those two files. Okay, this is a
10742
07:11:47,440 --> 07:11:52,400
minor step that's needed. You're just
10743
07:11:49,440 --> 07:11:54,320
setting it root access full permissions
10744
07:11:52,400 --> 07:11:55,760
and uh yeah, that is the final step.
10745
07:11:54,320 --> 07:11:58,240
When you do that, you can just restart
10746
07:11:55,760 --> 07:12:00,958
your DMD service and uh your service
10747
07:11:58,240 --> 07:12:02,478
would be up and running, right? So,
10748
07:12:00,958 --> 07:12:06,000
these are the uh 10 different steps
10749
07:12:02,478 --> 07:12:08,400
which are needed. So, I can uh now get
10750
07:12:06,000 --> 07:12:10,400
started with my hands-on, right? So
10751
07:12:08,400 --> 07:12:12,718
let's see how to configure this uh binds
10752
07:12:10,400 --> 07:12:15,600
server in 10 simple steps through my
10753
07:12:12,718 --> 07:12:16,878
demonstration. And for uh my
10754
07:12:15,600 --> 07:12:19,360
demonstration, what I'm going to do is
10755
07:12:16,878 --> 07:12:23,040
I'm going to open my virtual machine.
10756
07:12:19,360 --> 07:12:24,638
Okay. So
10757
07:12:23,040 --> 07:12:26,240
uh this is my virtual machine. As you
10758
07:12:24,638 --> 07:12:28,558
can see, I've already set my domain name
10759
07:12:26,240 --> 07:12:31,680
here. It says dns1.ban.com.
10760
07:12:28,558 --> 07:12:35,160
This is my machine name. So let me just
10761
07:12:31,680 --> 07:12:35,160
open this up.
10762
07:12:36,080 --> 07:12:40,400
So uh first and foremost let me just
10763
07:12:38,000 --> 07:12:42,240
check what's my IP address that's uh
10764
07:12:40,400 --> 07:12:44,000
192.16846.2
10765
07:12:42,240 --> 07:12:46,000
two the IP address did not change
10766
07:12:44,000 --> 07:12:48,878
because I followed my step and I have
10767
07:12:46,000 --> 07:12:52,760
assigned a static IP address for this
10768
07:12:48,878 --> 07:12:52,760
right so
10769
07:12:59,840 --> 07:13:08,638
okay guys so I hope you can see the uh
10770
07:13:04,080 --> 07:13:09,760
VM clearly now right now uh the first
10771
07:13:08,638 --> 07:13:12,080
thing of course that you would have to
10772
07:13:09,760 --> 07:13:14,558
do is to install bind right so The
10773
07:13:12,080 --> 07:13:17,760
command for that is uh pseudo yum. Well,
10774
07:13:14,558 --> 07:13:20,080
what I'll do is I would uh enter as a
10775
07:13:17,760 --> 07:13:24,878
pseudo user. Okay. Yeah. The first
10776
07:13:20,080 --> 07:13:27,200
command is to do a yum install
10777
07:13:24,878 --> 07:13:29,520
bind. And uh I'm going to give aster
10778
07:13:27,200 --> 07:13:31,200
because there are multiple packages that
10779
07:13:29,520 --> 07:13:33,040
come with bind. So I would want to
10780
07:13:31,200 --> 07:13:35,760
install all those uh utilities
10781
07:13:33,040 --> 07:13:38,320
especially the one that's ch root and
10782
07:13:35,760 --> 07:13:40,798
utils package. So when you give asterk
10783
07:13:38,320 --> 07:13:42,798
all the associated uh packages would be
10784
07:13:40,798 --> 07:13:44,878
there and uh since I have already the
10785
07:13:42,798 --> 07:13:49,200
latest one installed I have nothing to
10786
07:13:44,878 --> 07:13:51,040
do. So the next step would be let's go
10787
07:13:49,200 --> 07:13:52,638
back to step number two would be to
10788
07:13:51,040 --> 07:13:54,320
assign a static IP address. So I've done
10789
07:13:52,638 --> 07:13:57,798
that and let me just verify that and
10790
07:13:54,320 --> 07:13:57,798
show it to you once.
10791
07:13:58,478 --> 07:14:02,558
Okay. So let me open this and show it to
10792
07:14:00,400 --> 07:14:07,520
you. So I'm going to do a cat command
10793
07:14:02,558 --> 07:14:11,558
here or let's do a VM itself.
10794
07:14:07,520 --> 07:14:11,558
Let's see sis
10795
07:14:12,240 --> 07:14:15,558
sis config
10796
07:14:16,478 --> 07:14:25,080
network scripts and I want to edit my f0
10797
07:14:21,040 --> 07:14:25,080
file. Okay.
10798
07:14:28,878 --> 07:14:33,558
Okay. So, one minute.
10799
07:14:33,600 --> 07:14:36,798
Oh, yeah.
10800
07:14:39,760 --> 07:14:45,760
F0 file. All right. So here we go. These
10801
07:14:42,958 --> 07:14:47,440
are the settings that uh I had told you
10802
07:14:45,760 --> 07:14:49,840
that I had already done. I've assigned
10803
07:14:47,440 --> 07:14:52,080
my IP address here. I've um mentioned
10804
07:14:49,840 --> 07:14:54,558
it's going to be static. Okay. I've also
10805
07:14:52,080 --> 07:14:56,240
added these two lines net mask and
10806
07:14:54,558 --> 07:14:57,360
gateway along with my IP address. So
10807
07:14:56,240 --> 07:15:00,878
this is something that you also have to
10808
07:14:57,360 --> 07:15:04,080
do. So let me just uh close this. Now
10809
07:15:00,878 --> 07:15:07,360
going to the step two is all about
10810
07:15:04,080 --> 07:15:09,040
assigning a of you know assigning a FQDN
10811
07:15:07,360 --> 07:15:11,840
uh DN for my server right fully
10812
07:15:09,040 --> 07:15:15,718
qualified domain name. So that we can do
10813
07:15:11,840 --> 07:15:15,718
by going to my
10814
07:15:34,958 --> 07:15:40,798
Okay. So as you can see my uh host name
10815
07:15:37,680 --> 07:15:43,600
of course uh it's dns1
10816
07:15:40,798 --> 07:15:45,920
var.com. You can again change the domain
10817
07:15:43,600 --> 07:15:48,638
name as per your wish. Right. So this is
10818
07:15:45,920 --> 07:15:51,638
the important thing. And uh the next
10819
07:15:48,638 --> 07:15:51,638
step
10820
07:15:52,000 --> 07:15:57,280
would be to configure the c/hosts file.
10821
07:15:55,120 --> 07:15:58,320
Okay. You have to add your uh uh
10822
07:15:57,280 --> 07:16:00,160
whatever domain name that you've
10823
07:15:58,320 --> 07:16:03,440
created. you have to add the IP address
10824
07:16:00,160 --> 07:16:06,878
uh along with that. Okay. So, let me
10825
07:16:03,440 --> 07:16:08,400
just uh
10826
07:16:06,878 --> 07:16:10,160
go to my host file and show you that
10827
07:16:08,400 --> 07:16:12,160
I've done the same thing here. I have my
10828
07:16:10,160 --> 07:16:13,520
IP address and I've also specified my
10829
07:16:12,160 --> 07:16:15,440
domain name for this particular IP
10830
07:16:13,520 --> 07:16:18,400
address.
10831
07:16:15,440 --> 07:16:20,240
Okay, that's done with step number four.
10832
07:16:18,400 --> 07:16:22,400
Now going to step number five. We have
10833
07:16:20,240 --> 07:16:26,478
to then go to our resolve.confer file.
10834
07:16:22,400 --> 07:16:28,718
Okay, so our uh resolve.confer file is
10835
07:16:26,478 --> 07:16:32,320
again present over here.
10836
07:16:28,718 --> 07:16:34,080
And as you can see uh I've said search
10837
07:16:32,320 --> 07:16:37,440
van.com.
10838
07:16:34,080 --> 07:16:40,000
Okay. Now I've mentioned my
10839
07:16:37,440 --> 07:16:42,878
I mentioned my uh domain name. But
10840
07:16:40,000 --> 07:16:45,520
however there's one problem over here.
10841
07:16:42,878 --> 07:16:47,840
The uh name server is wrong. So it's
10842
07:16:45,520 --> 07:16:50,558
pointing to 1.1. So let me just change
10843
07:16:47,840 --> 07:16:54,478
this to my IP address which uh I want to
10844
07:16:50,558 --> 07:16:56,878
set for my uh name server. And uh let me
10845
07:16:54,478 --> 07:16:58,718
also
10846
07:16:56,878 --> 07:17:00,240
Okay. So, I can also comment these two
10847
07:16:58,718 --> 07:17:03,120
lines. I don't really need these two
10848
07:17:00,240 --> 07:17:05,040
lines. Okay.
10849
07:17:03,120 --> 07:17:08,160
So, I'm going to comment them out. I'm
10850
07:17:05,040 --> 07:17:10,000
going to just uh save and quit.
10851
07:17:08,160 --> 07:17:11,840
All right.
10852
07:17:10,000 --> 07:17:14,638
So,
10853
07:17:11,840 --> 07:17:17,840
going back to my uh step number six. Now
10854
07:17:14,638 --> 07:17:19,360
is where the uh whole bind task starts.
10855
07:17:17,840 --> 07:17:22,000
So, bind like I told you, it's one of
10856
07:17:19,360 --> 07:17:24,478
the most popular uh DNS servers, right?
10857
07:17:22,000 --> 07:17:29,000
So, let's edit the named.conf conif file
10858
07:17:24,478 --> 07:17:29,000
which is given by bind.
10859
07:17:33,760 --> 07:17:38,320
So here we go
10860
07:17:36,160 --> 07:17:40,798
and uh this is the file here and uh this
10861
07:17:38,320 --> 07:17:43,120
was the line that I was talking about.
10862
07:17:40,798 --> 07:17:44,638
Okay, you would have local specified
10863
07:17:43,120 --> 07:17:46,400
over here and you'll have to change this
10864
07:17:44,638 --> 07:17:48,958
with the IP address of the server on
10865
07:17:46,400 --> 07:17:50,400
which you are uh of change it with the
10866
07:17:48,958 --> 07:17:53,200
IP address of the machine that you want
10867
07:17:50,400 --> 07:17:55,840
to make your server. Okay, DNS server in
10868
07:17:53,200 --> 07:17:58,638
my case it's my IP address and uh you
10869
07:17:55,840 --> 07:18:00,558
have to comment this line of yours and
10870
07:17:58,638 --> 07:18:02,320
then you'll have the allow query right
10871
07:18:00,558 --> 07:18:04,240
so here you have to specify any so these
10872
07:18:02,320 --> 07:18:07,040
are the three uh settings that you have
10873
07:18:04,240 --> 07:18:08,878
to do in your named dconif file okay
10874
07:18:07,040 --> 07:18:11,200
when you've done this you can just uh
10875
07:18:08,878 --> 07:18:14,080
quit
10876
07:18:11,200 --> 07:18:18,080
and then you can go to the next step
10877
07:18:14,080 --> 07:18:23,878
that is configuring the rsc 1912zones
10878
07:18:18,080 --> 07:18:23,878
okay you define the zones over here now.
10879
07:18:27,040 --> 07:18:33,040
Okay. So, this is the uh file, the RFC
10880
07:18:29,600 --> 07:18:35,280
file. And as you can see, this is my uh
10881
07:18:33,040 --> 07:18:37,280
this is the this is the thing which is
10882
07:18:35,280 --> 07:18:40,958
pointing to my forward zone. Okay. I've
10883
07:18:37,280 --> 07:18:42,638
said van.com is my domain and uh I've
10884
07:18:40,958 --> 07:18:44,478
said type master. It's going to be the
10885
07:18:42,638 --> 07:18:45,920
master. It's not going to be the slave.
10886
07:18:44,478 --> 07:18:47,600
It's going to be the master over here.
10887
07:18:45,920 --> 07:18:50,320
And I've said the file name is
10888
07:18:47,600 --> 07:18:52,400
forward.zone. Okay. uh when when we uh
10889
07:18:50,320 --> 07:18:55,600
say file forward.zone it basically means
10890
07:18:52,400 --> 07:18:57,680
the settings for uh the rules that you
10891
07:18:55,600 --> 07:18:59,360
need to follow that you need to return
10892
07:18:57,680 --> 07:19:03,200
would be present in the file called
10893
07:18:59,360 --> 07:19:05,840
forward.zone and uh this forward zone
10894
07:19:03,200 --> 07:19:08,160
would be present in the directory that
10895
07:19:05,840 --> 07:19:11,520
is uh where/named
10896
07:19:08,160 --> 07:19:13,600
okay uh that is a directory that you can
10897
07:19:11,520 --> 07:19:16,240
set in your named D.conf conf. So the
10898
07:19:13,600 --> 07:19:19,520
file that I opened previously in that we
10899
07:19:16,240 --> 07:19:22,400
have to set the path. So let me just uh
10900
07:19:19,520 --> 07:19:24,798
quickly open back that file and show you
10901
07:19:22,400 --> 07:19:27,200
what I'm talking about. So over here
10902
07:19:24,798 --> 07:19:28,878
along with specifying these three lines
10903
07:19:27,200 --> 07:19:32,718
I have something called as directory
10904
07:19:28,878 --> 07:19:34,798
right. So whatever uh uh files that my
10905
07:19:32,718 --> 07:19:35,760
DNS bind is going to create. So that it
10906
07:19:34,798 --> 07:19:38,160
would it would place it in the
10907
07:19:35,760 --> 07:19:40,400
/wware/named. So even the forward zone
10908
07:19:38,160 --> 07:19:42,718
and the reverse zones which I'm going to
10909
07:19:40,400 --> 07:19:44,478
uh configure in my RFC those would be
10910
07:19:42,718 --> 07:19:46,080
present inside inside this directory.
10911
07:19:44,478 --> 07:19:47,760
Okay. So that's why we have written
10912
07:19:46,080 --> 07:19:50,080
forward.zone which will be the name of
10913
07:19:47,760 --> 07:19:52,638
my file. And uh similarly explaining the
10914
07:19:50,080 --> 07:19:55,920
other lines uh dump file again over here
10915
07:19:52,638 --> 07:19:57,280
is where your uh uh cache and your logs
10916
07:19:55,920 --> 07:19:58,958
would be dumped. Okay. And then you have
10917
07:19:57,280 --> 07:20:01,920
a statistics file where you'll have
10918
07:19:58,958 --> 07:20:03,520
other details. But these are not uh we
10919
07:20:01,920 --> 07:20:04,878
don't need to really worry about these
10920
07:20:03,520 --> 07:20:07,760
details for now. Okay. Okay, we just
10921
07:20:04,878 --> 07:20:10,080
need to verify that it includes the RFC
10922
07:20:07,760 --> 07:20:12,558
912 dot zones because you are defining
10923
07:20:10,080 --> 07:20:16,320
your forward and reverse zones inside
10924
07:20:12,558 --> 07:20:19,280
this location. Okay, now
10925
07:20:16,320 --> 07:20:22,638
now going back to the RFC1912
10926
07:20:19,280 --> 07:20:26,840
zones, I explained uh this part. Okay.
10927
07:20:22,638 --> 07:20:26,840
Now what you have to do is
10928
07:20:27,120 --> 07:20:30,600
1 minute guys.
10929
07:20:39,840 --> 07:20:44,478
Yeah. Sorry for the delay guys. 1
10930
07:20:42,000 --> 07:20:46,320
minute. Okay. Yeah. So what I was uh
10931
07:20:44,478 --> 07:20:48,558
what I was talking about is uh setting
10932
07:20:46,320 --> 07:20:50,878
the forward zone. We've done that here.
10933
07:20:48,558 --> 07:20:54,160
Now we need to go down and you would see
10934
07:20:50,878 --> 07:20:56,400
the reverse zone right here. Okay. Uh as
10935
07:20:54,160 --> 07:21:00,558
you can see when someone queries me with
10936
07:20:56,400 --> 07:21:02,478
the IP address of my system that time uh
10937
07:21:00,558 --> 07:21:04,878
we are specifying the rules for that in
10938
07:21:02,478 --> 07:21:06,320
uh this file called reverse.zone. Okay.
10939
07:21:04,878 --> 07:21:08,638
And this again would be present in the
10940
07:21:06,320 --> 07:21:10,240
same directory. And one thing which you
10941
07:21:08,638 --> 07:21:12,160
would find strange is we've uh we have
10942
07:21:10,240 --> 07:21:15,120
the subnet in the reverse order. Okay.
10943
07:21:12,160 --> 07:21:17,440
Now that's because uh that's how rules
10944
07:21:15,120 --> 07:21:18,478
are defined. So you don't this is the
10945
07:21:17,440 --> 07:21:21,840
only thing that's going to be different.
10946
07:21:18,478 --> 07:21:24,000
Instead of giving 192.168.56
10947
07:21:21,840 --> 07:21:25,600
you would have to give it the other way.
10948
07:21:24,000 --> 07:21:27,280
You have to first specify the class C
10949
07:21:25,600 --> 07:21:29,280
then comes class B and then class A.
10950
07:21:27,280 --> 07:21:30,958
Okay. The subnetting order is a little
10951
07:21:29,280 --> 07:21:33,520
different over here when you specify the
10952
07:21:30,958 --> 07:21:36,080
reverse dot zone. Uh the reason for that
10953
07:21:33,520 --> 07:21:38,478
is in the reverse dot zone you specify
10954
07:21:36,080 --> 07:21:40,638
the number of your IP address. So in my
10955
07:21:38,478 --> 07:21:43,920
case it's two. So I've specified two and
10956
07:21:40,638 --> 07:21:46,320
I've followed that up with the uh rules.
10957
07:21:43,920 --> 07:21:48,400
So for that purpose we specified in this
10958
07:21:46,320 --> 07:21:50,160
order. Okay, you would understand this
10959
07:21:48,400 --> 07:21:51,920
better later. Okay, so right now you
10960
07:21:50,160 --> 07:21:56,558
might get a little confused. So just
10961
07:21:51,920 --> 07:21:59,760
hang around. So let me just uh quit and
10962
07:21:56,558 --> 07:22:02,080
exit this. Now going back to my slides.
10963
07:21:59,760 --> 07:22:04,000
The next step is to actually create the
10964
07:22:02,080 --> 07:22:05,920
forward zones and the reverse zones.
10965
07:22:04,000 --> 07:22:08,558
Okay. And then open them and use the
10966
07:22:05,920 --> 07:22:09,920
template to basically create a rough
10967
07:22:08,558 --> 07:22:12,240
forward and reverse zones and then edit
10968
07:22:09,920 --> 07:22:14,320
them. So
10969
07:22:12,240 --> 07:22:17,520
now those would be present. Okay. Let me
10970
07:22:14,320 --> 07:22:21,400
first clear the screen guys.
10971
07:22:17,520 --> 07:22:21,400
Okay. So
10972
07:22:24,160 --> 07:22:30,360
let me do um
10973
07:22:27,360 --> 07:22:30,360
/vr/named
10974
07:22:30,798 --> 07:22:37,680
and uh I can do an ls first. Okay. So as
10975
07:22:35,520 --> 07:22:40,240
you can see right now we have something
10976
07:22:37,680 --> 07:22:42,478
called as named.lohost. Okay. Now this
10977
07:22:40,240 --> 07:22:45,440
is the uh file that provides the default
10978
07:22:42,478 --> 07:22:47,600
template. Okay. Now the forward dotzone
10979
07:22:45,440 --> 07:22:50,400
and the reverse dozone is what I created
10980
07:22:47,600 --> 07:22:53,760
based out of this. So using this I
10981
07:22:50,400 --> 07:22:56,478
created these two files and uh let me
10982
07:22:53,760 --> 07:23:01,240
now show you what I have uh made changes
10983
07:22:56,478 --> 07:23:01,240
in these two files. Okay.
10984
07:23:03,280 --> 07:23:08,320
So this is my forward.zone which I am
10985
07:23:05,360 --> 07:23:10,240
first editing. And as you can see we
10986
07:23:08,320 --> 07:23:12,478
have in the first line it says TTL. So
10987
07:23:10,240 --> 07:23:16,160
TTL stands for time to live and we say
10988
07:23:12,478 --> 07:23:19,680
that as one day. Okay. And when we say
10989
07:23:16,160 --> 07:23:22,718
add rate it basically means uh rules for
10990
07:23:19,680 --> 07:23:24,558
all. Okay. And in specifi stands for
10991
07:23:22,718 --> 07:23:26,080
internet and SOA stands for state of
10992
07:23:24,558 --> 07:23:27,600
authority. Now these are a couple of
10993
07:23:26,080 --> 07:23:29,280
terms which you might not understand
10994
07:23:27,600 --> 07:23:32,478
when you get started with DNS right
10995
07:23:29,280 --> 07:23:34,958
away. Okay. So the state of authority we
10996
07:23:32,478 --> 07:23:37,360
giving complete when we say add rate in
10997
07:23:34,958 --> 07:23:39,360
S SOA we are giving complete authority
10998
07:23:37,360 --> 07:23:42,718
to this particular domain. Okay that's
10999
07:23:39,360 --> 07:23:44,878
what's happening and uh right after
11000
07:23:42,718 --> 07:23:46,958
specifying S SOA with the tab space I
11001
07:23:44,878 --> 07:23:48,400
have said DNS1.van.com
11002
07:23:46,958 --> 07:23:50,558
this is my fully qualified domain name
11003
07:23:48,400 --> 07:23:54,400
to I'm giving complete uh authority.
11004
07:23:50,558 --> 07:23:56,478
Okay along with that I'm giving root dot
11005
07:23:54,400 --> 07:23:58,000
the fully qualified domain name. Now the
11006
07:23:56,478 --> 07:24:00,000
one rule which you have to note is after
11007
07:23:58,000 --> 07:24:03,040
I give the fully qualified domain name I
11008
07:24:00,000 --> 07:24:05,440
finish it with append that with a dot
11009
07:24:03,040 --> 07:24:08,000
that the same thing goes over here and
11010
07:24:05,440 --> 07:24:10,240
over here. Okay. Uh this is basically to
11011
07:24:08,000 --> 07:24:12,958
indicate that your uh domain is ending.
11012
07:24:10,240 --> 07:24:14,478
Okay. This is a syntax so you cannot
11013
07:24:12,958 --> 07:24:16,000
play around over here. So just make sure
11014
07:24:14,478 --> 07:24:17,520
that you have a dot and if there's any
11015
07:24:16,000 --> 07:24:19,840
time if there's an error make sure that
11016
07:24:17,520 --> 07:24:21,920
you check this because most of the time
11017
07:24:19,840 --> 07:24:23,840
errors would be because of uh giving of
11018
07:24:21,920 --> 07:24:26,798
failing to give a dot somewhere here.
11019
07:24:23,840 --> 07:24:28,000
Okay. And these are again set of rules
11020
07:24:26,798 --> 07:24:30,080
which you don't need to really worry
11021
07:24:28,000 --> 07:24:32,160
about. These are the rules when
11022
07:24:30,080 --> 07:24:33,920
something goes down it it's it's about
11023
07:24:32,160 --> 07:24:37,920
the backup. Okay. So what you need to uh
11024
07:24:33,920 --> 07:24:40,718
just edit is these two lines in your
11025
07:24:37,920 --> 07:24:43,280
forward.zone when I have said again
11026
07:24:40,718 --> 07:24:45,200
which stands for internet I've said that
11027
07:24:43,280 --> 07:24:47,520
the forward.zone over here would act as
11028
07:24:45,200 --> 07:24:49,680
a name server. Okay. So I'm setting up
11029
07:24:47,520 --> 07:24:51,440
my bind as a name server which would
11030
07:24:49,680 --> 07:24:53,760
basically resolve IP addresses and host
11031
07:24:51,440 --> 07:24:55,360
names. Okay. So NS stands for name
11032
07:24:53,760 --> 07:24:57,040
server. If you want to configure a mail
11033
07:24:55,360 --> 07:25:00,160
service over here then you can replace
11034
07:24:57,040 --> 07:25:01,760
NS with MX and uh similarly other
11035
07:25:00,160 --> 07:25:04,478
options okay with bind of course you
11036
07:25:01,760 --> 07:25:06,638
have these two options and I've uh added
11037
07:25:04,478 --> 07:25:08,878
name servers name server and I've said
11038
07:25:06,638 --> 07:25:11,040
my server is DNS1.wan.com
11039
07:25:08,878 --> 07:25:15,040
okay and
11040
07:25:11,040 --> 07:25:18,000
the domain the DNS one I've given the IP
11041
07:25:15,040 --> 07:25:21,440
address of 192.160.2
11042
07:25:18,000 --> 07:25:23,040
two. Okay. So whenever this domain is uh
11043
07:25:21,440 --> 07:25:25,520
queried
11044
07:25:23,040 --> 07:25:28,558
then the address for that query over
11045
07:25:25,520 --> 07:25:32,080
here is the server. Okay. The server
11046
07:25:28,558 --> 07:25:34,478
address would be 192.168.56.2.
11047
07:25:32,080 --> 07:25:38,080
So that's what the forward zone does.
11048
07:25:34,478 --> 07:25:40,718
Now let me just uh quickly exit this and
11049
07:25:38,080 --> 07:25:44,000
open my
11050
07:25:40,718 --> 07:25:45,360
reverse zone. And here the only
11051
07:25:44,000 --> 07:25:48,000
difference that you would see is the
11052
07:25:45,360 --> 07:25:49,920
last line over here. Okay. So we the
11053
07:25:48,000 --> 07:25:53,120
other rules are the same. You're saying
11054
07:25:49,920 --> 07:25:54,718
complete state of authority to your uh
11055
07:25:53,120 --> 07:25:57,440
to your domain name here. And then these
11056
07:25:54,718 --> 07:25:59,200
rules are the same. And uh you're also
11057
07:25:57,440 --> 07:26:02,320
defining the name server for
11058
07:25:59,200 --> 07:26:05,360
dns1.ben.com which is my domain name.
11059
07:26:02,320 --> 07:26:07,680
But in instead of y we have ptr. So yay
11060
07:26:05,360 --> 07:26:10,400
over there stands for address, right? Uh
11061
07:26:07,680 --> 07:26:12,080
that's pointing to your address. But
11062
07:26:10,400 --> 07:26:14,400
when you say ptr, it's basically
11063
07:26:12,080 --> 07:26:16,160
pointing to your IP address. So because
11064
07:26:14,400 --> 07:26:18,160
it's a reverse lookup, right? So from
11065
07:26:16,160 --> 07:26:19,440
your IP address it's looking up to your
11066
07:26:18,160 --> 07:26:22,000
domain name. So that's why we replace
11067
07:26:19,440 --> 07:26:26,240
this with ptr. This all this is the
11068
07:26:22,000 --> 07:26:30,160
syntax. So you uh say ptr and then you
11069
07:26:26,240 --> 07:26:32,478
give the uh if it's 56.2 in my case. So
11070
07:26:30,160 --> 07:26:34,160
I've given two over here. Okay. Now some
11071
07:26:32,478 --> 07:26:36,958
of you might have had a doubt why I gave
11072
07:26:34,160 --> 07:26:38,638
that in reverse 192.168.56.
11073
07:26:36,958 --> 07:26:43,360
So that's because the rules start from
11074
07:26:38,638 --> 07:26:46,798
here. So it's 256 dot 168.12. So uh it
11075
07:26:43,360 --> 07:26:48,398
would look up in that fashion right so
11076
07:26:46,798 --> 07:26:50,558
now I hope now you would have understood
11077
07:26:48,398 --> 07:26:53,280
why I did that and uh yeah it's pretty
11078
07:26:50,558 --> 07:26:57,718
much it and this is all that's needed to
11079
07:26:53,280 --> 07:26:57,718
set up your DNS server okay
11080
07:26:58,240 --> 07:27:03,920
so let me just uh quit this again and uh
11081
07:27:01,200 --> 07:27:06,478
I'm going to clear the screen
11082
07:27:03,920 --> 07:27:08,080
so the ninth step that's uh that needs
11083
07:27:06,478 --> 07:27:09,680
to be done is that of changing the group
11084
07:27:08,080 --> 07:27:12,000
ownership of these two files. Okay, you
11085
07:27:09,680 --> 07:27:13,520
give them complete uh root access. Uh
11086
07:27:12,000 --> 07:27:16,160
this is something that I've already done
11087
07:27:13,520 --> 07:27:18,080
so I don't need to uh brush up on this.
11088
07:27:16,160 --> 07:27:22,558
And uh finally the 10th step is to
11089
07:27:18,080 --> 07:27:27,000
restart your named service. Okay. Now
11090
07:27:22,558 --> 07:27:27,000
let me just apply the command for that.
11091
07:27:32,638 --> 07:27:37,360
Okay. So
11092
07:27:35,760 --> 07:27:39,440
service namely restart. This is a
11093
07:27:37,360 --> 07:27:42,320
command to restart my service. And it
11094
07:27:39,440 --> 07:27:44,718
says uh it's stopping my service. Okay.
11095
07:27:42,320 --> 07:27:47,680
And it started my name service. Great.
11096
07:27:44,718 --> 07:27:49,600
Now uh to check if our uh connection is
11097
07:27:47,680 --> 07:27:52,478
up and running, we can do a dig command
11098
07:27:49,600 --> 07:27:55,120
which basically uh digs for our name
11099
07:27:52,478 --> 07:27:58,398
service. And as you can see, it says
11100
07:27:55,120 --> 07:28:01,360
that uh the status there's no error and
11101
07:27:58,398 --> 07:28:04,160
it's uh giving you all these uh details.
11102
07:28:01,360 --> 07:28:06,240
But to understand better, you need to
11103
07:28:04,160 --> 07:28:08,798
just look at this particular server. If
11104
07:28:06,240 --> 07:28:10,718
this is coming perfectly, right? So the
11105
07:28:08,798 --> 07:28:13,680
server that you set your DNS service for
11106
07:28:10,718 --> 07:28:16,080
is uh this one 192.168.56.2.
11107
07:28:13,680 --> 07:28:17,920
So that is coming up here. It's uh
11108
07:28:16,080 --> 07:28:22,000
perfect. And it also says it's it's
11109
07:28:17,920 --> 07:28:23,920
under port 53 uh as we suggested. Now
11110
07:28:22,000 --> 07:28:26,478
you can uh verify this in in another way
11111
07:28:23,920 --> 07:28:29,040
by supplying this command ns lookup
11112
07:28:26,478 --> 07:28:32,160
command and specify the domain name. Uh
11113
07:28:29,040 --> 07:28:35,280
in my case it's DNS1.
11114
07:28:32,160 --> 07:28:38,638
com. So when I hit enter, you can see
11115
07:28:35,280 --> 07:28:41,200
that uh it says the server is my IP
11116
07:28:38,638 --> 07:28:43,200
address. Uh the address where it's
11117
07:28:41,200 --> 07:28:45,840
hosted is the port number 53 inside the
11118
07:28:43,200 --> 07:28:49,200
same IP address and the domain name is
11119
07:28:45,840 --> 07:28:53,160
uh this and my IP address. Now similarly
11120
07:28:49,200 --> 07:28:53,160
when I do a reverse lookup
11121
07:28:53,760 --> 07:28:57,478
I can do a 192.168.56.2.
11122
07:28:59,040 --> 07:29:04,000
When I do this, it returns me my domain
11123
07:29:01,600 --> 07:29:05,760
name again. Right? So this is the
11124
07:29:04,000 --> 07:29:08,798
server. This is the port number and
11125
07:29:05,760 --> 07:29:11,040
where it's running and the uh lookup
11126
07:29:08,798 --> 07:29:13,600
done in reverse fashion.
11127
07:29:11,040 --> 07:29:17,440
Right? And uh it's pointing to my
11128
07:29:13,600 --> 07:29:19,280
correct domain name. So this is what uh
11129
07:29:17,440 --> 07:29:21,840
a DNS server does. So this is how you
11130
07:29:19,280 --> 07:29:23,760
set up a DNS server guys. Now some of
11131
07:29:21,840 --> 07:29:25,600
you might uh you know have a doubt as to
11132
07:29:23,760 --> 07:29:27,360
okay we've done we are doing the lookup
11133
07:29:25,600 --> 07:29:29,600
from the server that's why we are
11134
07:29:27,360 --> 07:29:32,080
getting to see the details uh the
11135
07:29:29,600 --> 07:29:34,160
correct details here now right so you're
11136
07:29:32,080 --> 07:29:35,920
not uh you know having a verification
11137
07:29:34,160 --> 07:29:37,840
you don't have a verification as to if
11138
07:29:35,920 --> 07:29:40,798
you can actually see this domain name
11139
07:29:37,840 --> 07:29:42,240
from other systems also now to answer
11140
07:29:40,798 --> 07:29:45,200
that question I can show it to you from
11141
07:29:42,240 --> 07:29:49,200
a different VM so this is one VM I can
11142
07:29:45,200 --> 07:29:50,878
go to my second VM here
11143
07:29:49,200 --> 07:29:52,718
Right.
11144
07:29:50,878 --> 07:29:56,120
And uh let me open up my terminal first
11145
07:29:52,718 --> 07:29:56,120
of all. Uh
11146
07:30:00,320 --> 07:30:04,958
okay, I'm going to do an if config
11147
07:30:03,040 --> 07:30:07,600
and yeah, this is my IP address of this
11148
07:30:04,958 --> 07:30:10,160
VM. Okay, now let's see if this uh from
11149
07:30:07,600 --> 07:30:13,680
this VM if I do a reverse uh lookup uh
11150
07:30:10,160 --> 07:30:15,120
sorry, if I do a lookup to my uh domain
11151
07:30:13,680 --> 07:30:17,200
name, let's see if it's pointing to the
11152
07:30:15,120 --> 07:30:18,638
correct address, right? You guys notice
11153
07:30:17,200 --> 07:30:20,638
that this has a different IP address.
11154
07:30:18,638 --> 07:30:25,280
Right? Now, let me supply the same
11155
07:30:20,638 --> 07:30:27,440
command nsookup and say my uh IP my my
11156
07:30:25,280 --> 07:30:29,200
domain name here
11157
07:30:27,440 --> 07:30:33,040
van.com.
11158
07:30:29,200 --> 07:30:35,280
Okay. And when I hit enter u okay so
11159
07:30:33,040 --> 07:30:38,080
it's giving an invalid address now
11160
07:30:35,280 --> 07:30:40,240
that's because we have not set the name
11161
07:30:38,080 --> 07:30:41,760
server right. So there was one uh point
11162
07:30:40,240 --> 07:30:44,638
number six which I told you that we had
11163
07:30:41,760 --> 07:30:47,920
to do even on your client side.
11164
07:30:44,638 --> 07:30:49,760
Now it is this point
11165
07:30:47,920 --> 07:30:52,240
this one right where you you will
11166
07:30:49,760 --> 07:30:54,080
configure the resolve. file you have to
11167
07:30:52,240 --> 07:30:56,240
set the name server which you want your
11168
07:30:54,080 --> 07:30:58,000
system to look up to. So that is what
11169
07:30:56,240 --> 07:30:59,600
you have to do over here. So at every
11170
07:30:58,000 --> 07:31:01,760
client if you want to resolve the domain
11171
07:30:59,600 --> 07:31:05,718
name you have to do that. And uh the
11172
07:31:01,760 --> 07:31:05,718
command for that is uh
11173
07:31:09,680 --> 07:31:14,638
resolve.conf. Okay.
11174
07:31:12,478 --> 07:31:17,680
And there goes the password. As you can
11175
07:31:14,638 --> 07:31:20,080
see, we have uh the default ones over
11176
07:31:17,680 --> 07:31:25,320
here. Now, let me replace, let me first
11177
07:31:20,080 --> 07:31:25,320
comment these two lines and
11178
07:31:25,600 --> 07:31:31,040
change the IP address over here and
11179
07:31:27,360 --> 07:31:36,680
point it to my name server. So, my name
11180
07:31:31,040 --> 07:31:36,680
server, my DNS name server is 36.2.
11181
07:31:37,760 --> 07:31:42,798
Save and exit. Now if I supply the same
11182
07:31:40,638 --> 07:31:45,200
command ns lookup command. Now you can
11183
07:31:42,798 --> 07:31:47,120
see that it's pointing to my IP address
11184
07:31:45,200 --> 07:31:49,760
and it says the port number where it's
11185
07:31:47,120 --> 07:31:52,398
hosted is 53 and it's resolving my
11186
07:31:49,760 --> 07:31:54,398
domain name and this is the address.
11187
07:31:52,398 --> 07:31:58,840
From here let's uh check even the
11188
07:31:54,398 --> 07:31:58,840
reverse lookup. Okay.
11189
07:32:03,040 --> 07:32:07,600
And when you do that the reverse lookup
11190
07:32:05,120 --> 07:32:09,680
also works exactly the way we want it.
11191
07:32:07,600 --> 07:32:12,320
Correct. So, it's pointing to my domain
11192
07:32:09,680 --> 07:32:14,160
name. And uh yeah, that's how this
11193
07:32:12,320 --> 07:32:16,878
works, guys. So, that's how you set up a
11194
07:32:14,160 --> 07:32:19,878
DNS server. And this is a simple 10-step
11195
07:32:16,878 --> 07:32:19,878
process.
11196
07:32:20,540 --> 07:32:23,589
[Music]
11197
07:32:23,840 --> 07:32:29,120
Now, let's talk about what is shell GPT.
11198
07:32:26,798 --> 07:32:32,080
Shell GPT is a command line tool that
11199
07:32:29,120 --> 07:32:34,558
harnesses the power of GPT models. It
11200
07:32:32,080 --> 07:32:36,718
enables Linux users to perform natural
11201
07:32:34,558 --> 07:32:39,760
language processing tasks directly from
11202
07:32:36,718 --> 07:32:42,160
the shell by integrating GPT models into
11203
07:32:39,760 --> 07:32:44,080
your terminal. Shell GPT allows you to
11204
07:32:42,160 --> 07:32:46,240
interact with AI in a familiar
11205
07:32:44,080 --> 07:32:48,558
environment, making it a powerful tool
11206
07:32:46,240 --> 07:32:51,440
for developers, system administrators,
11207
07:32:48,558 --> 07:32:54,558
and enthusiasts. Now, let's see how does
11208
07:32:51,440 --> 07:32:56,958
Shell GPT work. Shell GPT sends user
11209
07:32:54,558 --> 07:32:59,120
prompts to open AI's API from the
11210
07:32:56,958 --> 07:33:02,240
terminal and then returns responses
11211
07:32:59,120 --> 07:33:04,558
generated by GPT model. This interaction
11212
07:33:02,240 --> 07:33:06,718
occurs seamlessly allowing for quick
11213
07:33:04,558 --> 07:33:09,040
queries, code generation or task
11214
07:33:06,718 --> 07:33:11,360
automation within your shell. Here's a
11215
07:33:09,040 --> 07:33:14,478
simplified workflow of how Shell GPT
11216
07:33:11,360 --> 07:33:16,478
operates. Firstly, the user input. You
11217
07:33:14,478 --> 07:33:19,120
type a query or request in natural
11218
07:33:16,478 --> 07:33:21,680
language or code. Then, shell GPT
11219
07:33:19,120 --> 07:33:24,718
processing. Shell GPT sends your query
11220
07:33:21,680 --> 07:33:27,440
to open AI's GPT model. Next is the
11221
07:33:24,718 --> 07:33:30,160
model response. The GPT model generates
11222
07:33:27,440 --> 07:33:32,398
a response based on the input. Last is
11223
07:33:30,160 --> 07:33:35,280
the output. The result is displayed in
11224
07:33:32,398 --> 07:33:37,520
the terminal for further actions. Moving
11225
07:33:35,280 --> 07:33:40,958
forward, let's talk about why use shell
11226
07:33:37,520 --> 07:33:43,840
GPT on Linux. Shell GPT offers multiple
11227
07:33:40,958 --> 07:33:46,000
advantages for Linux users. First is the
11228
07:33:43,840 --> 07:33:48,478
efficiency. You can automate repetitive
11229
07:33:46,000 --> 07:33:50,718
tasks, generate scripts or troubleshoot
11230
07:33:48,478 --> 07:33:52,878
without leaving the terminal. Then is
11231
07:33:50,718 --> 07:33:55,200
the natural language. Instead of writing
11232
07:33:52,878 --> 07:33:58,080
complex code, you can describe tasks in
11233
07:33:55,200 --> 07:34:00,240
plain English. Next, customization.
11234
07:33:58,080 --> 07:34:02,160
Shell GPT can adapt to your specific
11235
07:34:00,240 --> 07:34:04,558
workflows offering personalized
11236
07:34:02,160 --> 07:34:06,478
responses over time. Last is the code
11237
07:34:04,558 --> 07:34:09,440
assistance. Whether you need quick
11238
07:34:06,478 --> 07:34:12,798
solution or code snippets, Shell GPT
11239
07:34:09,440 --> 07:34:15,120
assists in real time. Now let's see how
11240
07:34:12,798 --> 07:34:18,160
to install the Shell GPT on our Linux
11241
07:34:15,120 --> 07:34:20,478
system. Here I'm using the Kali Linux as
11242
07:34:18,160 --> 07:34:23,360
my base operating system, but you can
11243
07:34:20,478 --> 07:34:25,360
use your preferred Linux distribution.
11244
07:34:23,360 --> 07:34:27,920
Here we are at the official GitHub
11245
07:34:25,360 --> 07:34:30,718
repository of Shell GPT.
11246
07:34:27,920 --> 07:34:33,680
If we scroll down, we have the
11247
07:34:30,718 --> 07:34:36,798
installation guide as well. So, we will
11248
07:34:33,680 --> 07:34:39,840
follow this guide in our installation.
11249
07:34:36,798 --> 07:34:41,760
Now, let's head over to our terminal
11250
07:34:39,840 --> 07:34:43,280
and start with creating virtual
11251
07:34:41,760 --> 07:34:45,440
environment.
11252
07:34:43,280 --> 07:34:47,840
This helps keep your project organized
11253
07:34:45,440 --> 07:34:50,478
and avoids conflicts with other Python
11254
07:34:47,840 --> 07:34:52,798
packages. So, first up, let's start
11255
07:34:50,478 --> 07:34:54,958
creating a directory. For that, let's
11256
07:34:52,798 --> 07:34:57,440
type the command.
11257
07:34:54,958 --> 07:35:00,320
Now, let's click on enter. Now let's
11258
07:34:57,440 --> 07:35:02,160
move in to this directory.
11259
07:35:00,320 --> 07:35:04,398
So now we will set up the virtual
11260
07:35:02,160 --> 07:35:06,798
environment. For this we will use
11261
07:35:04,398 --> 07:35:09,840
Python. So now let's type the command
11262
07:35:06,798 --> 07:35:11,840
for it.
11263
07:35:09,840 --> 07:35:14,958
This creates a virtual environment in
11264
07:35:11,840 --> 07:35:18,160
the SGPT folder. Now let's activate the
11265
07:35:14,958 --> 07:35:20,320
virtual environment.
11266
07:35:18,160 --> 07:35:22,478
This activates the virtual environment
11267
07:35:20,320 --> 07:35:25,200
so that any packages you install are
11268
07:35:22,478 --> 07:35:26,878
isolated within this project. You'll
11269
07:35:25,200 --> 07:35:29,040
know it's activated because your
11270
07:35:26,878 --> 07:35:31,360
terminal will show sgptt at the
11271
07:35:29,040 --> 07:35:33,840
beginning of the line. With the virtual
11272
07:35:31,360 --> 07:35:37,120
environment ready, let's install shell
11273
07:35:33,840 --> 07:35:38,798
gpd. Now let's go to the web browser.
11274
07:35:37,120 --> 07:35:41,280
Now let's copy this command from the
11275
07:35:38,798 --> 07:35:45,600
GitHub repository and let's head back to
11276
07:35:41,280 --> 07:35:48,558
our terminal and paste it here
11277
07:35:45,600 --> 07:35:51,200
and click on enter.
11278
07:35:48,558 --> 07:35:54,000
This downloads and installs shell gpt.
11279
07:35:51,200 --> 07:35:56,638
So it's ready to use.
11280
07:35:54,000 --> 07:35:59,840
Next, you need to configure the API key
11281
07:35:56,638 --> 07:36:03,120
to connect Shell GPT with OpenAI.
11282
07:35:59,840 --> 07:36:05,280
Next, we'll go back to our browser.
11283
07:36:03,120 --> 07:36:08,718
We'll go to the Open AI platform and
11284
07:36:05,280 --> 07:36:10,638
create a new API key. For this, click on
11285
07:36:08,718 --> 07:36:13,280
new secret key that's seen on the
11286
07:36:10,638 --> 07:36:16,000
screen. You can enter any name
11287
07:36:13,280 --> 07:36:17,600
preferable here. I'll be entering it as
11288
07:36:16,000 --> 07:36:19,120
SGPT.
11289
07:36:17,600 --> 07:36:21,760
Let's keep the project as default
11290
07:36:19,120 --> 07:36:25,120
project itself. And then let's click on
11291
07:36:21,760 --> 07:36:25,120
create secret key.
11292
07:36:25,920 --> 07:36:31,760
Let's copy the secret key and store it
11293
07:36:28,080 --> 07:36:35,200
in our system. So let's copy this. Let's
11294
07:36:31,760 --> 07:36:39,200
go to a Kali Linux. So here let's go to
11295
07:36:35,200 --> 07:36:41,920
the text editor. Paste our secret key
11296
07:36:39,200 --> 07:36:46,160
and save this.
11297
07:36:41,920 --> 07:36:48,080
Let's just give the name as SGPT key for
11298
07:36:46,160 --> 07:36:50,558
our remembrance
11299
07:36:48,080 --> 07:36:53,200
and save it on our desktop
11300
07:36:50,558 --> 07:36:54,718
and press enter. Now let's minimize
11301
07:36:53,200 --> 07:36:57,680
this.
11302
07:36:54,718 --> 07:37:01,040
Now let's clear our terminal.
11303
07:36:57,680 --> 07:37:03,920
Now let's export the API key.
11304
07:37:01,040 --> 07:37:06,160
Now let's copy the API key that we have
11305
07:37:03,920 --> 07:37:08,958
stored it in the text editor and let's
11306
07:37:06,160 --> 07:37:11,120
paste it on our terminal.
11307
07:37:08,958 --> 07:37:14,080
This command temporarily sets the open
11308
07:37:11,120 --> 07:37:16,718
AI API key as an environment variable.
11309
07:37:14,080 --> 07:37:19,040
So shell GPT can use it. To avoid
11310
07:37:16,718 --> 07:37:23,440
setting it every time, make it permanent
11311
07:37:19,040 --> 07:37:26,080
by adding it to your bash rc file.
11312
07:37:23,440 --> 07:37:29,200
This will save your open AI API key in
11313
07:37:26,080 --> 07:37:31,440
the bash rc file which runs every time
11314
07:37:29,200 --> 07:37:33,920
you open a terminal to set environment
11315
07:37:31,440 --> 07:37:36,160
variables. To ensure everything is
11316
07:37:33,920 --> 07:37:38,478
working, check the version of the shell
11317
07:37:36,160 --> 07:37:40,558
gp installed.
11318
07:37:38,478 --> 07:37:43,840
So here you can see that our version of
11319
07:37:40,558 --> 07:37:46,160
shell gpt is 1.4.4.
11320
07:37:43,840 --> 07:37:49,478
Now let's test our shell GPT with a
11321
07:37:46,160 --> 07:37:49,478
simple command.
11322
07:37:49,840 --> 07:37:53,600
So here you can see there is an
11323
07:37:51,280 --> 07:37:57,760
authentication error. This is because I
11324
07:37:53,600 --> 07:38:00,160
have entered the API key two times.
11325
07:37:57,760 --> 07:38:02,398
Also you can see something like this.
11326
07:38:00,160 --> 07:38:04,558
It's because the open API key requires
11327
07:38:02,398 --> 07:38:06,958
an active subscription or credits to
11328
07:38:04,558 --> 07:38:09,040
process the request. Since we don't want
11329
07:38:06,958 --> 07:38:11,520
to buy credits right now, we'll move
11330
07:38:09,040 --> 07:38:14,240
forward with an alternative that is the
11331
07:38:11,520 --> 07:38:17,280
Olama, a free and open-source option to
11332
07:38:14,240 --> 07:38:20,160
use Shell GPT without these limitations.
11333
07:38:17,280 --> 07:38:23,440
Let's set it up next. So before
11334
07:38:20,160 --> 07:38:26,240
starting, let's clear all.
11335
07:38:23,440 --> 07:38:30,080
Now let's go to the web browser. In the
11336
07:38:26,240 --> 07:38:31,760
address bar, let's type. Click on enter.
11337
07:38:30,080 --> 07:38:34,080
Click on the very first link that you
11338
07:38:31,760 --> 07:38:37,440
can see.
11339
07:38:34,080 --> 07:38:39,280
Click on download option here.
11340
07:38:37,440 --> 07:38:41,520
So here you can see different download
11341
07:38:39,280 --> 07:38:44,558
options for different operating systems.
11342
07:38:41,520 --> 07:38:47,120
So as I am using the Linux. So now let's
11343
07:38:44,558 --> 07:38:49,600
copy this command and paste it on a
11344
07:38:47,120 --> 07:38:52,798
terminal.
11345
07:38:49,600 --> 07:38:54,478
Now let's enter the password
11346
07:38:52,798 --> 07:38:56,798
by clicking enter. This will start
11347
07:38:54,478 --> 07:38:58,958
getting downloaded. So be patient until
11348
07:38:56,798 --> 07:39:00,718
the download finishes.
11349
07:38:58,958 --> 07:39:02,558
If you see something like this, that
11350
07:39:00,718 --> 07:39:04,160
means the Olama has successfully
11351
07:39:02,558 --> 07:39:06,958
installed.
11352
07:39:04,160 --> 07:39:09,840
Now, let's go back to our browser. Click
11353
07:39:06,958 --> 07:39:14,798
on models.
11354
07:39:09,840 --> 07:39:18,000
Scroll down until you find Llama 3.2.
11355
07:39:14,798 --> 07:39:20,160
Choose the version as 1B.
11356
07:39:18,000 --> 07:39:24,440
Copy this command
11357
07:39:20,160 --> 07:39:24,440
and paste it onto your terminal.
11358
07:39:25,440 --> 07:39:30,320
So, there you go. The success message
11359
07:39:27,840 --> 07:39:32,798
shows that the Llama 3.2 model is
11360
07:39:30,320 --> 07:39:37,160
successfully installed. In order to test
11361
07:39:32,798 --> 07:39:37,160
this, let's type a message.
11362
07:39:38,080 --> 07:39:42,798
So this response indicates that it's
11363
07:39:40,160 --> 07:39:45,200
working perfectly. So for now, let's
11364
07:39:42,798 --> 07:39:48,478
exit this model
11365
07:39:45,200 --> 07:39:51,120
and let's clear our terminal.
11366
07:39:48,478 --> 07:39:53,440
Now let's go to our web browser again in
11367
07:39:51,120 --> 07:39:55,840
the GitHub repository. Here is a tip
11368
07:39:53,440 --> 07:39:58,478
given which says alternatively you can
11369
07:39:55,840 --> 07:40:01,040
use locally hosted open-source models
11370
07:39:58,478 --> 07:40:03,040
which are available for free. So now
11371
07:40:01,040 --> 07:40:05,520
let's click on the guide to get the
11372
07:40:03,040 --> 07:40:08,558
alarm installation.
11373
07:40:05,520 --> 07:40:11,680
So let's scroll down and let's copy this
11374
07:40:08,558 --> 07:40:13,840
command of pip install.
11375
07:40:11,680 --> 07:40:16,840
Go to our terminal and paste this
11376
07:40:13,840 --> 07:40:16,840
command.
11377
07:40:22,080 --> 07:40:28,320
After this we will be making some
11378
07:40:23,920 --> 07:40:32,718
changes in the sgbtrc file. So now let's
11379
07:40:28,320 --> 07:40:34,878
open it in our nano editor.
11380
07:40:32,718 --> 07:40:40,120
So now let's move down to our default
11381
07:40:34,878 --> 07:40:40,120
model and change it to
11382
07:40:40,638 --> 07:40:44,718
slash
11383
07:40:42,398 --> 07:40:46,878
llama.
11384
07:40:44,718 --> 07:40:51,840
Let's move down to our open AI use
11385
07:40:46,878 --> 07:40:55,120
functions. Let's set this to false.
11386
07:40:51,840 --> 07:40:58,080
Scroll down a bit. Now let's set use
11387
07:40:55,120 --> 07:41:01,280
light lm to true.
11388
07:40:58,080 --> 07:41:03,760
We will also change this open API key.
11389
07:41:01,280 --> 07:41:06,558
Let's just type a random string. I'll be
11390
07:41:03,760 --> 07:41:08,478
giving it as one six times. Now let's
11391
07:41:06,558 --> 07:41:10,798
save this
11392
07:41:08,478 --> 07:41:13,680
as our setup is completed. Now let's
11393
07:41:10,798 --> 07:41:16,000
test the shell GPT again. So now let's
11394
07:41:13,680 --> 07:41:19,398
ask for it what operating system are we
11395
07:41:16,000 --> 07:41:19,398
currently using.
11396
07:41:19,600 --> 07:41:23,840
So as you can see it has responded that
11397
07:41:21,760 --> 07:41:25,680
we are using the Kali Linux operating
11398
07:41:23,840 --> 07:41:27,840
system.
11399
07:41:25,680 --> 07:41:30,558
Let's try something else. Now we will
11400
07:41:27,840 --> 07:41:32,798
use the C flag to generate a Python code
11401
07:41:30,558 --> 07:41:35,360
which will list all the users on this
11402
07:41:32,798 --> 07:41:37,360
operating system.
11403
07:41:35,360 --> 07:41:39,200
As you can see, it has already started
11404
07:41:37,360 --> 07:41:42,000
generating the Python code that we have
11405
07:41:39,200 --> 07:41:44,478
asked for. So here you go. This is the
11406
07:41:42,000 --> 07:41:46,320
Python code to list all the users on the
11407
07:41:44,478 --> 07:41:48,718
system.
11408
07:41:46,320 --> 07:41:50,798
In order to exit the shell GPT, enter
11409
07:41:48,718 --> 07:41:53,120
deactivate.
11410
07:41:50,798 --> 07:41:55,680
Now let's conclude by saying that Shell
11411
07:41:53,120 --> 07:41:57,680
GPT is a powerful tool that brings AI
11412
07:41:55,680 --> 07:42:00,240
powered natural language processing into
11413
07:41:57,680 --> 07:42:02,558
the Linux command line. Whether you're a
11414
07:42:00,240 --> 07:42:05,040
developer, system administrator, or tech
11415
07:42:02,558 --> 07:42:07,200
enthusiast, Shell GPT can help you
11416
07:42:05,040 --> 07:42:09,600
automate tasks, generate code, and
11417
07:42:07,200 --> 07:42:12,160
streamline your workflow. By integrating
11418
07:42:09,600 --> 07:42:14,160
Shell GPT into your Linux environment,
11419
07:42:12,160 --> 07:42:16,478
you can leverage the power of AI to
11420
07:42:14,160 --> 07:42:19,478
simplify complex processes and boost
11421
07:42:16,478 --> 07:42:19,478
productivity.
11422
07:42:20,330 --> 07:42:25,360
[Music]
11423
07:42:23,280 --> 07:42:27,760
Now let's move on to our command line
11424
07:42:25,360 --> 07:42:30,160
essentials. For that I'm going to take
11425
07:42:27,760 --> 07:42:31,840
you to the terminal. Now because this is
11426
07:42:30,160 --> 07:42:33,920
a scripting video, we're going to spend
11427
07:42:31,840 --> 07:42:36,000
a lot of time on the command line
11428
07:42:33,920 --> 07:42:38,240
interface. Now this is important because
11429
07:42:36,000 --> 07:42:41,280
it saves you a ton of time. You can't
11430
07:42:38,240 --> 07:42:43,920
just keep switching from CLI to GUI in
11431
07:42:41,280 --> 07:42:46,958
any real life given scenario. So I am
11432
07:42:43,920 --> 07:42:49,280
using CentOS 7 the Fedora version and
11433
07:42:46,958 --> 07:42:51,520
I'm running it on a virtual machine. So
11434
07:42:49,280 --> 07:42:54,000
first of all what I'm going to do is I'm
11435
07:42:51,520 --> 07:42:55,920
going to increase the size of the text a
11436
07:42:54,000 --> 07:42:59,040
little bit. I think this should be fine.
11437
07:42:55,920 --> 07:43:01,200
And then let's start with making a list
11438
07:42:59,040 --> 07:43:03,280
of all the commands that we shall be
11439
07:43:01,200 --> 07:43:07,040
acquainting ourselves with. For that I'm
11440
07:43:03,280 --> 07:43:10,878
going to open the nano editor and I'm
11441
07:43:07,040 --> 07:43:13,360
going to name this CLI essentials. All
11442
07:43:10,878 --> 07:43:15,760
right. Now, nano editor is basically a
11443
07:43:13,360 --> 07:43:18,240
text editor like any other. I could have
11444
07:43:15,760 --> 07:43:20,240
used whim instead of it, but I like the
11445
07:43:18,240 --> 07:43:23,120
nano editor because it gives you a bunch
11446
07:43:20,240 --> 07:43:25,840
of options in the bottom and it's just
11447
07:43:23,120 --> 07:43:29,120
easier to use. So, let's start with our
11448
07:43:25,840 --> 07:43:31,840
list. So, we have our basics which are
11449
07:43:29,120 --> 07:43:33,920
cd which means change directory, pwd
11450
07:43:31,840 --> 07:43:37,680
which will show you the directory. Then
11451
07:43:33,920 --> 07:43:41,040
we have ls or list. Then we have the
11452
07:43:37,680 --> 07:43:44,080
next segment which is the copy, the move
11453
07:43:41,040 --> 07:43:47,120
and the remove. They pretty much do what
11454
07:43:44,080 --> 07:43:50,798
the name suggests. The copy, move and
11455
07:43:47,120 --> 07:43:53,680
remove respectively. Then you have echo
11456
07:43:50,798 --> 07:43:56,638
which is like Linux's version of print.
11457
07:43:53,680 --> 07:43:59,440
You have cat or concatenate. Then you
11458
07:43:56,638 --> 07:44:02,160
have less which by definition both of
11459
07:43:59,440 --> 07:44:03,680
them should sound pretty similar but in
11460
07:44:02,160 --> 07:44:07,440
a bit I'll tell you why they are
11461
07:44:03,680 --> 07:44:09,920
different. Then we have GP. We have
11462
07:44:07,440 --> 07:44:13,280
MKDIR which basically helps you make a
11463
07:44:09,920 --> 07:44:15,520
directory. And then we have touch which
11464
07:44:13,280 --> 07:44:18,798
basically helps you make files pretty
11465
07:44:15,520 --> 07:44:20,718
quickly. Then we have change mode which
11466
07:44:18,798 --> 07:44:24,000
is also pretty significant. I'll tell
11467
07:44:20,718 --> 07:44:27,040
you in a bit why. And then finally we
11468
07:44:24,000 --> 07:44:30,080
have man plus help which is basically
11469
07:44:27,040 --> 07:44:33,760
like a manual. Then if I had to save
11470
07:44:30,080 --> 07:44:35,760
this I just have to write out. So, Ctrl
11471
07:44:33,760 --> 07:44:38,080
O. Then it'll ask you whether this is
11472
07:44:35,760 --> 07:44:40,798
the name you want to save this with and
11473
07:44:38,080 --> 07:44:43,360
hit enter. And then it tells us that
11474
07:44:40,798 --> 07:44:46,878
we've written 14 lines. Now, all I want
11475
07:44:43,360 --> 07:44:50,398
to do is exit this. So, Ctrl X. And here
11476
07:44:46,878 --> 07:44:53,200
we are back on our basic terminal. So,
11477
07:44:50,398 --> 07:44:56,240
let's start change directory. Right now,
11478
07:44:53,200 --> 07:45:00,240
as you can see, we are at Edureka, our
11479
07:44:56,240 --> 07:45:02,718
current working directory. So, cd /home.
11480
07:45:00,240 --> 07:45:08,080
It's as simple as that. Now we are at
11481
07:45:02,718 --> 07:45:12,398
home. Then we can do a cd and back to
11482
07:45:08,080 --> 07:45:14,558
edureka. There you go. Then we have pwd
11483
07:45:12,398 --> 07:45:17,360
which will show you your current working
11484
07:45:14,558 --> 07:45:19,120
directory. As you can see it shows home/
11485
07:45:17,360 --> 07:45:22,958
edureka. It's the path of our current
11486
07:45:19,120 --> 07:45:25,840
working directory. Then we have ls. It
11487
07:45:22,958 --> 07:45:28,160
shows all these files that are there in
11488
07:45:25,840 --> 07:45:32,398
our current working directory. Not just
11489
07:45:28,160 --> 07:45:35,840
that you can also write ls and specify a
11490
07:45:32,398 --> 07:45:38,638
path name. So then it'll give you the
11491
07:45:35,840 --> 07:45:41,920
list of objects that is there in that
11492
07:45:38,638 --> 07:45:44,478
particular file. So at home you have
11493
07:45:41,920 --> 07:45:46,878
these two files called edureka and
11494
07:45:44,478 --> 07:45:49,600
vagrant. Now what else can we do with
11495
07:45:46,878 --> 07:45:51,760
ls? We can go ahead and look at the
11496
07:45:49,600 --> 07:45:54,558
flags that are available. For that all
11497
07:45:51,760 --> 07:45:55,920
you have to do is hyphen help. Now that
11498
07:45:54,558 --> 07:45:58,558
works universally through all
11499
07:45:55,920 --> 07:46:01,200
distributions of Linux. Now this may
11500
07:45:58,558 --> 07:46:03,760
look like a lot of text. Now but if you
11501
07:46:01,200 --> 07:46:06,160
go up you will realize that there are
11502
07:46:03,760 --> 07:46:08,718
flags and their descriptions given on
11503
07:46:06,160 --> 07:46:11,440
the left and right respectively. You
11504
07:46:08,718 --> 07:46:14,000
have your hyphen a which means do not
11505
07:46:11,440 --> 07:46:15,680
ignore entries starting with your dot.
11506
07:46:14,000 --> 07:46:18,000
Then you have capital A which means
11507
07:46:15,680 --> 07:46:20,398
almost all and then it has its
11508
07:46:18,000 --> 07:46:23,280
description right here. What I'm more
11509
07:46:20,398 --> 07:46:26,878
interested in comes all the way down
11510
07:46:23,280 --> 07:46:30,718
here, which is your L flag or the long
11511
07:46:26,878 --> 07:46:34,080
listing format. Let's use that and see.
11512
07:46:30,718 --> 07:46:36,398
Now, I had done ls before. Now if I go
11513
07:46:34,080 --> 07:46:38,878
on and do ls-
11514
07:46:36,398 --> 07:46:42,080
L, it's basically going to show me all
11515
07:46:38,878 --> 07:46:44,160
my objects the same as ls but it is
11516
07:46:42,080 --> 07:46:46,638
going to give me more information about
11517
07:46:44,160 --> 07:46:48,798
these objects like the date and time at
11518
07:46:46,638 --> 07:46:51,360
which this object was created, who is
11519
07:46:48,798 --> 07:46:53,680
the user, the user group and on the
11520
07:46:51,360 --> 07:46:55,840
extreme left if you see it basically
11521
07:46:53,680 --> 07:46:58,160
shows you the permissions which I'm
11522
07:46:55,840 --> 07:47:00,718
going to talk a little more about later
11523
07:46:58,160 --> 07:47:03,520
in this segment. Right now all I want to
11524
07:47:00,718 --> 07:47:06,718
tell you is R here stands for read, W
11525
07:47:03,520 --> 07:47:10,320
for write and X for execute. So when you
11526
07:47:06,718 --> 07:47:13,040
see RWX written on the left, it means
11527
07:47:10,320 --> 07:47:16,000
your user can read, write and execute
11528
07:47:13,040 --> 07:47:19,120
that particular file. Okay, with that
11529
07:47:16,000 --> 07:47:22,398
let's clear this. All right, let's move
11530
07:47:19,120 --> 07:47:24,478
on to our next set of command line
11531
07:47:22,398 --> 07:47:27,600
essential commands. So what else did we
11532
07:47:24,478 --> 07:47:30,798
have? We had copy. So for copying all
11533
07:47:27,600 --> 07:47:33,360
you have to do is type cp type the name
11534
07:47:30,798 --> 07:47:35,680
of your file and then put in a
11535
07:47:33,360 --> 07:47:37,600
destination path. In this case I've put
11536
07:47:35,680 --> 07:47:40,558
in pictures which is there in the
11537
07:47:37,600 --> 07:47:43,440
edureka directory and with that it is
11538
07:47:40,558 --> 07:47:46,558
copied. Now let's see if it is actually
11539
07:47:43,440 --> 07:47:50,000
present in pictures. So again let me
11540
07:47:46,558 --> 07:47:53,360
just use the list command
11541
07:47:50,000 --> 07:47:56,798
and you can see cli essentials is right
11542
07:47:53,360 --> 07:47:59,600
here. Now let's see how to use the move
11543
07:47:56,798 --> 07:48:03,200
command. For this I am going to be
11544
07:47:59,600 --> 07:48:06,958
moving to this pictures directory.
11545
07:48:03,200 --> 07:48:10,240
Oh, first up let's just see what other
11546
07:48:06,958 --> 07:48:13,120
file can we make the move to. All right,
11547
07:48:10,240 --> 07:48:17,040
we have downloads, we have project
11548
07:48:13,120 --> 07:48:19,840
public. All right, so first let's move
11549
07:48:17,040 --> 07:48:22,240
into pictures.
11550
07:48:19,840 --> 07:48:25,600
So now I'm at pictures. What I'm going
11551
07:48:22,240 --> 07:48:29,840
to do is I'm going to move
11552
07:48:25,600 --> 07:48:32,398
CLI essentials to let's say I'm going to
11553
07:48:29,840 --> 07:48:35,360
move it to public.
11554
07:48:32,398 --> 07:48:39,040
Okay. Now once the move is done, if we
11555
07:48:35,360 --> 07:48:41,200
see public, let's list out public. You
11556
07:48:39,040 --> 07:48:44,320
see there is just one file which is CLI
11557
07:48:41,200 --> 07:48:46,638
essentials. But then if I go back and
11558
07:48:44,320 --> 07:48:49,200
check pictures,
11559
07:48:46,638 --> 07:48:51,520
there is no CLI essentials file. Which
11560
07:48:49,200 --> 07:48:53,360
basically means what moving did was it
11561
07:48:51,520 --> 07:48:55,440
removed the file from the pictures
11562
07:48:53,360 --> 07:48:58,718
directory and put it in public. Now
11563
07:48:55,440 --> 07:49:03,440
let's remove that file from public with
11564
07:48:58,718 --> 07:49:06,160
which we can also cover the rm command.
11565
07:49:03,440 --> 07:49:08,398
So let's move into public. Now as you
11566
07:49:06,160 --> 07:49:10,798
can see we are at public. Let me clear
11567
07:49:08,398 --> 07:49:13,120
this. I'll keep clearing the screen for
11568
07:49:10,798 --> 07:49:17,600
which you can just type clear or use ctr
11569
07:49:13,120 --> 07:49:20,160
L. And let me remove CLI essentials. Now
11570
07:49:17,600 --> 07:49:22,478
if I do an ls you see there is nothing
11571
07:49:20,160 --> 07:49:25,120
there in the public directory. So with
11572
07:49:22,478 --> 07:49:28,478
that let me move back to edureka the
11573
07:49:25,120 --> 07:49:31,440
original working directory I was in.
11574
07:49:28,478 --> 07:49:33,840
Let's see what are the commands that we
11575
07:49:31,440 --> 07:49:39,520
were using.
11576
07:49:33,840 --> 07:49:42,000
Okay we've done cd pwd lscp mv and rm.
11577
07:49:39,520 --> 07:49:44,320
Next we have echo. Now as I had
11578
07:49:42,000 --> 07:49:48,478
mentioned echo is like the print command
11579
07:49:44,320 --> 07:49:51,280
in here. So, if I'm going to say echo
11580
07:49:48,478 --> 07:49:53,680
hello world, like we haven't used this
11581
07:49:51,280 --> 07:49:55,120
phrase a million times already, but I'm
11582
07:49:53,680 --> 07:49:57,200
going to stick to the cliche and I'm
11583
07:49:55,120 --> 07:50:00,320
going to still type that. It prints out
11584
07:49:57,200 --> 07:50:02,398
hello world. Surprise, surprise. And as
11585
07:50:00,320 --> 07:50:06,080
you might have seen what I previously
11586
07:50:02,398 --> 07:50:08,878
did, which was using the cat command.
11587
07:50:06,080 --> 07:50:11,040
I'm going to do it again. Basically,
11588
07:50:08,878 --> 07:50:13,360
what the cat command does is it
11589
07:50:11,040 --> 07:50:15,600
concatenates your text file to this
11590
07:50:13,360 --> 07:50:17,440
terminal of yours. So what is there in
11591
07:50:15,600 --> 07:50:20,160
that particular text file CLI
11592
07:50:17,440 --> 07:50:23,040
essentials? I can see it printed right
11593
07:50:20,160 --> 07:50:26,240
here. Now how is that different from the
11594
07:50:23,040 --> 07:50:29,040
less command? Now if I did the same
11595
07:50:26,240 --> 07:50:31,040
thing with less, it'll also show you the
11596
07:50:29,040 --> 07:50:33,920
contents of your text file, but it'll
11597
07:50:31,040 --> 07:50:36,000
open it on a brand new separate window
11598
07:50:33,920 --> 07:50:38,080
and just override the previous window
11599
07:50:36,000 --> 07:50:40,878
you were working on. Now this is a much
11600
07:50:38,080 --> 07:50:42,718
neater way and it helps you from not
11601
07:50:40,878 --> 07:50:44,958
cluttering the window that you're
11602
07:50:42,718 --> 07:50:48,160
currently working on. So that was all
11603
07:50:44,958 --> 07:50:50,798
about cat and less for GP. Let's move
11604
07:50:48,160 --> 07:50:53,600
back into our original window. For that
11605
07:50:50,798 --> 07:50:55,840
all you can do is press Q and then
11606
07:50:53,600 --> 07:50:58,718
you're back here. So the next command
11607
07:50:55,840 --> 07:51:00,240
we're going to do is grap. Basically
11608
07:50:58,718 --> 07:51:02,878
what it's going to do is it's going to
11609
07:51:00,240 --> 07:51:04,958
grab the data from a certain file or a
11610
07:51:02,878 --> 07:51:07,680
command that you are trying to pursue.
11611
07:51:04,958 --> 07:51:10,798
So you guys might remember I just used
11612
07:51:07,680 --> 07:51:14,798
the MV or the move command. So what I'm
11613
07:51:10,798 --> 07:51:17,840
going to do is MV and go to help because
11614
07:51:14,798 --> 07:51:19,840
if you remember your hyphen help would
11615
07:51:17,840 --> 07:51:22,878
basically bring out this entire manual
11616
07:51:19,840 --> 07:51:24,798
of the flags that are there for MV. Then
11617
07:51:22,878 --> 07:51:27,120
we're going to pipe and going to do this
11618
07:51:24,798 --> 07:51:29,760
thing called GP and we're going to type
11619
07:51:27,120 --> 07:51:32,398
out verbos. So basically what I'm trying
11620
07:51:29,760 --> 07:51:35,200
to find out is is the verbos flag
11621
07:51:32,398 --> 07:51:38,398
available for your move command or not.
11622
07:51:35,200 --> 07:51:41,440
So as you can see your hyphen v or the
11623
07:51:38,398 --> 07:51:43,760
verbos flag basically what it does is it
11624
07:51:41,440 --> 07:51:46,958
explains what is being done while you
11625
07:51:43,760 --> 07:51:48,718
move it. So if you use the hyphen v flag
11626
07:51:46,958 --> 07:51:51,040
with your move command it's going to
11627
07:51:48,718 --> 07:51:53,440
show you basically where you're moving
11628
07:51:51,040 --> 07:51:57,040
your file. And if suppose you're using a
11629
07:51:53,440 --> 07:51:58,638
big file suppose a 12 or 20 GB file it's
11630
07:51:57,040 --> 07:52:01,280
going to show you when it starts and
11631
07:51:58,638 --> 07:52:05,878
when it is finished with that let's move
11632
07:52:01,280 --> 07:52:05,878
on and let's see what else.
11633
07:52:06,080 --> 07:52:12,958
So we finished catless gp next we have
11634
07:52:10,240 --> 07:52:15,520
touch and mkdir.
11635
07:52:12,958 --> 07:52:17,520
Now touch will be easy to show. It is
11636
07:52:15,520 --> 07:52:19,520
basically going to help you create a few
11637
07:52:17,520 --> 07:52:21,840
files quickly in the current working
11638
07:52:19,520 --> 07:52:28,080
directory that you're working on. So
11639
07:52:21,840 --> 07:52:30,878
file 1 .txt. Then we have file 2.txt
11640
07:52:28,080 --> 07:52:33,600
and let's take file 3.txt.
11641
07:52:30,878 --> 07:52:37,120
Not very original, but just have to show
11642
07:52:33,600 --> 07:52:40,478
you how it works. And if I do an ls, you
11643
07:52:37,120 --> 07:52:44,000
can see you have file 1.txt, file 2.txt,
11644
07:52:40,478 --> 07:52:47,200
and file 3.txt right here. Next, we have
11645
07:52:44,000 --> 07:52:49,120
mkdir, which basically helps you make a
11646
07:52:47,200 --> 07:52:53,440
directory in your current working
11647
07:52:49,120 --> 07:52:56,000
directory. If I just type files and then
11648
07:52:53,440 --> 07:52:57,840
I'll do this ls again, you see we have
11649
07:52:56,000 --> 07:53:01,360
created a directory which it'll show you
11650
07:52:57,840 --> 07:53:05,600
in blue and we have created files. Then
11651
07:53:01,360 --> 07:53:07,840
we have chod or change mode. Now this
11652
07:53:05,600 --> 07:53:10,478
basically helps you play with or alter
11653
07:53:07,840 --> 07:53:13,600
the permissions that are associated with
11654
07:53:10,478 --> 07:53:16,080
a file. Now let me give you an example
11655
07:53:13,600 --> 07:53:19,680
by running a script. So what I'm going
11656
07:53:16,080 --> 07:53:22,080
to do is I'll open
11657
07:53:19,680 --> 07:53:24,080
script. So basically what I'm going to
11658
07:53:22,080 --> 07:53:26,398
do is that I'm going to write a little
11659
07:53:24,080 --> 07:53:29,200
script. Now this is in no means me
11660
07:53:26,398 --> 07:53:31,760
rushing into the next segment. That one
11661
07:53:29,200 --> 07:53:35,280
is separate. This is just for me so I
11662
07:53:31,760 --> 07:53:38,798
can demonstrate how you use chmod. So
11663
07:53:35,280 --> 07:53:40,878
I'm going to go with the shebang line
11664
07:53:38,798 --> 07:53:45,120
and I'm going to just go with hello
11665
07:53:40,878 --> 07:53:48,080
world or hello learner because we have
11666
07:53:45,120 --> 07:53:51,040
used hello world a lot. So I'm going to
11667
07:53:48,080 --> 07:53:52,958
write out of this controll and then
11668
07:53:51,040 --> 07:53:56,558
we're going to move out of here. Now let
11669
07:53:52,958 --> 07:53:59,200
me clear this out and let's try to run
11670
07:53:56,558 --> 07:54:02,000
that particular script. So this is how
11671
07:53:59,200 --> 07:54:03,920
you run it. You go dot slash and then
11672
07:54:02,000 --> 07:54:06,240
test.sh.
11673
07:54:03,920 --> 07:54:08,558
And as you see, it basically shows you
11674
07:54:06,240 --> 07:54:10,798
permission denied. Now, one thing you
11675
07:54:08,558 --> 07:54:13,520
should remember is any script that
11676
07:54:10,798 --> 07:54:16,240
you've just written isn't executable
11677
07:54:13,520 --> 07:54:19,040
from the get- go. Mostly, you only have
11678
07:54:16,240 --> 07:54:21,680
permissions to read it. Now, to change
11679
07:54:19,040 --> 07:54:25,760
that condition, we have something called
11680
07:54:21,680 --> 07:54:31,520
chod. So when you go ahead and type chod
11681
07:54:25,760 --> 07:54:33,600
and then your plus r or plus w or plus x
11682
07:54:31,520 --> 07:54:36,160
it means you're basically adding to
11683
07:54:33,600 --> 07:54:38,240
whatever permission that there is a
11684
07:54:36,160 --> 07:54:39,920
permission to execute that particular
11685
07:54:38,240 --> 07:54:42,558
file.
11686
07:54:39,920 --> 07:54:45,280
So with that plus x now let's try
11687
07:54:42,558 --> 07:54:47,120
running this and as you can see hello
11688
07:54:45,280 --> 07:54:50,638
learner. So what I could have done
11689
07:54:47,120 --> 07:54:53,200
instead of the plus X is I could have
11690
07:54:50,638 --> 07:54:55,280
done this 777
11691
07:54:53,200 --> 07:54:57,600
and then test
11692
07:54:55,280 --> 07:55:00,160
which would have meant the same thing.
11693
07:54:57,600 --> 07:55:02,798
But there is a difference from just
11694
07:55:00,160 --> 07:55:06,080
adding a permission to the user and
11695
07:55:02,798 --> 07:55:08,718
using the chod this way. For that let me
11696
07:55:06,080 --> 07:55:12,320
open another nano editor called
11697
07:55:08,718 --> 07:55:14,558
permissions so I can explain it to you
11698
07:55:12,320 --> 07:55:17,280
further. Now remember how I had said
11699
07:55:14,558 --> 07:55:21,040
when we were using long lists or the
11700
07:55:17,280 --> 07:55:23,680
extension hyphen L to ls that on the
11701
07:55:21,040 --> 07:55:26,240
leftmost column what you could see were
11702
07:55:23,680 --> 07:55:28,958
the permissions associated with a
11703
07:55:26,240 --> 07:55:30,958
certain file. Now chod basically helps
11704
07:55:28,958 --> 07:55:34,080
you alter that. Now if you might have
11705
07:55:30,958 --> 07:55:37,280
noticed the permissions were displayed
11706
07:55:34,080 --> 07:55:40,718
in the following fashion. suppose ABC
11707
07:55:37,280 --> 07:55:43,600
and then ABC and then one more ABC and
11708
07:55:40,718 --> 07:55:46,478
then the file name and then the date and
11709
07:55:43,600 --> 07:55:49,680
then whatever. Basically there are three
11710
07:55:46,478 --> 07:55:52,638
aspects to it. The first one being the
11711
07:55:49,680 --> 07:55:54,958
user or you. Second one being the user
11712
07:55:52,638 --> 07:55:57,440
group and finally there's a thing for
11713
07:55:54,958 --> 07:56:00,878
everybody else. So when you basically
11714
07:55:57,440 --> 07:56:03,440
type chmod and followed by three numbers
11715
07:56:00,878 --> 07:56:06,718
you're basically specifying the user the
11716
07:56:03,440 --> 07:56:10,160
group and others and then the file name
11717
07:56:06,718 --> 07:56:12,798
which is the basic syntax of chmod. Now
11718
07:56:10,160 --> 07:56:16,080
how does this work? Now these numbers
11719
07:56:12,798 --> 07:56:18,958
can be anything from 0 to 7 and all
11720
07:56:16,080 --> 07:56:22,080
those numbers mean something. Now let's
11721
07:56:18,958 --> 07:56:24,718
start with zero. We have zero which is
11722
07:56:22,080 --> 07:56:28,000
equal to zero which basically means
11723
07:56:24,718 --> 07:56:32,798
nobody gets any permission. Then we have
11724
07:56:28,000 --> 07:56:35,920
one which basically means only execute.
11725
07:56:32,798 --> 07:56:39,520
Then we have two which means you can
11726
07:56:35,920 --> 07:56:43,040
only write. Then you have three which is
11727
07:56:39,520 --> 07:56:47,040
basically the sum of 2 + 1 which means
11728
07:56:43,040 --> 07:56:51,200
you can write and execute. Then we have
11729
07:56:47,040 --> 07:56:54,878
four which is read. Then we have five
11730
07:56:51,200 --> 07:56:56,718
which is essentially 4 + 1
11731
07:56:54,878 --> 07:56:59,760
which as you all might have guessed
11732
07:56:56,718 --> 07:57:02,558
means read and execute.
11733
07:56:59,760 --> 07:57:04,240
Then we have six which is read and
11734
07:57:02,558 --> 07:57:08,398
write.
11735
07:57:04,240 --> 07:57:12,478
And finally you have seven which is 4 +
11736
07:57:08,398 --> 07:57:15,600
2 + 1 which means all three permissions
11737
07:57:12,478 --> 07:57:18,798
read, write and execute. Not going to be
11738
07:57:15,600 --> 07:57:24,000
saving this. So when you type something
11739
07:57:18,798 --> 07:57:26,798
such as chmod 777 and a certain file
11740
07:57:24,000 --> 07:57:29,360
name, your first seven basically means
11741
07:57:26,798 --> 07:57:31,520
your user has the permission to read,
11742
07:57:29,360 --> 07:57:34,160
write and execute. Your second seven
11743
07:57:31,520 --> 07:57:35,760
means your user group also has the
11744
07:57:34,160 --> 07:57:38,798
permission to read, write and execute
11745
07:57:35,760 --> 07:57:40,320
the file and so does everybody else
11746
07:57:38,798 --> 07:57:44,000
which you can see through the third
11747
07:57:40,320 --> 07:57:48,000
seven. With that I am closing this. So,
11748
07:57:44,000 --> 07:57:52,958
Ctrl X and then I'm not saving it.
11749
07:57:48,000 --> 07:57:55,280
And then finally I have man plus help
11750
07:57:52,958 --> 07:57:58,398
which is basically your general commands
11751
07:57:55,280 --> 07:58:00,240
manual. You can see the names of all
11752
07:57:58,398 --> 07:58:02,718
your general commands. You can see your
11753
07:58:00,240 --> 07:58:05,200
bash bulletin commands. It's basically
11754
07:58:02,718 --> 07:58:08,558
like your guide book before scripting.
11755
07:58:05,200 --> 07:58:10,638
You can press H and it'll open to a
11756
07:58:08,558 --> 07:58:14,718
summary of commands and then you can
11757
07:58:10,638 --> 07:58:16,878
press Q when you are done. Again Q.
11758
07:58:14,718 --> 07:58:20,320
Now let me head back to my presentation
11759
07:58:16,878 --> 07:58:22,320
for a little more on CLI. Now basically
11760
07:58:20,320 --> 07:58:25,040
before closing this segment I'm going to
11761
07:58:22,320 --> 07:58:27,760
talk a little bit about CLI and how it
11762
07:58:25,040 --> 07:58:30,320
compares to GUI. So firstly the first
11763
07:58:27,760 --> 07:58:32,638
point must be pretty clear. CLI actually
11764
07:58:30,320 --> 07:58:34,478
stands for command line interface. So it
11765
07:58:32,638 --> 07:58:36,718
basically means it's a textbased
11766
07:58:34,478 --> 07:58:38,558
interface. Now the GUI or the graphical
11767
07:58:36,718 --> 07:58:40,638
user interface is a visual based
11768
07:58:38,558 --> 07:58:42,718
interface pretty clearly. It features
11769
07:58:40,638 --> 07:58:45,600
the use of graphic images including
11770
07:58:42,718 --> 07:58:48,398
windows, icons and menus. Even if it
11771
07:58:45,600 --> 07:58:50,160
does that, it does require a mouse which
11772
07:58:48,398 --> 07:58:52,638
is the most common way to navigate
11773
07:58:50,160 --> 07:58:56,558
through a GUI. Which brings me to my
11774
07:58:52,638 --> 07:58:59,280
next point. I use because of the visual
11775
07:58:56,558 --> 07:59:02,638
representation. Most people can learn
11776
07:58:59,280 --> 07:59:04,398
and use GUI much faster and much easier.
11777
07:59:02,638 --> 07:59:06,638
But once you get used to the command
11778
07:59:04,398 --> 07:59:09,040
line, I don't personally think it is
11779
07:59:06,638 --> 07:59:12,638
that tough as well. But for a beginner,
11780
07:59:09,040 --> 07:59:16,160
yes, GUI can prove to be pretty optimum.
11781
07:59:12,638 --> 07:59:18,718
But there is also a downside. A GUI's OS
11782
07:59:16,160 --> 07:59:20,958
is slower because everything you remove
11783
07:59:18,718 --> 07:59:23,520
does not get permanently removed from
11784
07:59:20,958 --> 07:59:25,920
the system. It is going to stay there as
11785
07:59:23,520 --> 07:59:28,320
a copy of the file and going to clutter
11786
07:59:25,920 --> 07:59:31,520
your space and reduce the speed of your
11787
07:59:28,320 --> 07:59:34,320
whole system which is where CLI wins as
11788
07:59:31,520 --> 07:59:36,320
it has a faster OS which also brings me
11789
07:59:34,320 --> 07:59:38,958
to my final point. Command line
11790
07:59:36,320 --> 07:59:42,398
interface gives you way more control
11791
07:59:38,958 --> 07:59:44,958
than your GUI. With a CLI users have all
11792
07:59:42,398 --> 07:59:47,520
the control over a file system and their
11793
07:59:44,958 --> 07:59:49,520
operating systems and the tasks become
11794
07:59:47,520 --> 07:59:51,600
really simple. You can create a script
11795
07:59:49,520 --> 07:59:53,920
that contains a few lines of command and
11796
07:59:51,600 --> 07:59:56,080
it will do the work for you. Although
11797
07:59:53,920 --> 07:59:58,478
your graphical user interface can create
11798
07:59:56,080 --> 08:00:01,360
shortcuts, they do not readily support
11799
07:59:58,478 --> 08:00:04,240
scripting or automation. So for common
11800
08:00:01,360 --> 08:00:07,680
tasks, a user must repeat each action
11801
08:00:04,240 --> 08:00:10,000
within the GUI manually. Now, nothing is
11802
08:00:07,680 --> 08:00:12,398
better than the other. It's a personal
11803
08:00:10,000 --> 08:00:14,638
choice for everybody, but for scripting,
11804
08:00:12,398 --> 08:00:17,280
obviously, a command line interface is
11805
08:00:14,638 --> 08:00:19,360
most optimum. It helps you do thing at
11806
08:00:17,280 --> 08:00:21,360
scale. It helps you when you need to
11807
08:00:19,360 --> 08:00:23,360
script or automate something. You need
11808
08:00:21,360 --> 08:00:25,920
greater control over systems or
11809
08:00:23,360 --> 08:00:28,638
functions and it helps you with less
11810
08:00:25,920 --> 08:00:31,440
memory usage. With that, let's move on
11811
08:00:28,638 --> 08:00:34,160
to the shell script basics. So the most
11812
08:00:31,440 --> 08:00:37,440
logical question obviously is what is a
11813
08:00:34,160 --> 08:00:39,360
shell? As I had mentioned earlier, users
11814
08:00:37,440 --> 08:00:41,920
communicate with the kernel through a
11815
08:00:39,360 --> 08:00:44,080
program known as a shell. A shell is
11816
08:00:41,920 --> 08:00:46,558
basically a command line interpreter.
11817
08:00:44,080 --> 08:00:48,878
And basically what it does is that it
11818
08:00:46,558 --> 08:00:51,760
processes your requests. When you type
11819
08:00:48,878 --> 08:00:53,920
in a command at your terminal, the shell
11820
08:00:51,760 --> 08:00:56,558
interprets the command and calls the
11821
08:00:53,920 --> 08:00:59,360
program that you want. The shell uses
11822
08:00:56,558 --> 08:01:01,360
standard syntax for all commands. So
11823
08:00:59,360 --> 08:01:03,760
basically what it does is that it
11824
08:01:01,360 --> 08:01:06,000
translates commands entered by the user
11825
08:01:03,760 --> 08:01:08,240
and converts them into a language that
11826
08:01:06,000 --> 08:01:10,718
is understood by the kernel. From the
11827
08:01:08,240 --> 08:01:13,200
shell, the direct derivative is the
11828
08:01:10,718 --> 08:01:15,440
shell script. Now the basic concept of
11829
08:01:13,200 --> 08:01:17,360
the shell script is that there will be a
11830
08:01:15,440 --> 08:01:20,240
list of commands which are listed in the
11831
08:01:17,360 --> 08:01:22,798
order of execution. A good shell script
11832
08:01:20,240 --> 08:01:26,000
will have comments preceded by the hash
11833
08:01:22,798 --> 08:01:28,478
sign. Now it is not important for you to
11834
08:01:26,000 --> 08:01:31,600
have hash signed certain comments for
11835
08:01:28,478 --> 08:01:34,240
your script to be executed. It is only a
11836
08:01:31,600 --> 08:01:36,878
good practice to have your steps hashed
11837
08:01:34,240 --> 08:01:38,958
out so somebody else reading your script
11838
08:01:36,878 --> 08:01:41,200
can understand what you want to do with
11839
08:01:38,958 --> 08:01:43,760
it. Now there are several different
11840
08:01:41,200 --> 08:01:46,718
types of shells which can be broadly
11841
08:01:43,760 --> 08:01:48,958
classified into two types. First you
11842
08:01:46,718 --> 08:01:51,600
have the classic shell which is the bond
11843
08:01:48,958 --> 08:01:53,760
shell. A derivative which came later was
11844
08:01:51,600 --> 08:01:56,240
the sea shell. Now each of these types
11845
08:01:53,760 --> 08:01:58,478
have their own subtypes. A few examples
11846
08:01:56,240 --> 08:02:00,638
of the bond shell are the basic bond
11847
08:01:58,478 --> 08:02:03,840
shell, the corn shell, the bornag again
11848
08:02:00,638 --> 08:02:06,240
shell or the bash and the pix shell. In
11849
08:02:03,840 --> 08:02:09,360
Cshell, certain examples are your basic
11850
08:02:06,240 --> 08:02:11,520
Cshell, your 10x Cshell and the Zshell,
11851
08:02:09,360 --> 08:02:13,840
which has been picking up popularity in
11852
08:02:11,520 --> 08:02:16,718
the past few years. Now, to understand
11853
08:02:13,840 --> 08:02:18,878
how this works, let me move on to our
11854
08:02:16,718 --> 08:02:20,558
terminal. Now, what I'll be doing is
11855
08:02:18,878 --> 08:02:22,798
I'll be dividing the screen into two
11856
08:02:20,558 --> 08:02:25,440
parts. On my left, I'll have my nano
11857
08:02:22,798 --> 08:02:28,398
editor and on my right, I shall be
11858
08:02:25,440 --> 08:02:31,120
having your basic terminal where you can
11859
08:02:28,398 --> 08:02:34,080
see your commands being executed. So
11860
08:02:31,120 --> 08:02:36,798
kindly be patient. Okay. So let's start
11861
08:02:34,080 --> 08:02:38,878
with some basic shell scripting. Now
11862
08:02:36,798 --> 08:02:40,398
shell scripts have several required
11863
08:02:38,878 --> 08:02:42,240
constructs that tell the shell
11864
08:02:40,398 --> 08:02:44,638
environment what to do and when to do
11865
08:02:42,240 --> 08:02:46,558
it. Of course, most shell scripts are
11866
08:02:44,638 --> 08:02:48,558
more complex than the one I'm going to
11867
08:02:46,558 --> 08:02:50,240
show you. The shell is after all a real
11868
08:02:48,558 --> 08:02:52,558
programming language complete with
11869
08:02:50,240 --> 08:02:54,718
variables, control structures, so on and
11870
08:02:52,558 --> 08:02:57,360
so forth. No matter how complicated a
11871
08:02:54,718 --> 08:02:59,840
script gets, it still is just a list of
11872
08:02:57,360 --> 08:03:02,798
commands executed sequentially. So here
11873
08:02:59,840 --> 08:03:06,000
I'm going to open up my nano editor and
11874
08:03:02,798 --> 08:03:08,718
I'm going to put up let's say example
11875
08:03:06,000 --> 08:03:11,840
one and sh.
11876
08:03:08,718 --> 08:03:13,680
Now notice the extension sh. This is my
11877
08:03:11,840 --> 08:03:16,718
extension because I'm using the basic
11878
08:03:13,680 --> 08:03:19,600
bond shell or the shell. So I'll start
11879
08:03:16,718 --> 08:03:22,478
with the shebang line and it is nothing
11880
08:03:19,600 --> 08:03:25,200
but the absolute path to the interpreter
11881
08:03:22,478 --> 08:03:27,920
of your shell. So it has this hash and
11882
08:03:25,200 --> 08:03:30,878
this bang or the exclamatory followed by
11883
08:03:27,920 --> 08:03:33,680
the full path to your interpreter. Now
11884
08:03:30,878 --> 08:03:36,240
all scripts under Linux execute using
11885
08:03:33,680 --> 08:03:39,520
the interpreter specified on this first
11886
08:03:36,240 --> 08:03:42,958
line. So this could be sh or bondshell
11887
08:03:39,520 --> 08:03:45,120
bash or your ksh your zsh so on and so
11888
08:03:42,958 --> 08:03:47,600
forth. Now like we had given the advice
11889
08:03:45,120 --> 08:03:52,958
of hashing out comments. Let me just put
11890
08:03:47,600 --> 08:03:56,478
on a few comments. Make this look good.
11891
08:03:52,958 --> 08:03:58,718
Okay. And
11892
08:03:56,478 --> 08:04:02,798
then I'm going to put up try and print
11893
08:03:58,718 --> 08:04:06,798
this very simple print such as what is
11894
08:04:02,798 --> 08:04:11,040
your name? And then I am going to
11895
08:04:06,798 --> 08:04:13,600
read whatever you enter and then I am
11896
08:04:11,040 --> 08:04:16,638
going to print that out. We're going to
11897
08:04:13,600 --> 08:04:19,280
allocate whatever we read into this
11898
08:04:16,638 --> 08:04:22,000
variable called person and then we are
11899
08:04:19,280 --> 08:04:25,520
going to call that variable using the
11900
08:04:22,000 --> 08:04:28,160
dollar sign. So hello whatever person as
11901
08:04:25,520 --> 08:04:30,000
I had mentioned before your control O
11902
08:04:28,160 --> 08:04:32,638
for write out and then we're going to
11903
08:04:30,000 --> 08:04:37,040
exit this. Now this is to remind you one
11904
08:04:32,638 --> 08:04:40,638
more time that every file which has just
11905
08:04:37,040 --> 08:04:44,080
been made is not executable.
11906
08:04:40,638 --> 08:04:46,718
So if I try to execute it now, it would
11907
08:04:44,080 --> 08:04:49,200
tell me that permission is denied. This
11908
08:04:46,718 --> 08:04:51,360
is just a recap of what I had done say 2
11909
08:04:49,200 --> 08:04:54,080
minutes ago. So we going to change the
11910
08:04:51,360 --> 08:04:57,040
mode and I'm going to do this when I'm
11911
08:04:54,080 --> 08:04:59,200
executing any script at all. Going to
11912
08:04:57,040 --> 08:05:02,558
try and execute it now. It's going to
11913
08:04:59,200 --> 08:05:04,080
ask me what is your name? Edureka
11914
08:05:02,558 --> 08:05:07,280
employee. And then it's going to greet
11915
08:05:04,080 --> 08:05:09,680
me saying hello Edureka employee. And
11916
08:05:07,280 --> 08:05:12,000
that is the most basic of the shell
11917
08:05:09,680 --> 08:05:14,080
scripting that you can do. As we move
11918
08:05:12,000 --> 08:05:16,638
further, I'm going to keep bringing you
11919
08:05:14,080 --> 08:05:18,638
back here. I'm a firm believer in
11920
08:05:16,638 --> 08:05:21,920
practicing what we are learning in
11921
08:05:18,638 --> 08:05:24,958
theory. With that, let's go on and see
11922
08:05:21,920 --> 08:05:27,920
what we have next in this module. So the
11923
08:05:24,958 --> 08:05:31,280
next segment is about using variables.
11924
08:05:27,920 --> 08:05:33,920
So what is a variable? Most people might
11925
08:05:31,280 --> 08:05:36,798
be aware of this term, but for those who
11926
08:05:33,920 --> 08:05:38,878
are not, I'm going to explain it down to
11927
08:05:36,798 --> 08:05:41,040
the scratch for all of you. Now,
11928
08:05:38,878 --> 08:05:43,760
variable is nothing more than a pointer
11929
08:05:41,040 --> 08:05:45,920
to the actual data. It's nothing more,
11930
08:05:43,760 --> 08:05:48,638
nothing less. The shell enables you to
11931
08:05:45,920 --> 08:05:50,478
create, assign, and delete variables.
11932
08:05:48,638 --> 08:05:52,638
So, basically what it is is that a
11933
08:05:50,478 --> 08:05:55,120
variable is a character string to which
11934
08:05:52,638 --> 08:05:57,600
we assign a value. The value assigned
11935
08:05:55,120 --> 08:06:00,398
could be a number, text, file name,
11936
08:05:57,600 --> 08:06:02,638
device or any other type of data. The
11937
08:06:00,398 --> 08:06:04,798
shell enables you to create, assign and
11938
08:06:02,638 --> 08:06:07,920
delete variables which may contain
11939
08:06:04,798 --> 08:06:10,478
numbers, texts, file names, devices or
11940
08:06:07,920 --> 08:06:13,280
any other kind of data. Now variables
11941
08:06:10,478 --> 08:06:15,600
are of three kinds in the shell. You
11942
08:06:13,280 --> 08:06:18,000
have your local variables which as the
11943
08:06:15,600 --> 08:06:20,160
name suggests is the variable that is
11944
08:06:18,000 --> 08:06:22,240
present within the current instance of
11945
08:06:20,160 --> 08:06:24,240
the shell. It is not available to
11946
08:06:22,240 --> 08:06:27,200
programs that are started by the shell
11947
08:06:24,240 --> 08:06:28,958
and they are set at the command prompt.
11948
08:06:27,200 --> 08:06:31,600
Then you have your environmental
11949
08:06:28,958 --> 08:06:33,840
variable. An environmental variable is
11950
08:06:31,600 --> 08:06:35,760
available to any child process of the
11951
08:06:33,840 --> 08:06:37,760
shell. Now some programs need the
11952
08:06:35,760 --> 08:06:40,240
environmental variables in order to
11953
08:06:37,760 --> 08:06:42,398
function correctly. Usually a shell
11954
08:06:40,240 --> 08:06:44,320
script defines only those environmental
11955
08:06:42,398 --> 08:06:47,600
variables that are needed by the
11956
08:06:44,320 --> 08:06:50,398
programs that it runs. And finally, we
11957
08:06:47,600 --> 08:06:52,240
have the shell variables which can be
11958
08:06:50,398 --> 08:06:53,920
compared to the global variable if
11959
08:06:52,240 --> 08:06:56,000
you're into any other kind of
11960
08:06:53,920 --> 08:06:58,000
programming. A shell variable is a
11961
08:06:56,000 --> 08:07:00,798
special variable that is set by the
11962
08:06:58,000 --> 08:07:03,760
shell and is required by the shell in
11963
08:07:00,798 --> 08:07:05,600
order to function correctly. Now, some
11964
08:07:03,760 --> 08:07:07,840
of these variables are environment
11965
08:07:05,600 --> 08:07:10,718
variables while others are local
11966
08:07:07,840 --> 08:07:12,398
variables. It can be any of these. Now
11967
08:07:10,718 --> 08:07:15,360
to see how we can implement these
11968
08:07:12,398 --> 08:07:18,080
variables. We are going to move on to
11969
08:07:15,360 --> 08:07:19,760
the shell. But before that let's see
11970
08:07:18,080 --> 08:07:22,160
specifically what we are going to look
11971
08:07:19,760 --> 08:07:24,240
at. So first of all we are going to
11972
08:07:22,160 --> 08:07:26,398
learn how to define variables, how to
11973
08:07:24,240 --> 08:07:28,878
access the values. Then we're going to
11974
08:07:26,398 --> 08:07:31,280
see a little bit on readonly variables
11975
08:07:28,878 --> 08:07:32,798
and unsetting variables. Then we have
11976
08:07:31,280 --> 08:07:34,478
special variables. We're going to see
11977
08:07:32,798 --> 08:07:36,878
how you can work with them. We have
11978
08:07:34,478 --> 08:07:40,000
command line arguments. We have special
11979
08:07:36,878 --> 08:07:42,398
parameters and the exit status. Now to
11980
08:07:40,000 --> 08:07:46,080
see how all of these things work, let's
11981
08:07:42,398 --> 08:07:49,920
move on to our terminal. So again I'm
11982
08:07:46,080 --> 08:07:52,638
going to create another nano file called
11983
08:07:49,920 --> 08:07:56,080
variable.sh.
11984
08:07:52,638 --> 08:07:58,638
Now defining variables. Now any variable
11985
08:07:56,080 --> 08:08:01,840
that you are going to define should be
11986
08:07:58,638 --> 08:08:04,080
along the lines of this. You have your
11987
08:08:01,840 --> 08:08:08,638
variable name and then you have your
11988
08:08:04,080 --> 08:08:10,958
equal sign and your variable value. Now,
11989
08:08:08,638 --> 08:08:12,878
if you have done any sort of coding or
11990
08:08:10,958 --> 08:08:15,520
programming before, you would know this
11991
08:08:12,878 --> 08:08:18,160
is basically how you all lot a value to
11992
08:08:15,520 --> 08:08:20,240
a variable throughout all different
11993
08:08:18,160 --> 08:08:23,040
platforms. Now, the thing you have to
11994
08:08:20,240 --> 08:08:25,680
notice is that in shell scripting, it's
11995
08:08:23,040 --> 08:08:28,478
very particular about the syntax. So, no
11996
08:08:25,680 --> 08:08:31,040
spaces on either side of your equal to
11997
08:08:28,478 --> 08:08:33,360
sign. In that case, it is not going to
11998
08:08:31,040 --> 08:08:35,760
execute and it's going to throw an error
11999
08:08:33,360 --> 08:08:38,398
at you. So, let's take something simple.
12000
08:08:35,760 --> 08:08:40,478
So, your name
12001
08:08:38,398 --> 08:08:43,120
equals
12002
08:08:40,478 --> 08:08:45,200
this. Now this example defines the
12003
08:08:43,120 --> 08:08:48,160
variable name and assigns the value
12004
08:08:45,200 --> 08:08:51,200
adurea employed to it. Variables of this
12005
08:08:48,160 --> 08:08:53,680
type are called scalar variables. Now a
12006
08:08:51,200 --> 08:08:56,718
scalar variable basically means that it
12007
08:08:53,680 --> 08:08:58,798
can only hold one value at a time. So
12008
08:08:56,718 --> 08:09:01,840
let's turn this into a shell script
12009
08:08:58,798 --> 08:09:05,920
first. So I'm going to go up and put in
12010
08:09:01,840 --> 08:09:08,878
my shebang line and then I have my name
12011
08:09:05,920 --> 08:09:11,600
and then we just going to call that
12012
08:09:08,878 --> 08:09:15,440
particular variable. Pretty simple and
12013
08:09:11,600 --> 08:09:18,398
we've done it before. So then control O
12014
08:09:15,440 --> 08:09:21,398
here again we have to give it
12015
08:09:18,398 --> 08:09:21,398
permissions
12016
08:09:22,000 --> 08:09:26,080
and then when we execute it, it prints
12017
08:09:24,240 --> 08:09:29,200
out what we had asked for it to print
12018
08:09:26,080 --> 08:09:32,160
out. Okay, let's see what happens when I
12019
08:09:29,200 --> 08:09:35,360
use the readonly command
12020
08:09:32,160 --> 08:09:37,760
and then I try to change the value of
12021
08:09:35,360 --> 08:09:40,638
the variable. Suppose I put in my own
12022
08:09:37,760 --> 08:09:43,520
name into it. I'm going to go control O
12023
08:09:40,638 --> 08:09:45,520
and okay.
12024
08:09:43,520 --> 08:09:48,398
Basically, it's going to throw an error
12025
08:09:45,520 --> 08:09:51,600
at me saying that the variable name is a
12026
08:09:48,398 --> 08:09:53,840
readonly variable. So, I cannot change
12027
08:09:51,600 --> 08:09:56,398
the value of the variable once I put
12028
08:09:53,840 --> 08:09:58,798
read only in front of it. Now that was
12029
08:09:56,398 --> 08:10:01,040
all about readonly variables. Now let's
12030
08:09:58,798 --> 08:10:03,840
move on to see what else can we do with
12031
08:10:01,040 --> 08:10:06,320
this. Now there is also something called
12032
08:10:03,840 --> 08:10:09,120
unsetting variables. Now unsetting or
12033
08:10:06,320 --> 08:10:10,878
deleting a variable directs the shell to
12034
08:10:09,120 --> 08:10:13,360
remove the variable from the list of
12035
08:10:10,878 --> 08:10:16,798
variable that it tracks. You'll see in a
12036
08:10:13,360 --> 08:10:19,360
moment what I mean. So I did this and
12037
08:10:16,798 --> 08:10:23,120
then instead of read only I'm going to
12038
08:10:19,360 --> 08:10:27,478
put unset and then I'm going to call my
12039
08:10:23,120 --> 08:10:27,478
variable same old same old
12040
08:10:31,600 --> 08:10:37,680
and now we are going to try and call
12041
08:10:34,240 --> 08:10:40,638
this as you can see nothing. So
12042
08:10:37,680 --> 08:10:42,558
basically what it did was it took the
12043
08:10:40,638 --> 08:10:45,760
variable out of the list of other
12044
08:10:42,558 --> 08:10:49,040
variables. That is what unset does. Now
12045
08:10:45,760 --> 08:10:52,440
let's clean this out and we can look at
12046
08:10:49,040 --> 08:10:52,440
special variables.
12047
08:10:52,798 --> 08:10:58,558
Okay. So now let's discuss a little bit
12048
08:10:55,200 --> 08:11:00,160
about special variables. So in the
12049
08:10:58,558 --> 08:11:03,680
previous segment you understood how to
12050
08:11:00,160 --> 08:11:06,320
define a variable, how to read only and
12051
08:11:03,680 --> 08:11:08,798
unset a variable. Now these variables
12052
08:11:06,320 --> 08:11:11,200
are reserved for specific functions and
12053
08:11:08,798 --> 08:11:13,360
hence they are called special variables.
12054
08:11:11,200 --> 08:11:16,718
Now they're usually preceded by a dollar
12055
08:11:13,360 --> 08:11:20,000
sign and these are the special variables
12056
08:11:16,718 --> 08:11:22,478
that we are going to see.
12057
08:11:20,000 --> 08:11:24,958
You have your dollar zero which is the
12058
08:11:22,478 --> 08:11:28,558
file name of the script. Then you have
12059
08:11:24,958 --> 08:11:30,798
your dollar any number 1 to 9. Now these
12060
08:11:28,558 --> 08:11:33,680
variables correspond to the arguments
12061
08:11:30,798 --> 08:11:36,638
with which a script was invoked. Here
12062
08:11:33,680 --> 08:11:39,200
you can pick any n number which will be
12063
08:11:36,638 --> 08:11:41,200
a positive decimal number corresponding
12064
08:11:39,200 --> 08:11:43,520
to the position of the argument. You
12065
08:11:41,200 --> 08:11:46,240
shall understand when I demonstrate this
12066
08:11:43,520 --> 08:11:49,760
further in the segment. Then you have
12067
08:11:46,240 --> 08:11:52,160
your dollar hash sign. Now this will
12068
08:11:49,760 --> 08:11:55,200
basically return the number of arguments
12069
08:11:52,160 --> 08:11:59,360
applied to a script. Then you have your
12070
08:11:55,200 --> 08:12:01,840
dollar and asterisk. So this will return
12071
08:11:59,360 --> 08:12:04,240
you all the arguments that are double
12072
08:12:01,840 --> 08:12:07,120
quoted which again you shall see when I
12073
08:12:04,240 --> 08:12:09,440
demonstrate this. Now this will give you
12074
08:12:07,120 --> 08:12:11,040
all the arguments that are individually
12075
08:12:09,440 --> 08:12:13,280
double quoted. That is the only
12076
08:12:11,040 --> 08:12:15,920
difference between the dollar asterric
12077
08:12:13,280 --> 08:12:18,478
and the dollar at the rate sign. Then
12078
08:12:15,920 --> 08:12:20,240
you have this which is the exit status
12079
08:12:18,478 --> 08:12:22,878
of the last command that you have
12080
08:12:20,240 --> 08:12:25,200
executed. And finally you have the
12081
08:12:22,878 --> 08:12:27,440
dollar dollar dollar which will give you
12082
08:12:25,200 --> 08:12:29,680
the process number of the current shell
12083
08:12:27,440 --> 08:12:32,160
for the shell script. Now this is also
12084
08:12:29,680 --> 08:12:35,040
the process ID under which it is being
12085
08:12:32,160 --> 08:12:38,320
executed. Now let me try to script
12086
08:12:35,040 --> 08:12:41,600
something with which I can depict not
12087
08:12:38,320 --> 08:12:47,478
all but at least most of these special
12088
08:12:41,600 --> 08:12:47,478
variables. So let's just put on echo
12089
08:12:47,840 --> 08:12:56,040
dollar zero. Let me go ahead select it
12090
08:12:51,200 --> 08:12:56,040
and then copy it a bunch of times.
12091
08:13:05,840 --> 08:13:12,558
Okay. So let's go ahead and execute
12092
08:13:09,120 --> 08:13:14,958
this. So now that we have learned about
12093
08:13:12,558 --> 08:13:16,558
all of these special variables, let's
12094
08:13:14,958 --> 08:13:19,280
implement them using command line
12095
08:13:16,558 --> 08:13:21,280
arguments. Now command line arguments as
12096
08:13:19,280 --> 08:13:24,558
you can see on your left are these
12097
08:13:21,280 --> 08:13:27,280
dollar 1 2 3 to 9 they're actually
12098
08:13:24,558 --> 08:13:30,000
positional parameters with dollar 0
12099
08:13:27,280 --> 08:13:32,320
pointing to the actual command following
12100
08:13:30,000 --> 08:13:35,200
which your dollar one and your dollar
12101
08:13:32,320 --> 08:13:37,360
two are the arguments to that particular
12102
08:13:35,200 --> 08:13:40,878
command. If you see the script on your
12103
08:13:37,360 --> 08:13:43,040
left this is how it will run. So first
12104
08:13:40,878 --> 08:13:45,440
we are going to change the mode then
12105
08:13:43,040 --> 08:13:49,600
we're going to run it and pass a
12106
08:13:45,440 --> 08:13:52,478
parameter here. So if I pass Edureka
12107
08:13:49,600 --> 08:13:55,760
employee or I've typed that too many
12108
08:13:52,478 --> 08:13:58,798
times. So Edureka learner and enter it
12109
08:13:55,760 --> 08:14:01,200
shows you the file name dollar0 your
12110
08:13:58,798 --> 08:14:04,558
parameter number one which is edureka
12111
08:14:01,200 --> 08:14:07,120
your second parameter the quoted values
12112
08:14:04,558 --> 08:14:09,520
and the number of parameters all of
12113
08:14:07,120 --> 08:14:12,320
which are returned to us by our special
12114
08:14:09,520 --> 08:14:14,878
variables. Now as you might have noticed
12115
08:14:12,320 --> 08:14:17,440
your dollar address sign and your dollar
12116
08:14:14,878 --> 08:14:19,840
star sign returned pretty much the same
12117
08:14:17,440 --> 08:14:21,920
thing. These are the special parameters
12118
08:14:19,840 --> 08:14:25,120
that allow accessing all the command
12119
08:14:21,920 --> 08:14:27,440
line arguments at once which in our case
12120
08:14:25,120 --> 08:14:30,478
is edureka learner both of these
12121
08:14:27,440 --> 08:14:33,040
arguments. So both of them actually act
12122
08:14:30,478 --> 08:14:35,600
pretty much the same unless they are
12123
08:14:33,040 --> 08:14:38,958
enclosed in double quotes. Now let me
12124
08:14:35,600 --> 08:14:43,280
show you how. If I run the same thing
12125
08:14:38,958 --> 08:14:46,160
but I put them in double quotes,
12126
08:14:43,280 --> 08:14:48,638
you can see both of them again give the
12127
08:14:46,160 --> 08:14:51,840
same value. But if I put them in
12128
08:14:48,638 --> 08:14:54,558
individual quotes, it will treat them as
12129
08:14:51,840 --> 08:14:57,040
two separate parameters and give you two
12130
08:14:54,558 --> 08:14:58,958
separate values. Whereas in the first
12131
08:14:57,040 --> 08:15:01,440
one, it'll quote your number of
12132
08:14:58,958 --> 08:15:04,000
parameters as one. It'll consider it one
12133
08:15:01,440 --> 08:15:06,478
single string. Now let me try and
12134
08:15:04,000 --> 08:15:09,120
demonstrate it using another shell
12135
08:15:06,478 --> 08:15:11,120
script. How is it different? This does
12136
08:15:09,120 --> 08:15:13,840
not make a lot of sense to most of you
12137
08:15:11,120 --> 08:15:17,120
right now. So let's just hope the next
12138
08:15:13,840 --> 08:15:20,000
thing makes it better.
12139
08:15:17,120 --> 08:15:22,478
So I'll run a little for loop here which
12140
08:15:20,000 --> 08:15:24,478
again we are going to touch up on later.
12141
08:15:22,478 --> 08:15:28,680
But for now let me just do this to
12142
08:15:24,478 --> 08:15:28,680
demonstrate how this works.
12143
08:15:35,920 --> 08:15:39,920
Now, let me put this in perspective. So,
12144
08:15:38,080 --> 08:15:42,958
what I'm going to do is I'm going to run
12145
08:15:39,920 --> 08:15:45,760
this entire sentence. Edureka wishes you
12146
08:15:42,958 --> 08:15:47,520
happy learning. And you see what just
12147
08:15:45,760 --> 08:15:49,920
happened, right? What your special
12148
08:15:47,520 --> 08:15:52,160
parameter did here is that it took this
12149
08:15:49,920 --> 08:15:54,478
entire list and separated it into
12150
08:15:52,160 --> 08:15:57,200
separate arguments. And that is what
12151
08:15:54,478 --> 08:15:58,878
these two special parameters do. Now
12152
08:15:57,200 --> 08:16:01,360
once you're done with it, you can always
12153
08:15:58,878 --> 08:16:04,478
use the exit status.
12154
08:16:01,360 --> 08:16:07,680
So what I'm going to do now finally is I
12155
08:16:04,478 --> 08:16:10,080
am going to go and implement the exit
12156
08:16:07,680 --> 08:16:12,878
status and it is going to return a value
12157
08:16:10,080 --> 08:16:14,798
of zero. Now this is basically the exit
12158
08:16:12,878 --> 08:16:17,040
status of the previous command. It would
12159
08:16:14,798 --> 08:16:19,200
have given you a one if your previous
12160
08:16:17,040 --> 08:16:20,958
command was unsuccessful. Since your
12161
08:16:19,200 --> 08:16:23,920
command was successful, it gave you a
12162
08:16:20,958 --> 08:16:25,840
zero. So the exit status is basically a
12163
08:16:23,920 --> 08:16:28,478
numerical value returned by every
12164
08:16:25,840 --> 08:16:30,558
command upon its completion. As a rule,
12165
08:16:28,478 --> 08:16:32,558
most command return an exit status of
12166
08:16:30,558 --> 08:16:35,120
zero if successful and one if
12167
08:16:32,558 --> 08:16:37,280
unsuccessful. Now some commands also
12168
08:16:35,120 --> 08:16:40,160
return additional exit statuses for
12169
08:16:37,280 --> 08:16:42,080
particular reasons. For example, a few
12170
08:16:40,160 --> 08:16:44,398
commands will differentiate between
12171
08:16:42,080 --> 08:16:46,878
kinds of errors and will return various
12172
08:16:44,398 --> 08:16:49,040
exit statuses depending on the specific
12173
08:16:46,878 --> 08:16:51,200
type of failure. With that, we've come
12174
08:16:49,040 --> 08:16:53,840
to the end of this segment. Let me go
12175
08:16:51,200 --> 08:16:57,040
back to my presentation. Next, let's
12176
08:16:53,840 --> 08:16:59,120
take a look at our basic operators. Now,
12177
08:16:57,040 --> 08:17:01,280
there are various operators supported by
12178
08:16:59,120 --> 08:17:03,520
each shell. I'm not going to take a lot
12179
08:17:01,280 --> 08:17:06,398
of time with this segment. We will
12180
08:17:03,520 --> 08:17:08,240
discuss about the default shell in this
12181
08:17:06,398 --> 08:17:09,920
segment. And we are going to discuss the
12182
08:17:08,240 --> 08:17:11,920
following operators. We have the
12183
08:17:09,920 --> 08:17:14,798
arithmetic operators, relational
12184
08:17:11,920 --> 08:17:17,120
operators, boolean, string, and file
12185
08:17:14,798 --> 08:17:19,600
test operators. So this is the first
12186
08:17:17,120 --> 08:17:21,680
table and these are your arithmetic
12187
08:17:19,600 --> 08:17:23,920
operators. You have addition,
12188
08:17:21,680 --> 08:17:27,040
subtraction, multiplication, division,
12189
08:17:23,920 --> 08:17:29,280
modulus, assignment, equality and not
12190
08:17:27,040 --> 08:17:31,120
equality. It's very important to
12191
08:17:29,280 --> 08:17:33,600
understand that all these conditional
12192
08:17:31,120 --> 08:17:36,080
expressions should be inside of squared
12193
08:17:33,600 --> 08:17:38,240
braces with spaces around them. Now all
12194
08:17:36,080 --> 08:17:40,878
the arithmetic calculations are done
12195
08:17:38,240 --> 08:17:43,200
using long integers. Next we have
12196
08:17:40,878 --> 08:17:45,680
relational operators. Now the bond shell
12197
08:17:43,200 --> 08:17:48,240
supports these relational operators that
12198
08:17:45,680 --> 08:17:51,040
are specific to the numeric values. Now
12199
08:17:48,240 --> 08:17:54,320
these operators do not work for string
12200
08:17:51,040 --> 08:17:57,040
values unless their value is numeric. We
12201
08:17:54,320 --> 08:17:59,280
have again the equal operant not equal
12202
08:17:57,040 --> 08:18:02,240
to, greater than, less than, greater
12203
08:17:59,280 --> 08:18:04,320
than equal to or less than equal to.
12204
08:18:02,240 --> 08:18:06,240
Then we have the boolean operators which
12205
08:18:04,320 --> 08:18:09,920
are just three. There's the logical
12206
08:18:06,240 --> 08:18:12,718
negotiation, logical or and logical and.
12207
08:18:09,920 --> 08:18:16,320
And finally we have the string operators
12208
08:18:12,718 --> 08:18:20,558
which are equals, not equals, check if
12209
08:18:16,320 --> 08:18:23,840
operand is zero, not zero and check if
12210
08:18:20,558 --> 08:18:26,478
string is empty. And finally we have the
12211
08:18:23,840 --> 08:18:28,558
file test operators. Now we have a few
12212
08:18:26,478 --> 08:18:30,878
operators that can be used to test
12213
08:18:28,558 --> 08:18:33,360
various properties associated to a Unix
12214
08:18:30,878 --> 08:18:36,638
file. Now assume a variable file holds
12215
08:18:33,360 --> 08:18:38,558
an existing name of the size 100 bytes
12216
08:18:36,638 --> 08:18:41,760
and has to read, write and execute
12217
08:18:38,558 --> 08:18:44,878
permission on. So you have your hyphen B
12218
08:18:41,760 --> 08:18:47,760
which checks if the file is a block
12219
08:18:44,878 --> 08:18:49,680
special file. Then you have hyphen C
12220
08:18:47,760 --> 08:18:52,240
which checks if a file is a character
12221
08:18:49,680 --> 08:18:55,360
special file. If the file is a directory
12222
08:18:52,240 --> 08:18:57,280
which is hyphen D hyphen F is if a file
12223
08:18:55,360 --> 08:18:59,280
is an ordinary file as opposed to a
12224
08:18:57,280 --> 08:19:01,520
directory or a special file. Then you
12225
08:18:59,280 --> 08:19:05,040
have hyphen g which checks if the file
12226
08:19:01,520 --> 08:19:08,638
has its set group ID hyphen k which has
12227
08:19:05,040 --> 08:19:11,360
its sticky bit set hyphen p which is a
12228
08:19:08,638 --> 08:19:14,000
named pipe hyphen t which checks if it's
12229
08:19:11,360 --> 08:19:18,000
associated with a terminal hyphen u has
12230
08:19:14,000 --> 08:19:20,398
its set user ID r is readable w is
12231
08:19:18,000 --> 08:19:23,200
writable and x is executable which we
12232
08:19:20,398 --> 08:19:26,320
had discussed before then you have s
12233
08:19:23,200 --> 08:19:29,200
with a size greater than zero and e if
12234
08:19:26,320 --> 08:19:31,760
the file exists. Now these are specific
12235
08:19:29,200 --> 08:19:34,240
to the bond shell. There are other
12236
08:19:31,760 --> 08:19:36,478
operators that are available in the C
12237
08:19:34,240 --> 08:19:38,398
shell types but you shall find a lot of
12238
08:19:36,478 --> 08:19:41,120
content surrounding that. It's not
12239
08:19:38,398 --> 08:19:44,878
really crucial to discuss that in this
12240
08:19:41,120 --> 08:19:47,600
module. So let's move on. Next we have
12241
08:19:44,878 --> 08:19:51,040
shell loops. In this segment we going to
12242
08:19:47,600 --> 08:19:53,200
discuss shell loops in Linux. A loop is
12243
08:19:51,040 --> 08:19:55,280
basically a very powerful programming
12244
08:19:53,200 --> 08:19:57,760
tool that enables you to execute a set
12245
08:19:55,280 --> 08:19:59,920
of commands repeatedly. Here we shall
12246
08:19:57,760 --> 08:20:02,878
discuss the while loop, the for loop,
12247
08:19:59,920 --> 08:20:05,520
until loop, the nested loops and loop
12248
08:20:02,878 --> 08:20:08,718
control which will include the infinite
12249
08:20:05,520 --> 08:20:11,440
loop and how to get out of it with break
12250
08:20:08,718 --> 08:20:13,840
and continue commands. For that again as
12251
08:20:11,440 --> 08:20:16,558
most of you might have correctly guessed
12252
08:20:13,840 --> 08:20:19,200
let me head back to the terminal. So
12253
08:20:16,558 --> 08:20:23,040
first let's discuss the for loop. So the
12254
08:20:19,200 --> 08:20:25,920
for loop operates on lists of items. It
12255
08:20:23,040 --> 08:20:30,398
repeats a set of commands for every item
12256
08:20:25,920 --> 08:20:34,638
in the list. So let me open the nano
12257
08:20:30,398 --> 08:20:37,120
editor. Let's see. Let's call it edit.
12258
08:20:34,638 --> 08:20:40,558
All right. So basically this is how the
12259
08:20:37,120 --> 08:20:45,440
syntax of your for loop goes for your
12260
08:20:40,558 --> 08:20:48,558
certain variable in say your word one,
12261
08:20:45,440 --> 08:20:52,240
word two, so on and so forth till your
12262
08:20:48,558 --> 08:20:54,798
word n then you have a do statement.
12263
08:20:52,240 --> 08:20:57,920
whatever you want your for loop to do
12264
08:20:54,798 --> 08:21:01,120
and then done. And this is basically how
12265
08:20:57,920 --> 08:21:04,958
your for loop works. So here I'll give
12266
08:21:01,120 --> 08:21:07,520
you a simple example of how
12267
08:21:04,958 --> 08:21:10,798
the for loop works. It's basically going
12268
08:21:07,520 --> 08:21:14,240
to span through a given set of numbers
12269
08:21:10,798 --> 08:21:17,120
set 0 to 9 and upon execution it should
12270
08:21:14,240 --> 08:21:20,000
print all those numbers. It's basically
12271
08:21:17,120 --> 08:21:22,240
printing out this variable for all the
12272
08:21:20,000 --> 08:21:26,398
variables that are there in the set.
12273
08:21:22,240 --> 08:21:29,200
It's pretty simple. So again,
12274
08:21:26,398 --> 08:21:31,440
chod and then
12275
08:21:29,200 --> 08:21:35,040
and there we go. Now what if you had to
12276
08:21:31,440 --> 08:21:37,760
do the same thing using another way? We
12277
08:21:35,040 --> 08:21:40,878
have for you the while loop. Let's get
12278
08:21:37,760 --> 08:21:43,200
out of here. Let's open this and see how
12279
08:21:40,878 --> 08:21:45,680
the while loop is different from the for
12280
08:21:43,200 --> 08:21:48,398
loop. Now the Y loop what it does is
12281
08:21:45,680 --> 08:21:51,600
that it enables you to execute a set of
12282
08:21:48,398 --> 08:21:54,240
commands repeatedly until some condition
12283
08:21:51,600 --> 08:21:56,080
occurs. So it is usually used when you
12284
08:21:54,240 --> 08:21:58,718
need to manipulate the value of a
12285
08:21:56,080 --> 08:22:01,040
variable repeatedly. The syntax of a
12286
08:21:58,718 --> 08:22:03,600
while command looks something like this.
12287
08:22:01,040 --> 08:22:06,398
So you have a while and then you have a
12288
08:22:03,600 --> 08:22:10,558
command a condition if you will then you
12289
08:22:06,398 --> 08:22:13,680
do and then there's this statement what
12290
08:22:10,558 --> 08:22:15,920
you want to be done and then done. I'm
12291
08:22:13,680 --> 08:22:19,798
going to demonstrate the same example
12292
08:22:15,920 --> 08:22:19,798
using the while loop.
12293
08:22:23,120 --> 08:22:27,040
Now this is basically going to do what
12294
08:22:24,718 --> 08:22:29,840
we did with the for loop but using the y
12295
08:22:27,040 --> 08:22:32,320
loop. We start with assigning a value to
12296
08:22:29,840 --> 08:22:35,680
a which is our variable. Now we say
12297
08:22:32,320 --> 08:22:38,718
while a is less than 10, it's going to
12298
08:22:35,680 --> 08:22:41,120
print a and then increase the value of a
12299
08:22:38,718 --> 08:22:43,920
to a + 1. That's all that is there
12300
08:22:41,120 --> 08:22:46,240
inside the loop. Now let's try executing
12301
08:22:43,920 --> 08:22:49,240
this again. I'm going to change the
12302
08:22:46,240 --> 08:22:49,240
permissions
12303
08:22:51,600 --> 08:22:56,638
and it prints the same exact thing. Here
12304
08:22:54,000 --> 08:23:00,638
the shell command is evaluated if the
12305
08:22:56,638 --> 08:23:03,920
resulting value is true. So as long as a
12306
08:23:00,638 --> 08:23:06,798
is less than 10, it will keep printing a
12307
08:23:03,920 --> 08:23:09,600
and adding one to it. Once it reaches
12308
08:23:06,798 --> 08:23:12,000
10, your while loop breaks and you come
12309
08:23:09,600 --> 08:23:14,638
out of the loop. Each time the loop
12310
08:23:12,000 --> 08:23:17,040
executes, the variable A is checked.
12311
08:23:14,638 --> 08:23:20,398
Let's try doing this one more time using
12312
08:23:17,040 --> 08:23:22,558
the until loop. Let me clear this out.
12313
08:23:20,398 --> 08:23:24,320
Now, the while loop is perfect for a
12314
08:23:22,558 --> 08:23:26,558
situation where you need to execute a
12315
08:23:24,320 --> 08:23:29,120
set of commands while some condition is
12316
08:23:26,558 --> 08:23:31,760
true. Sometimes you need to execute a
12317
08:23:29,120 --> 08:23:34,240
set of commands until a condition is
12318
08:23:31,760 --> 08:23:37,718
true. And that is where you use the
12319
08:23:34,240 --> 08:23:37,718
until command.
12320
08:23:38,398 --> 08:23:43,760
I'm going to go back here and you'll
12321
08:23:40,958 --> 08:23:47,120
notice that the structure of until
12322
08:23:43,760 --> 08:23:50,798
command is pretty similar to that of
12323
08:23:47,120 --> 08:23:53,120
your while. Again, you have your until
12324
08:23:50,798 --> 08:23:55,520
statement, then the command or the
12325
08:23:53,120 --> 08:23:57,280
condition, then you have your loop
12326
08:23:55,520 --> 08:24:00,638
beginning, whatever you want to happen
12327
08:23:57,280 --> 08:24:03,200
in the loop, and then done. Here once
12328
08:24:00,638 --> 08:24:06,000
the shell command is evaluated if the
12329
08:24:03,200 --> 08:24:08,478
resulting value is false the given
12330
08:24:06,000 --> 08:24:10,718
statement is then executed. If the
12331
08:24:08,478 --> 08:24:13,120
command is true then no statement will
12332
08:24:10,718 --> 08:24:16,080
be executed and the program jumps to the
12333
08:24:13,120 --> 08:24:19,920
next line after the done statement. So
12334
08:24:16,080 --> 08:24:22,080
again because I'm lazy I am going to do
12335
08:24:19,920 --> 08:24:24,718
the exact same thing as I did twice
12336
08:24:22,080 --> 08:24:26,638
before but this time using the until
12337
08:24:24,718 --> 08:24:29,520
command.
12338
08:24:26,638 --> 08:24:33,920
Same thing here. Instead of while, it's
12339
08:24:29,520 --> 08:24:37,600
until. So until your a is not less than
12340
08:24:33,920 --> 08:24:40,478
zero, it's going to keep printing a and
12341
08:24:37,600 --> 08:24:46,440
then incrementing the value of a. So
12342
08:24:40,478 --> 08:24:46,440
even if what gets printed is the same,
12343
08:24:47,280 --> 08:24:53,120
you know for a fact that how the
12344
08:24:50,160 --> 08:24:55,120
procedure was gone about was different.
12345
08:24:53,120 --> 08:24:58,320
When you use the while command, your
12346
08:24:55,120 --> 08:25:00,638
statement is executed while your
12347
08:24:58,320 --> 08:25:03,120
condition is true. But when you use the
12348
08:25:00,638 --> 08:25:06,798
until command, your statement keeps
12349
08:25:03,120 --> 08:25:09,840
executing until your condition is true.
12350
08:25:06,798 --> 08:25:13,040
With that, let me clean this out and
12351
08:25:09,840 --> 08:25:15,600
then we shall move to nested loops. Let
12352
08:25:13,040 --> 08:25:17,920
me get out of here.
12353
08:25:15,600 --> 08:25:20,240
Okay. Now, next let's talk a little bit
12354
08:25:17,920 --> 08:25:23,520
about the nesting of loops. Now all the
12355
08:25:20,240 --> 08:25:25,600
loops support nesting concept in Linux
12356
08:25:23,520 --> 08:25:28,240
which means you can basically put one
12357
08:25:25,600 --> 08:25:31,040
loop inside another similar or different
12358
08:25:28,240 --> 08:25:33,760
loop. This nesting can go on up to
12359
08:25:31,040 --> 08:25:35,760
unlimited number of times based on what
12360
08:25:33,760 --> 08:25:39,040
you require. Now let me give you an
12361
08:25:35,760 --> 08:25:40,878
example of nesting using the while loop.
12362
08:25:39,040 --> 08:25:44,478
So remember the simple while loop that
12363
08:25:40,878 --> 08:25:46,160
you ran which went from 0 to 9. What
12364
08:25:44,478 --> 08:25:48,958
we're going to do is basically we're
12365
08:25:46,160 --> 08:25:53,360
just going to add another while inside
12366
08:25:48,958 --> 08:25:56,240
the previous one. So nano
12367
08:25:53,360 --> 08:25:57,840
okay remember till here it's pretty much
12368
08:25:56,240 --> 08:26:00,878
the same as the previous one that is
12369
08:25:57,840 --> 08:26:04,240
your first loop inside we are going to
12370
08:26:00,878 --> 08:26:07,040
assign the value of a to b and while
12371
08:26:04,240 --> 08:26:09,440
your b remains greater than zero it's
12372
08:26:07,040 --> 08:26:13,840
now going to go to a new line which is
12373
08:26:09,440 --> 08:26:15,760
this n flag print b and then increment b
12374
08:26:13,840 --> 08:26:19,600
once it comes out of the loop it's going
12375
08:26:15,760 --> 08:26:21,520
to increment a and so on and so forth
12376
08:26:19,600 --> 08:26:24,558
let Let me show you what this looks
12377
08:26:21,520 --> 08:26:26,558
like. Now the result here is not very
12378
08:26:24,558 --> 08:26:29,600
important but what you need to
12379
08:26:26,558 --> 08:26:34,120
understand is how the basic structure of
12380
08:26:29,600 --> 08:26:34,120
the loop is and how it works.
12381
08:26:34,878 --> 08:26:41,760
So again like you can see a starts with
12382
08:26:37,760 --> 08:26:44,478
zero. Now while a is less than 10 0
12383
08:26:41,760 --> 08:26:46,558
being less than 10 a is assigned to b.
12384
08:26:44,478 --> 08:26:50,000
Now while B is greater than equal to
12385
08:26:46,558 --> 08:26:53,040
zero which now B is it is zero. It's
12386
08:26:50,000 --> 08:26:56,318
going to go to a new line and print B.
12387
08:26:53,040 --> 08:26:59,040
It printed zero. Then it's going to
12388
08:26:56,318 --> 08:27:01,920
increment the value of B and turn it
12389
08:26:59,040 --> 08:27:04,638
into one. And now once B is incremented
12390
08:27:01,920 --> 08:27:08,478
it gets out of that loop followed by the
12391
08:27:04,638 --> 08:27:11,760
increment of A which now A becomes A + 1
12392
08:27:08,478 --> 08:27:15,120
that is 1. And it keeps going on and on
12393
08:27:11,760 --> 08:27:18,240
and on and on till finally your a is no
12394
08:27:15,120 --> 08:27:21,040
longer less than 10. So with that let's
12395
08:27:18,240 --> 08:27:22,958
move on to our next topic which is of
12396
08:27:21,040 --> 08:27:26,798
loop control. Here we are going to
12397
08:27:22,958 --> 08:27:29,600
discuss some very important concepts.
12398
08:27:26,798 --> 08:27:32,318
But before I introduce the concept of
12399
08:27:29,600 --> 08:27:36,318
loop control, first we need to
12400
08:27:32,318 --> 08:27:38,478
understand what infinite loop is. So let
12401
08:27:36,318 --> 08:27:43,240
me
12402
08:27:38,478 --> 08:27:43,240
create an infinite loop.
12403
08:27:44,398 --> 08:27:54,318
So let's start with a equ= suppose 10
12404
08:27:49,440 --> 08:28:00,478
and let's go saying as long as
12405
08:27:54,318 --> 08:28:03,760
a is greater than zero start your loop
12406
08:28:00,478 --> 08:28:06,478
and you're going to print a and then we
12407
08:28:03,760 --> 08:28:11,200
are going to
12408
08:28:06,478 --> 08:28:16,520
increment the value of a
12409
08:28:11,200 --> 08:28:16,520
and then done ctrl Oh.
12410
08:28:29,120 --> 08:28:34,000
And now what this is going to do is it's
12411
08:28:31,760 --> 08:28:37,520
just going to go on and on and on and on
12412
08:28:34,000 --> 08:28:39,600
and on because it will go on until a is
12413
08:28:37,520 --> 08:28:42,080
greater than zero. And it's always going
12414
08:28:39,600 --> 08:28:45,920
to be greater than zero. So let me just
12415
08:28:42,080 --> 08:28:48,718
put a stop to it. This by using Ctrl C I
12416
08:28:45,920 --> 08:28:50,798
can put a force stop to it. Now you can
12417
08:28:48,718 --> 08:28:52,958
also do that using something known as
12418
08:28:50,798 --> 08:28:54,798
the break statement. Now the break
12419
08:28:52,958 --> 08:28:57,040
statement is used to terminate the
12420
08:28:54,798 --> 08:28:58,718
execution of an entire loop after
12421
08:28:57,040 --> 08:29:01,120
completing the execution of all the
12422
08:28:58,718 --> 08:29:04,558
lines of code up to the break statement.
12423
08:29:01,120 --> 08:29:09,200
Now let's see how that works. So I am
12424
08:29:04,558 --> 08:29:11,680
going to exit this. And
12425
08:29:09,200 --> 08:29:14,638
now this is a simple example which shows
12426
08:29:11,680 --> 08:29:21,318
that the loop will terminate as soon as
12427
08:29:14,638 --> 08:29:21,318
a becomes equal to 5. So let's go ahead
12428
08:29:25,200 --> 08:29:31,600
and you go and 1 2 3 4 5. Now another
12429
08:29:28,318 --> 08:29:33,520
statement associated to it is the
12430
08:29:31,600 --> 08:29:35,920
continue statement which is similar to
12431
08:29:33,520 --> 08:29:38,160
the break statement except that it
12432
08:29:35,920 --> 08:29:41,600
causes the current iteration of the loop
12433
08:29:38,160 --> 08:29:43,520
to exit rather than the entire loop. So
12434
08:29:41,600 --> 08:29:45,360
this statement is useful when an error
12435
08:29:43,520 --> 08:29:47,840
has occurred but you want to try to
12436
08:29:45,360 --> 08:29:52,200
execute the next iteration of the loop.
12437
08:29:47,840 --> 08:29:52,200
Let's look at one of those.
12438
08:29:54,398 --> 08:30:00,478
So basically what you see in this script
12439
08:29:58,398 --> 08:30:03,760
is that this loop makes use of the
12440
08:30:00,478 --> 08:30:06,798
continuous statement to return from this
12441
08:30:03,760 --> 08:30:11,798
particular statement to the next one
12442
08:30:06,798 --> 08:30:11,798
which is the found odd number statement.
12443
08:30:20,878 --> 08:30:26,798
So if we try to run it,
12444
08:30:24,000 --> 08:30:30,160
you will receive this result. Found an
12445
08:30:26,798 --> 08:30:32,718
odd number. Even odd, even odd, even
12446
08:30:30,160 --> 08:30:35,200
odd. It's basically very similar to the
12447
08:30:32,718 --> 08:30:38,000
break command except for the fact that
12448
08:30:35,200 --> 08:30:40,478
your break command will exit the entire
12449
08:30:38,000 --> 08:30:43,920
loop while the continue statement will
12450
08:30:40,478 --> 08:30:47,120
only exit the current iteration. On your
12451
08:30:43,920 --> 08:30:49,520
left you see this little script where we
12452
08:30:47,120 --> 08:30:53,120
trying to see this numbers that we have
12453
08:30:49,520 --> 08:30:55,360
put in 1 to 7 which of them are even and
12454
08:30:53,120 --> 08:30:57,440
which of them are odd. Now what you'll
12455
08:30:55,360 --> 08:31:00,160
see here is that the script uses the
12456
08:30:57,440 --> 08:31:02,718
continue command to exit from this
12457
08:31:00,160 --> 08:31:08,478
particular statement to this particular
12458
08:31:02,718 --> 08:31:10,718
statement. So if I tried to run this,
12459
08:31:08,478 --> 08:31:13,280
it keeps exiting
12460
08:31:10,718 --> 08:31:16,160
this to produce this even number
12461
08:31:13,280 --> 08:31:18,558
statement. With that we come to the end
12462
08:31:16,160 --> 08:31:23,280
of shell loops. Let's go back to the
12463
08:31:18,558 --> 08:31:25,360
presentation to see what we have next.
12464
08:31:23,280 --> 08:31:28,080
So in this segment we will discuss in
12465
08:31:25,360 --> 08:31:30,160
detail about functions in the shell. Now
12466
08:31:28,080 --> 08:31:32,240
basically what functions enable you to
12467
08:31:30,160 --> 08:31:34,878
do is to break down the overall
12468
08:31:32,240 --> 08:31:37,280
functionality of a script into smaller
12469
08:31:34,878 --> 08:31:39,280
more logical subsections which can be
12470
08:31:37,280 --> 08:31:42,000
then called upon to perform their
12471
08:31:39,280 --> 08:31:44,080
individual tasks whenever needed. So in
12472
08:31:42,000 --> 08:31:46,558
this segment we are going to talk about
12473
08:31:44,080 --> 08:31:49,360
creating functions passing parameters
12474
08:31:46,558 --> 08:31:52,398
returning values nested functions and
12475
08:31:49,360 --> 08:31:55,440
calling from prompt. So here we are at
12476
08:31:52,398 --> 08:31:58,440
our terminal. Let's again open our nano
12477
08:31:55,440 --> 08:31:58,440
editor.
12478
08:31:58,478 --> 08:32:04,798
So to declare a function is very simple.
12479
08:32:02,000 --> 08:32:07,200
What you will have to do is type your
12480
08:32:04,798 --> 08:32:10,318
function name
12481
08:32:07,200 --> 08:32:12,398
and then go ahead with your list of
12482
08:32:10,318 --> 08:32:15,040
commands
12483
08:32:12,398 --> 08:32:17,520
and then close the bracket. This is all
12484
08:32:15,040 --> 08:32:21,440
that you have to do. Now let's start
12485
08:32:17,520 --> 08:32:23,840
with this very basic function. Start
12486
08:32:21,440 --> 08:32:27,280
with the shebang. Again, not to be
12487
08:32:23,840 --> 08:32:30,080
confused with the shebang in the pop
12488
08:32:27,280 --> 08:32:32,398
culture that we use.
12489
08:32:30,080 --> 08:32:34,718
So, what we're going to do first is that
12490
08:32:32,398 --> 08:32:37,040
we're going to define function. So,
12491
08:32:34,718 --> 08:32:39,600
again, this is my function name. It's
12492
08:32:37,040 --> 08:32:44,240
going to be hello. And then I am going
12493
08:32:39,600 --> 08:32:46,798
to just print hello learner. Nothing
12494
08:32:44,240 --> 08:32:50,638
very complicated. And then all I have to
12495
08:32:46,798 --> 08:32:52,558
do is just invoke my function or call my
12496
08:32:50,638 --> 08:32:55,760
function, whatever it is.
12497
08:32:52,558 --> 08:32:58,760
So hello. Then I'm going to save it. And
12498
08:32:55,760 --> 08:32:58,760
here
12499
08:32:59,200 --> 08:33:03,920
it basically called that function. And
12500
08:33:01,280 --> 08:33:06,000
that's how simple that is. Now using
12501
08:33:03,920 --> 08:33:08,558
functions to perform repetitive task is
12502
08:33:06,000 --> 08:33:11,120
an excellent way to create code reuse.
12503
08:33:08,558 --> 08:33:13,600
This is an important part of modern
12504
08:33:11,120 --> 08:33:15,600
object-oriented programming principles.
12505
08:33:13,600 --> 08:33:18,160
Now, shell functions are similar to sub
12506
08:33:15,600 --> 08:33:20,638
routines, procedures, and functions that
12507
08:33:18,160 --> 08:33:23,200
are present in your other software and
12508
08:33:20,638 --> 08:33:25,920
hardware coding languages. The idea here
12509
08:33:23,200 --> 08:33:28,398
is to break down a big program into
12510
08:33:25,920 --> 08:33:30,160
smaller, more logical subsections which
12511
08:33:28,398 --> 08:33:32,798
can then be called whenever they need
12512
08:33:30,160 --> 08:33:35,280
it. Now, you can define a function that
12513
08:33:32,798 --> 08:33:37,680
will accept parameters while calling the
12514
08:33:35,280 --> 08:33:39,920
function. Now these parameters can be
12515
08:33:37,680 --> 08:33:42,638
represented by dollar one and dollar two
12516
08:33:39,920 --> 08:33:44,958
as we had passed parameters early on if
12517
08:33:42,638 --> 08:33:49,200
you remember. Now here if I make some
12518
08:33:44,958 --> 08:33:53,120
minor changes to my function I think I
12519
08:33:49,200 --> 08:33:56,958
can make it accept parameters. So hello
12520
08:33:53,120 --> 08:34:00,398
and I can put two different parameters
12521
08:33:56,958 --> 08:34:03,920
and then what I can do is I can put
12522
08:34:00,398 --> 08:34:07,680
those parameters right here. Let's say
12523
08:34:03,920 --> 08:34:10,718
I'll put two names. Let's say I'll put
12524
08:34:07,680 --> 08:34:13,120
Priyanka Chopra because you know pretty
12525
08:34:10,718 --> 08:34:15,280
international. Let's just keep it that
12526
08:34:13,120 --> 08:34:18,718
way.
12527
08:34:15,280 --> 08:34:21,040
And that is what it called. Basically
12528
08:34:18,718 --> 08:34:23,520
these two parameters were captured and
12529
08:34:21,040 --> 08:34:26,478
printed in this function. What you can
12530
08:34:23,520 --> 08:34:28,558
also do is return values from functions.
12531
08:34:26,478 --> 08:34:30,878
If you execute the exit command from
12532
08:34:28,558 --> 08:34:32,718
inside a function, its effect is not
12533
08:34:30,878 --> 08:34:35,840
only to terminate execution of the
12534
08:34:32,718 --> 08:34:38,160
function but also the shell program that
12535
08:34:35,840 --> 08:34:40,080
called the function. If you instead want
12536
08:34:38,160 --> 08:34:42,478
to just terminate the execution of the
12537
08:34:40,080 --> 08:34:44,478
function, there is a way to come out of
12538
08:34:42,478 --> 08:34:46,318
the defined function. Now based on the
12539
08:34:44,478 --> 08:34:48,478
situation, you can return any value of
12540
08:34:46,318 --> 08:34:50,080
the function using the return command.
12541
08:34:48,478 --> 08:34:52,160
So
12542
08:34:50,080 --> 08:34:54,240
again, what we can do is make some
12543
08:34:52,160 --> 08:34:57,200
changes here.
12544
08:34:54,240 --> 08:35:02,558
Let me return
12545
08:34:57,200 --> 08:35:05,600
this. Another thing I'm going to do is
12546
08:35:02,558 --> 08:35:09,200
capture this 10 value that has been
12547
08:35:05,600 --> 08:35:11,120
returned from my previous command.
12548
08:35:09,200 --> 08:35:14,160
All right. So what I'm going to do is
12549
08:35:11,120 --> 08:35:16,000
I'm going to print this out by echo and
12550
08:35:14,160 --> 08:35:19,680
then
12551
08:35:16,000 --> 08:35:25,558
return value is.
12552
08:35:19,680 --> 08:35:25,558
So, I'm going to put this here.
12553
08:35:32,878 --> 08:35:37,840
So here as you can see the parameters
12554
08:35:34,958 --> 08:35:40,478
that we had passed and the value that
12555
08:35:37,840 --> 08:35:42,318
has been returned. Now one of the more
12556
08:35:40,478 --> 08:35:44,558
interesting features of functions is
12557
08:35:42,318 --> 08:35:46,798
that they can call themselves and also
12558
08:35:44,558 --> 08:35:48,318
other functions. A function that calls
12559
08:35:46,798 --> 08:35:50,638
itself is known as the recursive
12560
08:35:48,318 --> 08:35:52,558
function as most of you might know. Now,
12561
08:35:50,638 --> 08:35:54,878
I'll also give you an example
12562
08:35:52,558 --> 08:35:57,120
demonstrating the nesting of two
12563
08:35:54,878 --> 08:36:02,240
functions. So, let me just clear this
12564
08:35:57,120 --> 08:36:08,120
out. I could open a new nano editor, but
12565
08:36:02,240 --> 08:36:08,120
let's just say I am very lazy. So,
12566
08:36:35,440 --> 08:36:41,680
Okay, now let's execute this. Basically,
12567
08:36:38,398 --> 08:36:43,840
we have a function number two inside the
12568
08:36:41,680 --> 08:36:46,160
function number one function is saying
12569
08:36:43,840 --> 08:36:48,558
alpha online over and then calling
12570
08:36:46,160 --> 08:36:51,520
number two and number two here is
12571
08:36:48,558 --> 08:36:54,318
printing beta online and then we are
12572
08:36:51,520 --> 08:36:58,000
calling the function number one which is
12573
08:36:54,318 --> 08:37:01,120
our superset if you may in the function.
12574
08:36:58,000 --> 08:37:05,040
So if we execute this, we get the first
12575
08:37:01,120 --> 08:37:07,760
one, alpha online over and beta online.
12576
08:37:05,040 --> 08:37:09,680
I clearly watch a lot of movies as well.
12577
08:37:07,760 --> 08:37:12,000
And now you can put on definitions for
12578
08:37:09,680 --> 08:37:14,000
more commonly used functions inside your
12579
08:37:12,000 --> 08:37:16,000
profile. And these functions will be
12580
08:37:14,000 --> 08:37:18,558
available whenever you log in and you
12581
08:37:16,000 --> 08:37:21,040
can use them at the command prompt.
12582
08:37:18,558 --> 08:37:23,920
Alternatively, you can also group the
12583
08:37:21,040 --> 08:37:27,440
definitions in a file and then execute
12584
08:37:23,920 --> 08:37:29,520
the file in the current shell. With that
12585
08:37:27,440 --> 08:37:31,680
I come to the end of the segment as
12586
08:37:29,520 --> 08:37:34,718
well. Now we are going to move on to
12587
08:37:31,680 --> 08:37:37,280
some used cases on a small scale of
12588
08:37:34,718 --> 08:37:40,000
course to see how shell scripting is
12589
08:37:37,280 --> 08:37:44,478
used on a broader scale on a day-to-day
12590
08:37:40,000 --> 08:37:48,478
basis. So I am going to clear this and I
12591
08:37:44,478 --> 08:37:50,718
am going to clear this as well. So let's
12592
08:37:48,478 --> 08:37:53,760
run a few simple scripts to scan and
12593
08:37:50,718 --> 08:37:56,080
monitor network using the combination of
12594
08:37:53,760 --> 08:37:58,080
your shell script and your ping command.
12595
08:37:56,080 --> 08:38:00,718
Obviously these scripts are no match to
12596
08:37:58,080 --> 08:38:03,760
a full monitoring dedicated software
12597
08:38:00,718 --> 08:38:06,558
like Nagios, but they could be useful
12598
08:38:03,760 --> 08:38:08,558
for a small home brand networks where
12599
08:38:06,558 --> 08:38:11,200
implementing sophisticated monitoring
12600
08:38:08,558 --> 08:38:12,958
systems can become an overhead. Let's
12601
08:38:11,200 --> 08:38:17,040
look at something simple first. Okay,
12602
08:38:12,958 --> 08:38:19,280
let's look at a scan. So your dot slash.
12603
08:38:17,040 --> 08:38:21,120
Okay, so let me just show you the code
12604
08:38:19,280 --> 08:38:23,040
for this.
12605
08:38:21,120 --> 08:38:25,120
So right now we are going to run a few
12606
08:38:23,040 --> 08:38:27,280
simple scripts to scan and monitor the
12607
08:38:25,120 --> 08:38:29,760
network using a combination of bash and
12608
08:38:27,280 --> 08:38:31,920
ping. Now this is a disclaimer here.
12609
08:38:29,760 --> 08:38:33,920
These scripts are no match for a full
12610
08:38:31,920 --> 08:38:37,120
monitoring dedicated software, something
12611
08:38:33,920 --> 08:38:39,520
like your Nagios, but they could be very
12612
08:38:37,120 --> 08:38:41,280
useful for small home brand networks
12613
08:38:39,520 --> 08:38:42,878
where implementing sophisticated
12614
08:38:41,280 --> 08:38:44,798
monitoring systems can become an
12615
08:38:42,878 --> 08:38:48,638
overhead. So let's start with something
12616
08:38:44,798 --> 08:38:52,080
simple like scanning a network. So this
12617
08:38:48,638 --> 08:38:54,000
is the code. In this script, what we are
12618
08:38:52,080 --> 08:38:56,638
going to do is we going to scan the
12619
08:38:54,000 --> 08:38:59,920
network for hosts that are attached to
12620
08:38:56,638 --> 08:39:04,160
an IP address and the script will print
12621
08:38:59,920 --> 08:39:07,040
the message nodes with IP. So if your IP
12622
08:39:04,160 --> 08:39:09,760
address is up, then your ping command
12623
08:39:07,040 --> 08:39:11,920
was successful. Feel free to modify the
12624
08:39:09,760 --> 08:39:15,120
script to scan your host's range
12625
08:39:11,920 --> 08:39:19,280
whenever you try it. So as you can see
12626
08:39:15,120 --> 08:39:23,200
it starts with your basic shebang line.
12627
08:39:19,280 --> 08:39:26,638
Then we are using our ping and we are
12628
08:39:23,200 --> 08:39:29,680
basically checking for the exit status
12629
08:39:26,638 --> 08:39:33,680
for being zero. Now if your exit status
12630
08:39:29,680 --> 08:39:37,360
is equal to zero then it will print that
12631
08:39:33,680 --> 08:39:39,600
your IP address is up. Pretty simple. If
12632
08:39:37,360 --> 08:39:42,318
we go deeper into it now, we're going to
12633
08:39:39,600 --> 08:39:47,280
run this loop for IP addresses from 1 to
12634
08:39:42,318 --> 08:39:49,200
255 in the subnet 192.168.2.
12635
08:39:47,280 --> 08:39:51,760
Basically, what's going to do is it's
12636
08:39:49,200 --> 08:39:54,160
going to ping these many systems and
12637
08:39:51,760 --> 08:39:56,318
check if they are up and then disone
12638
08:39:54,160 --> 08:39:59,200
them. All right, let's try running the
12639
08:39:56,318 --> 08:40:01,600
script.
12640
08:39:59,200 --> 08:40:05,040
Now, as you can see, these many systems
12641
08:40:01,600 --> 08:40:07,840
are up in this particular subnet. We
12642
08:40:05,040 --> 08:40:10,798
have a bunch of different ones. One of
12643
08:40:07,840 --> 08:40:13,280
them should be mine.
12644
08:40:10,798 --> 08:40:16,160
This one seems like it's mine. And so on
12645
08:40:13,280 --> 08:40:19,920
and so forth. All right, let's move on
12646
08:40:16,160 --> 08:40:22,080
to our next script.
12647
08:40:19,920 --> 08:40:24,398
Basically, what I did just now is I for
12648
08:40:22,080 --> 08:40:26,958
stopped this script. All right. Okay.
12649
08:40:24,398 --> 08:40:30,160
Now what we're going to do is we will
12650
08:40:26,958 --> 08:40:32,318
try to send an email to my email address
12651
08:40:30,160 --> 08:40:34,398
when the ping cannot reach its
12652
08:40:32,318 --> 08:40:36,958
destination which probably means the
12653
08:40:34,398 --> 08:40:39,200
host is down. So system admins can
12654
08:40:36,958 --> 08:40:41,200
execute this in a script regularly with
12655
08:40:39,200 --> 08:40:43,440
the use of a chron scheduleuler. Now
12656
08:40:41,200 --> 08:40:45,760
this script uses ping command to ping
12657
08:40:43,440 --> 08:40:48,798
the host or IP that is supplied to an
12658
08:40:45,760 --> 08:40:51,360
argument and in case that destination is
12659
08:40:48,798 --> 08:40:53,440
unreachable a mail command will be used
12660
08:40:51,360 --> 08:40:58,000
to notify the system administration
12661
08:40:53,440 --> 08:41:00,558
about this event. So let's look at this.
12662
08:40:58,000 --> 08:41:03,760
So cat
12663
08:41:00,558 --> 08:41:07,200
all right now this is what the script
12664
08:41:03,760 --> 08:41:09,200
looks like. also a pretty small code.
12665
08:41:07,200 --> 08:41:13,120
Again, it starts with the shebang line
12666
08:41:09,200 --> 08:41:16,000
and it runs a for loop. Now, here you
12667
08:41:13,120 --> 08:41:18,718
can see there is a special variable used
12668
08:41:16,000 --> 08:41:20,318
which is your dollar at which basically
12669
08:41:18,718 --> 08:41:23,120
means that all the arguments are
12670
08:41:20,318 --> 08:41:25,600
individually double quoted. So inside
12671
08:41:23,120 --> 08:41:28,718
this for loop basically we are trying to
12672
08:41:25,600 --> 08:41:32,160
ping all the parameters that are passed
12673
08:41:28,718 --> 08:41:35,440
and if the set parameter is not equal to
12674
08:41:32,160 --> 08:41:37,760
zero then we are going to get a mail to
12675
08:41:35,440 --> 08:41:40,478
this particular email address that the
12676
08:41:37,760 --> 08:41:43,040
host is down. All right. So, previously
12677
08:41:40,478 --> 08:41:45,280
we had checked for an entire subnet.
12678
08:41:43,040 --> 08:41:49,200
That is why we didn't have to pass on
12679
08:41:45,280 --> 08:41:51,600
any arguments. But here since we are not
12680
08:41:49,200 --> 08:41:55,120
running it for an entire subnet, we are
12681
08:41:51,600 --> 08:41:58,718
going to try it on on some trusty
12682
08:41:55,120 --> 08:42:01,840
websites. So, before I call in this
12683
08:41:58,718 --> 08:42:05,120
code, I would like to show you that this
12684
08:42:01,840 --> 08:42:07,760
is what my Gmail tab looks like. There's
12685
08:42:05,120 --> 08:42:10,878
nothing in my inbox currently. So what
12686
08:42:07,760 --> 08:42:14,478
I'm expecting is that when I pass on an
12687
08:42:10,878 --> 08:42:16,958
argument which is not supposed to be up,
12688
08:42:14,478 --> 08:42:21,680
I'm supposed to be getting a mail in my
12689
08:42:16,958 --> 08:42:24,080
Gmail, right? So let's run this.
12690
08:42:21,680 --> 08:42:26,398
Let's put in google.com because we know
12691
08:42:24,080 --> 08:42:30,638
it's always running. Let's put
12692
08:42:26,398 --> 08:42:33,760
yahoo.com. Let's put in an imaginary IP,
12693
08:42:30,638 --> 08:42:39,280
which I'm sure Let's hope this does not
12694
08:42:33,760 --> 08:42:41,600
exist. Let's put on one more for safety.
12695
08:42:39,280 --> 08:42:44,638
Okay, now we've put in four. We know for
12696
08:42:41,600 --> 08:42:47,840
a fact that google.com is always up. So
12697
08:42:44,638 --> 08:42:50,878
has yahoo.com. Now we'll have to check
12698
08:42:47,840 --> 08:42:53,200
which of these two IP addresses is not
12699
08:42:50,878 --> 08:42:55,920
up.
12700
08:42:53,200 --> 08:42:58,240
Now let me open my Gmail and check. And
12701
08:42:55,920 --> 08:43:00,558
as you can see, I have two new messages.
12702
08:42:58,240 --> 08:43:03,680
And if you open the mail, you can see
12703
08:43:00,558 --> 08:43:05,920
the message that we had put in as input.
12704
08:43:03,680 --> 08:43:08,798
All right. Now that we've done these two
12705
08:43:05,920 --> 08:43:11,920
things, let us try an extended version
12706
08:43:08,798 --> 08:43:14,718
of the same thing. Now I for stopped
12707
08:43:11,920 --> 08:43:16,958
this particular script from running
12708
08:43:14,718 --> 08:43:19,040
because it will go on and on and on and
12709
08:43:16,958 --> 08:43:21,680
on. Now what we're going to do is that
12710
08:43:19,040 --> 08:43:23,760
we're going to create a monitoring log.
12711
08:43:21,680 --> 08:43:26,478
So the last example I'm going to show
12712
08:43:23,760 --> 08:43:28,558
you here is a modified version of the
12713
08:43:26,478 --> 08:43:30,240
previous two examples. Now this example
12714
08:43:28,558 --> 08:43:32,478
that I'm going to show you is a modified
12715
08:43:30,240 --> 08:43:34,478
version of what I just showed you. When
12716
08:43:32,478 --> 08:43:36,558
the mail is not configured on the
12717
08:43:34,478 --> 08:43:38,958
system, the script will create a log
12718
08:43:36,558 --> 08:43:41,680
file. Now the core of the script is
12719
08:43:38,958 --> 08:43:44,398
wrapped into this endless while loop
12720
08:43:41,680 --> 08:43:46,878
which is set to execute ping and check
12721
08:43:44,398 --> 08:43:49,360
every minute. Feel free to modify the
12722
08:43:46,878 --> 08:43:51,120
script according to your own needs. And
12723
08:43:49,360 --> 08:43:53,280
you can also go ahead and remove the
12724
08:43:51,120 --> 08:43:54,878
endless while loop when you intend to
12725
08:43:53,280 --> 08:43:57,280
use the script with the cron
12726
08:43:54,878 --> 08:44:01,398
scheduleuler. All right, so let's see
12727
08:43:57,280 --> 08:44:01,398
what our script looks like.
12728
08:44:04,000 --> 08:44:09,200
So this is our script. Let me break it
12729
08:44:06,160 --> 08:44:12,318
down for you a little bit. So first of
12730
08:44:09,200 --> 08:44:15,200
all, I have created this log file which
12731
08:44:12,318 --> 08:44:18,240
is going to save if your host is up or
12732
08:44:15,200 --> 08:44:21,440
down in a temporary log file. It
12733
08:44:18,240 --> 08:44:23,680
basically is a directory. Then I have
12734
08:44:21,440 --> 08:44:25,760
created another variable called seconds.
12735
08:44:23,680 --> 08:44:28,318
So this script is going to run every 60
12736
08:44:25,760 --> 08:44:31,440
seconds to check which host is up. The
12737
08:44:28,318 --> 08:44:34,318
email is my email which I had shown you
12738
08:44:31,440 --> 08:44:36,160
previously. Then the for loop begins.
12739
08:44:34,318 --> 08:44:38,798
Now this is very similar to the previous
12740
08:44:36,160 --> 08:44:42,318
code that we had just run. This is the
12741
08:44:38,798 --> 08:44:44,558
same part. And here we have an infinite
12742
08:44:42,318 --> 08:44:48,240
loop which is basically what we're going
12743
08:44:44,558 --> 08:44:50,798
to run to check if a host is up. So we
12744
08:44:48,240 --> 08:44:53,600
going to ping the various arguments that
12745
08:44:50,798 --> 08:44:56,878
we're going to pass and if the said
12746
08:44:53,600 --> 08:45:00,160
argument is not equal to zero then the
12747
08:44:56,878 --> 08:45:03,520
status gets logged into our monitor log
12748
08:45:00,160 --> 08:45:06,638
and if the status is down then again
12749
08:45:03,520 --> 08:45:10,398
like our previous code we get a mail
12750
08:45:06,638 --> 08:45:13,680
that our host is down else if the host
12751
08:45:10,398 --> 08:45:16,080
is up you just ping okay the host is up
12752
08:45:13,680 --> 08:45:18,398
and there is no mail now the reason why
12753
08:45:16,080 --> 08:45:20,878
I'm not sending a mail when the host is
12754
08:45:18,398 --> 08:45:24,718
up. If suppose somebody uses this code
12755
08:45:20,878 --> 08:45:27,600
to check a subnet of a lot of systems,
12756
08:45:24,718 --> 08:45:29,040
you do not want to spam yourself with a
12757
08:45:27,600 --> 08:45:31,040
bunch of different mail saying the host
12758
08:45:29,040 --> 08:45:33,520
is up. That is not important. We want to
12759
08:45:31,040 --> 08:45:36,798
know when a host is down. And then this
12760
08:45:33,520 --> 08:45:38,958
if condition closes with an F5 and your
12761
08:45:36,798 --> 08:45:42,318
argument being up is also sent to the
12762
08:45:38,958 --> 08:45:44,558
log. And then we have sleep for the
12763
08:45:42,318 --> 08:45:47,440
seconds variable which we have put up as
12764
08:45:44,558 --> 08:45:51,360
60 seconds. So as I had mentioned the
12765
08:45:47,440 --> 08:45:53,680
script is going to run every 60 seconds.
12766
08:45:51,360 --> 08:45:56,718
So let's run this. I'm going to check
12767
08:45:53,680 --> 08:46:00,080
for google.com and this imaginary IP
12768
08:45:56,718 --> 08:46:03,200
address which as we had previously seen
12769
08:46:00,080 --> 08:46:07,600
is not up. And then let's put in
12770
08:46:03,200 --> 08:46:10,240
yahoo.com and yahoo123.com
12771
08:46:07,600 --> 08:46:15,040
which I'm hoping is not an actual
12772
08:46:10,240 --> 08:46:17,680
website. Let's put in this 2.2.2. And
12773
08:46:15,040 --> 08:46:19,600
now let's run the script. This might
12774
08:46:17,680 --> 08:46:21,920
take some time. So kindly be patient.
12775
08:46:19,600 --> 08:46:23,520
Let the script run. So while it runs,
12776
08:46:21,920 --> 08:46:25,600
let me explain this to you. As you can
12777
08:46:23,520 --> 08:46:28,080
see, the core of the script is wrapped
12778
08:46:25,600 --> 08:46:31,120
into an endless loop which is set to
12779
08:46:28,080 --> 08:46:32,798
execute ping check every 60 seconds.
12780
08:46:31,120 --> 08:46:35,120
Whenever you try the script, feel free
12781
08:46:32,798 --> 08:46:37,520
to modify it according to your needs.
12782
08:46:35,120 --> 08:46:39,600
And if you intend to use the script with
12783
08:46:37,520 --> 08:46:42,398
a chron scheduleuler, feel free to
12784
08:46:39,600 --> 08:46:44,798
remove this endless loop because that's
12785
08:46:42,398 --> 08:46:47,040
what a chronuler will do on its own.
12786
08:46:44,798 --> 08:46:48,878
Okay, so I think that's enough time. Let
12787
08:46:47,040 --> 08:46:52,558
me just
12788
08:46:48,878 --> 08:46:55,840
stop this. And as you can see, I have
12789
08:46:52,558 --> 08:46:57,760
already gotten the new messages here.
12790
08:46:55,840 --> 08:47:00,398
Again, as you can see, this does not
12791
08:46:57,760 --> 08:47:03,200
exist. This does not exist. The hosts
12792
08:47:00,398 --> 08:47:06,160
are down. So our ping has failed. And so
12793
08:47:03,200 --> 08:47:08,080
we've gotten these mails. Now what else
12794
08:47:06,160 --> 08:47:10,878
can we do with it? Let's try to
12795
08:47:08,080 --> 08:47:13,840
understand a script to create a network
12796
08:47:10,878 --> 08:47:17,200
backup sort of a file. So let's see what
12797
08:47:13,840 --> 08:47:19,520
that code looks like.
12798
08:47:17,200 --> 08:47:23,398
So for this code, I'll have to go back
12799
08:47:19,520 --> 08:47:23,398
to root.
12800
08:47:24,398 --> 08:47:30,558
Let's check if our file is here. And it
12801
08:47:27,920 --> 08:47:33,920
is. So let me show you the code for
12802
08:47:30,558 --> 08:47:37,440
creating a backup of a file in your
12803
08:47:33,920 --> 08:47:40,398
network to your local system.
12804
08:47:37,440 --> 08:47:43,958
All right. Now this is what your code
12805
08:47:40,398 --> 08:47:43,958
should look like.
12806
08:47:44,318 --> 08:47:48,478
So first of all, you're going to mount
12807
08:47:45,920 --> 08:47:51,120
the shared directory, which basically
12808
08:47:48,478 --> 08:47:54,160
means you're not creating a copy of the
12809
08:47:51,120 --> 08:47:56,638
directory. But if you make any changes
12810
08:47:54,160 --> 08:48:00,240
in your local file, it will be reflected
12811
08:47:56,638 --> 08:48:03,520
in your shared file and vice versa. So
12812
08:48:00,240 --> 08:48:06,558
CIFS is basically used for sharing your
12813
08:48:03,520 --> 08:48:09,760
window file. This is the path of your
12814
08:48:06,558 --> 08:48:11,520
shared file and this is the path to the
12815
08:48:09,760 --> 08:48:15,360
local directory where you're going to
12816
08:48:11,520 --> 08:48:17,360
create your backup. We've had a username
12817
08:48:15,360 --> 08:48:21,280
edureka and we've set the password
12818
08:48:17,360 --> 08:48:23,760
edureka. That is what hyphen o does. So
12819
08:48:21,280 --> 08:48:26,318
again we've mentioned what are we going
12820
08:48:23,760 --> 08:48:28,000
to backup. This is the file that we're
12821
08:48:26,318 --> 08:48:30,160
going to back up and this is our
12822
08:48:28,000 --> 08:48:32,318
destination. Now basically we're going
12823
08:48:30,160 --> 08:48:35,120
to create a backup and save it in the
12824
08:48:32,318 --> 08:48:37,440
name of the day. So for example, today
12825
08:48:35,120 --> 08:48:39,840
is Thursday. So if I create this backup
12826
08:48:37,440 --> 08:48:42,718
today, then it's going to be saved in a
12827
08:48:39,840 --> 08:48:47,200
folder called Thursday. Our host name is
12828
08:48:42,718 --> 08:48:50,878
localhost and so our archive file is
12829
08:48:47,200 --> 08:48:53,200
going to be localhost hyphen the name of
12830
08:48:50,878 --> 08:48:56,558
the day which is Thursday.
12831
08:48:53,200 --> 08:49:00,638
TGZ is basically your tarball file
12832
08:48:56,558 --> 08:49:03,360
extension. And then we've put in a print
12833
08:49:00,638 --> 08:49:06,478
of the start status message which is
12834
08:49:03,360 --> 08:49:09,520
basically supposed to that we have
12835
08:49:06,478 --> 08:49:12,318
started creating the backup. What CZF
12836
08:49:09,520 --> 08:49:15,200
does here is it basically creates a zip
12837
08:49:12,318 --> 08:49:17,840
file because we're obviously going to
12838
08:49:15,200 --> 08:49:19,440
import files into the local system and
12839
08:49:17,840 --> 08:49:22,398
in the end it is going to show us a
12840
08:49:19,440 --> 08:49:25,840
message called backup finished. And
12841
08:49:22,398 --> 08:49:28,318
finally we are going to unmount our
12842
08:49:25,840 --> 08:49:30,718
shared directory. So first let me show
12843
08:49:28,318 --> 08:49:32,318
you I am trying to back up over here. So
12844
08:49:30,718 --> 08:49:34,798
now that we know what the code looks
12845
08:49:32,318 --> 08:49:37,840
like let's
12846
08:49:34,798 --> 08:49:40,638
give it a slash.
12847
08:49:37,840 --> 08:49:43,280
So as of now it's creating
12848
08:49:40,638 --> 08:49:47,160
a remember I had told you this is how
12849
08:49:43,280 --> 08:49:47,160
it's going to name it. Localhost
12850
08:49:47,360 --> 08:49:52,160
local host being our host name and
12851
08:49:49,840 --> 08:49:54,638
Thursday being today's day.
12852
08:49:52,160 --> 08:49:58,000
showing us that these are the folders
12853
08:49:54,638 --> 08:49:59,920
that are present in
12854
08:49:58,000 --> 08:50:03,760
our directory. So how are we going to
12855
08:49:59,920 --> 08:50:05,760
see it? Let's first head on home
12856
08:50:03,760 --> 08:50:09,000
change directory
12857
08:50:05,760 --> 08:50:09,000
to edurea.
12858
08:50:20,000 --> 08:50:25,280
So, let me clear the screen and let me
12859
08:50:22,718 --> 08:50:25,280
head
12860
08:50:56,478 --> 08:51:03,120
So here I'm home at Edurea
12861
08:51:00,718 --> 08:51:06,240
and this is the list of everything that
12862
08:51:03,120 --> 08:51:08,398
is there. So, as you can see, there is a
12863
08:51:06,240 --> 08:51:11,520
file called backup. And now we're going
12864
08:51:08,398 --> 08:51:14,318
to extract the files and see if the code
12865
08:51:11,520 --> 08:51:19,520
that we've run has actually worked or
12866
08:51:14,318 --> 08:51:22,798
not. So, let me go to that file.
12867
08:51:19,520 --> 08:51:27,440
And so now I'm going to unzip the file
12868
08:51:22,798 --> 08:51:30,160
and see if actually
12869
08:51:27,440 --> 08:51:32,398
now let's go in here and check if we
12870
08:51:30,160 --> 08:51:37,240
actually have our files in or not. Let's
12871
08:51:32,398 --> 08:51:37,240
go and unzip this file.
12872
08:52:04,478 --> 08:52:10,240
And here are all the files that are
12873
08:52:07,280 --> 08:52:14,478
present in that particular we have a
12874
08:52:10,240 --> 08:52:17,600
bunch of PNG images as you can see. Now
12875
08:52:14,478 --> 08:52:21,600
if the same thing I had to show you in
12876
08:52:17,600 --> 08:52:26,360
GUI so I'll go to home and this is my
12877
08:52:21,600 --> 08:52:26,360
backup file. This is
12878
08:52:34,240 --> 08:52:40,280
these are the PNG images that have been
12879
08:52:36,080 --> 08:52:40,280
imported into this folder.
12880
08:52:45,680 --> 08:52:51,280
Move on versus Windows. This might be
12881
08:52:48,718 --> 08:52:53,680
the reason most of you are still hooked
12882
08:52:51,280 --> 08:52:56,878
on to this session. So let's start up
12883
08:52:53,680 --> 08:52:59,760
with users. Now there are three Linux
12884
08:52:56,878 --> 08:53:02,080
you have regular, administrative and
12885
08:52:59,760 --> 08:53:04,478
service. Now a regular user account is
12886
08:53:02,080 --> 08:53:06,878
created for you when you install Ubuntu
12887
08:53:04,478 --> 08:53:11,120
on the system. All your files folders
12888
08:53:06,878 --> 08:53:13,200
are stored in SL home directory and as a
12889
08:53:11,120 --> 08:53:16,160
regular user you do not have access to
12890
08:53:13,200 --> 08:53:18,718
directories of other users. Next you
12891
08:53:16,160 --> 08:53:21,120
have the root user or the administrative
12892
08:53:18,718 --> 08:53:23,840
user other than your regular account.
12893
08:53:21,120 --> 08:53:25,200
Another user account is called root and
12894
08:53:23,840 --> 08:53:27,360
it is created at the time of
12895
08:53:25,200 --> 08:53:29,600
installation. The root account is a
12896
08:53:27,360 --> 08:53:31,680
super user account who can access
12897
08:53:29,600 --> 08:53:34,398
restricted file software and have
12898
08:53:31,680 --> 08:53:37,200
administrative privileges. Hence the
12899
08:53:34,398 --> 08:53:39,040
name administrative user. Whenever you
12900
08:53:37,200 --> 08:53:41,200
want to install software, make changes
12901
08:53:39,040 --> 08:53:43,440
to the system files or perform any
12902
08:53:41,200 --> 08:53:46,878
administrative tasks, you need to log in
12903
08:53:43,440 --> 08:53:49,120
as a root user. Otherwise for general
12904
08:53:46,878 --> 08:53:51,200
dicing and browsing the internet, you
12905
08:53:49,120 --> 08:53:53,120
can use your regular account. And the
12906
08:53:51,200 --> 08:53:57,280
third and final account is the service
12907
08:53:53,120 --> 08:53:59,600
user. Linux is a server operating system
12908
08:53:57,280 --> 08:54:02,318
and services such as Apache, Squid,
12909
08:53:59,600 --> 08:54:04,398
email etc
12910
08:54:02,318 --> 08:54:06,318
have service accounts having a service
12911
08:54:04,398 --> 08:54:09,760
account
12912
08:54:06,318 --> 08:54:13,840
of your computer. Now Linux can allow or
12913
08:54:09,760 --> 08:54:16,080
deny access to depending on the service.
12914
08:54:13,840 --> 08:54:17,680
Now in Windows there are four types of
12915
08:54:16,080 --> 08:54:19,600
user accounts. You have your
12916
08:54:17,680 --> 08:54:22,638
administrative,
12917
08:54:19,600 --> 08:54:25,440
child, and guest account.
12918
08:54:22,638 --> 08:54:27,840
Let's go ahead and look at usage. Now,
12919
08:54:25,440 --> 08:54:31,120
according to the market research data of
12920
08:54:27,840 --> 08:54:34,160
the September of 2007, 92% of the
12921
08:54:31,120 --> 08:54:38,878
world's PCs had Windows running while
12922
08:54:34,160 --> 08:54:41,360
only about a percent of PC users use
12923
08:54:38,878 --> 08:54:43,760
users. Multimedia enthusiasts mainly
12924
08:54:41,360 --> 08:54:46,318
used Windows whereas for serious use
12925
08:54:43,760 --> 08:54:48,558
server application corporation servers
12926
08:54:46,318 --> 08:54:52,240
were running on Linux irrespective of
12927
08:54:48,558 --> 08:54:54,958
the GUI. Many users found it use Linux
12928
08:54:52,240 --> 08:54:57,200
as compared to Windows obviously due to
12929
08:54:54,958 --> 08:54:59,200
the command line interface and so the
12930
08:54:57,200 --> 08:55:01,440
appeal of Linux was very limited to
12931
08:54:59,200 --> 08:55:03,920
common people. Also for licensing
12932
08:55:01,440 --> 08:55:06,160
agreement with Microsoft, various PC
12933
08:55:03,920 --> 08:55:08,878
vendors are entitled to bundle Windows
12934
08:55:06,160 --> 08:55:10,718
OS with their PC. And for this, Windows
12935
08:55:08,878 --> 08:55:13,360
gained the initial market popularity
12936
08:55:10,718 --> 08:55:15,840
over Linux. Though these days, many PC
12937
08:55:13,360 --> 08:55:19,040
vendors such as Dell and HP started to
12938
08:55:15,840 --> 08:55:21,280
give Linux as a pre-installed OS to cut
12939
08:55:19,040 --> 08:55:24,000
the cost of their PC system. According
12940
08:55:21,280 --> 08:55:26,398
to the latest IDC report, Windows server
12941
08:55:24,000 --> 08:55:29,040
market is gaining popularity over
12942
08:55:26,398 --> 08:55:32,000
Linuxbased server. The annual rate at
12943
08:55:29,040 --> 08:55:35,920
which Linux is growing in the x86 server
12944
08:55:32,000 --> 08:55:38,798
space has fallen from around 53% to 45%
12945
08:55:35,920 --> 08:55:40,638
globally. The main reason is that while
12946
08:55:38,798 --> 08:55:42,958
Linux servers are looking for high
12947
08:55:40,638 --> 08:55:45,840
performance computing and web serving,
12948
08:55:42,958 --> 08:55:48,958
Windows is apparently adopted on a much
12949
08:55:45,840 --> 08:55:51,120
broader basis. Next, let's move ahead
12950
08:55:48,958 --> 08:55:53,840
and look at what the kernels are like.
12951
08:55:51,120 --> 08:55:56,240
Now, Linux uses a monolithic kernel
12952
08:55:53,840 --> 08:55:59,200
which consumes more running space
12953
08:55:56,240 --> 08:56:01,440
whereas Windows uses the micro kernel as
12954
08:55:59,200 --> 08:56:04,080
of the latest versions which take less
12955
08:56:01,440 --> 08:56:07,040
space with the system running efficiency
12956
08:56:04,080 --> 08:56:09,840
is lower than Linux. Next, let's look at
12957
08:56:07,040 --> 08:56:11,840
file systems. In the Microsoft Windows,
12958
08:56:09,840 --> 08:56:15,200
files are stored in folders on different
12959
08:56:11,840 --> 08:56:17,280
data drives like CDE. But in Linux,
12960
08:56:15,200 --> 08:56:18,798
files are ordered in a treel like
12961
08:56:17,280 --> 08:56:21,200
structure starting with a root
12962
08:56:18,798 --> 08:56:23,120
directory. Now this root directory can
12963
08:56:21,200 --> 08:56:25,440
be considered as the start of a file
12964
08:56:23,120 --> 08:56:28,080
system and it further branches out
12965
08:56:25,440 --> 08:56:30,478
various subdirectories. Now the root is
12966
08:56:28,080 --> 08:56:32,718
denoted with a forward slash and a
12967
08:56:30,478 --> 08:56:34,318
general treel like system on your Unix
12968
08:56:32,718 --> 08:56:36,558
may look like something like this on
12969
08:56:34,318 --> 08:56:38,478
your screen. In Linux and Unix
12970
08:56:36,558 --> 08:56:40,958
everything is a file. Directories are
12971
08:56:38,478 --> 08:56:44,318
files, files are files and devices like
12972
08:56:40,958 --> 08:56:46,958
printer, mouse, keyboards are also files
12973
08:56:44,318 --> 08:56:50,000
which is not the case in your Microsoft
12974
08:56:46,958 --> 08:56:53,360
Windows. At number five, we have
12975
08:56:50,000 --> 08:56:56,000
security. Every Windows user has faced
12976
08:56:53,360 --> 08:56:58,958
security and stability issues. Since
12977
08:56:56,000 --> 08:57:01,600
Windows is the most widely consumed OS,
12978
08:56:58,958 --> 08:57:04,318
hackers, spammers, all target Windows
12979
08:57:01,600 --> 08:57:06,398
very frequently. Consumer versions of
12980
08:57:04,318 --> 08:57:09,120
Windows were originally designed for
12981
08:57:06,398 --> 08:57:11,120
ease of use of a single user PC without
12982
08:57:09,120 --> 08:57:13,120
a network connection and did not have
12983
08:57:11,120 --> 08:57:15,200
the security features built in. Now,
12984
08:57:13,120 --> 08:57:17,040
Microsoft releases security patches
12985
08:57:15,200 --> 08:57:19,280
through its Windows update service
12986
08:57:17,040 --> 08:57:21,280
approximately once a month. Although
12987
08:57:19,280 --> 08:57:24,080
critical updates are made available at
12988
08:57:21,280 --> 08:57:27,120
shorter intervals when necessary. Many a
12989
08:57:24,080 --> 08:57:29,760
times users of Windows OS face the blue
12990
08:57:27,120 --> 08:57:33,200
screen of death caused by the failure of
12991
08:57:29,760 --> 08:57:36,000
the system to respond and eventually the
12992
08:57:33,200 --> 08:57:38,798
user has to manually restart the PC.
12993
08:57:36,000 --> 08:57:41,680
This is super frustrating and it also
12994
08:57:38,798 --> 08:57:44,398
may cause you to lose valuable data. On
12995
08:57:41,680 --> 08:57:48,000
the other hand, Linux is a very stable
12996
08:57:44,398 --> 08:57:50,318
OS and is more secure than Windows. As
12997
08:57:48,000 --> 08:57:52,160
Linux is communitydriven, developed
12998
08:57:50,318 --> 08:57:54,718
through people collaboration and
12999
08:57:52,160 --> 08:57:56,958
monitored constantly by the developers
13000
08:57:54,718 --> 08:57:59,360
from every corner of the world. Any new
13001
08:57:56,958 --> 08:58:02,160
problem raised can be solved within just
13002
08:57:59,360 --> 08:58:04,798
a few hours and the necessary patch will
13003
08:58:02,160 --> 08:58:07,120
be ready at the same time. Also, Linux
13004
08:58:04,798 --> 08:58:10,318
is based on Unix architecture which is a
13005
08:58:07,120 --> 08:58:12,718
multi-user OS. So, it is much more
13006
08:58:10,318 --> 08:58:15,040
stable than a single user OS such as
13007
08:58:12,718 --> 08:58:18,080
Windows. Next, let's look at
13008
08:58:15,040 --> 08:58:20,958
compatibility of the two. Here, Windows
13009
08:58:18,080 --> 08:58:23,280
shoots and scores. Here is where the
13010
08:58:20,958 --> 08:58:26,240
Redmond offering wipes the floor with
13011
08:58:23,280 --> 08:58:28,558
Linux. Despite recent improvements in
13012
08:58:26,240 --> 08:58:32,558
software being ported or developed to
13013
08:58:28,558 --> 08:58:34,718
Linux, Windows is still the king. Users
13014
08:58:32,558 --> 08:58:37,280
of Windows can be certain that most
13015
08:58:34,718 --> 08:58:40,000
softwares will work and even obscure
13016
08:58:37,280 --> 08:58:43,200
outdated software will continue to work
13017
08:58:40,000 --> 08:58:45,440
even when it is abandoned by developers.
13018
08:58:43,200 --> 08:58:47,920
Windows has good legacy support plain
13019
08:58:45,440 --> 08:58:49,840
and simple. I know of commercial
13020
08:58:47,920 --> 08:58:52,398
software that still relies on
13021
08:58:49,840 --> 08:58:55,520
technologies like Silverite, ActiveX and
13022
08:58:52,398 --> 08:58:57,520
Internet Explorer 11. Linux on the other
13023
08:58:55,520 --> 08:59:00,240
hand can struggle with the basics that
13024
08:58:57,520 --> 08:59:02,558
Windows users take for granted. Adobe
13025
08:59:00,240 --> 08:59:05,280
Flash Player is something else that is
13026
08:59:02,558 --> 08:59:07,280
missing on Linux for a really long time.
13027
08:59:05,280 --> 08:59:09,920
And even when it did appear with
13028
08:59:07,280 --> 08:59:12,160
repositories, it was not as actively
13029
08:59:09,920 --> 08:59:14,718
developed as Windows versions. With
13030
08:59:12,160 --> 08:59:18,000
regard to file systems, Linux can also
13031
08:59:14,718 --> 08:59:21,760
read and write to NTFS and FAT formatted
13032
08:59:18,000 --> 08:59:26,000
devices and USB sticks, whereas Windows
13033
08:59:21,760 --> 08:59:28,398
will have no idea what extension 4 is.
13034
08:59:26,000 --> 08:59:30,878
At number seven, we have ease of use.
13035
08:59:28,398 --> 08:59:33,120
Now, this is a tough one to call. Linux
13036
08:59:30,878 --> 08:59:35,680
over the recent years has made huge
13037
08:59:33,120 --> 08:59:37,840
leaps in usability. Distributions like
13038
08:59:35,680 --> 08:59:40,240
Linux Mint have made installation and
13039
08:59:37,840 --> 08:59:42,478
setup pretty simple. Even non-technical
13040
08:59:40,240 --> 08:59:44,958
users can install and use software and
13041
08:59:42,478 --> 08:59:46,878
do normal day-to-day activities like web
13042
08:59:44,958 --> 08:59:49,840
browsing, answering emails, playing
13043
08:59:46,878 --> 08:59:52,240
music, and watching videos. Windows, due
13044
08:59:49,840 --> 08:59:54,798
to high market proliferation, is the
13045
08:59:52,240 --> 08:59:57,120
default OS of many devices. Now, think
13046
08:59:54,798 --> 09:00:00,160
of it. People like you and me, we grew
13047
08:59:57,120 --> 09:00:02,318
up on Windows, right? Buy a new laptop
13048
09:00:00,160 --> 09:00:04,718
or a PC, there is a very high chance
13049
09:00:02,318 --> 09:00:07,120
that it comes with Windows installed.
13050
09:00:04,718 --> 09:00:09,360
Users are used to clicking the toolbar,
13051
09:00:07,120 --> 09:00:11,920
opening their favorite programs, which
13052
09:00:09,360 --> 09:00:15,040
makes it good for power and non-power
13053
09:00:11,920 --> 09:00:18,080
users. Next, we have privacy. Linux
13054
09:00:15,040 --> 09:00:21,120
users have a private operating system
13055
09:00:18,080 --> 09:00:23,200
that does not spy on them and does not
13056
09:00:21,120 --> 09:00:26,478
phone home with any degree of
13057
09:00:23,200 --> 09:00:28,638
seriousness. period. Choosing Linux
13058
09:00:26,478 --> 09:00:31,840
means the system is yours and yours
13059
09:00:28,638 --> 09:00:34,000
alone. Add to the mix that most Linux
13060
09:00:31,840 --> 09:00:36,958
systems come with an option of a
13061
09:00:34,000 --> 09:00:40,080
built-in militarygrade encryption and
13062
09:00:36,958 --> 09:00:43,520
users can be sure that the device theft
13063
09:00:40,080 --> 09:00:45,840
poses no real problem to their own data.
13064
09:00:43,520 --> 09:00:48,240
As a contrast, increasingly over the
13065
09:00:45,840 --> 09:00:50,798
last few years, Windows has gotten more
13066
09:00:48,240 --> 09:00:53,440
advertriers
13067
09:00:50,798 --> 09:00:56,080
given the choice to opt out and there
13068
09:00:53,440 --> 09:00:58,558
are some clever registry hacks that can
13069
09:00:56,080 --> 09:01:01,520
help. But advertising is now a part of
13070
09:00:58,558 --> 09:01:04,160
Redbin's plan. Windows can also watch
13071
09:01:01,520 --> 09:01:07,280
what users do, offering syncing to
13072
09:01:04,160 --> 09:01:09,760
Microsoft One Drive service or to learn
13073
09:01:07,280 --> 09:01:12,718
behavior to make Cortana the Microsoft
13074
09:01:09,760 --> 09:01:14,798
personal assistant better. Personally, I
13075
09:01:12,718 --> 09:01:17,840
do not favor these kind of intrusive
13076
09:01:14,798 --> 09:01:20,160
tools, but some users do like these
13077
09:01:17,840 --> 09:01:22,558
features. Like who wouldn't want a
13078
09:01:20,160 --> 09:01:24,398
personal assistant in your laptop? You
13079
09:01:22,558 --> 09:01:26,878
already have your Google Assistant and
13080
09:01:24,398 --> 09:01:29,040
your series, right? Next, you have
13081
09:01:26,878 --> 09:01:32,000
source code. Now, this all of you might
13082
09:01:29,040 --> 09:01:34,798
know Linux is open-source whereas
13083
09:01:32,000 --> 09:01:37,120
Windows is commercial. So, users have
13084
09:01:34,798 --> 09:01:40,240
access to the source code of Linux and
13085
09:01:37,120 --> 09:01:42,958
can alter the code as per user need.
13086
09:01:40,240 --> 09:01:45,520
Whereas Windows users do not have any
13087
09:01:42,958 --> 09:01:47,840
access to their source code. Now this
13088
09:01:45,520 --> 09:01:50,878
has its own advantages in Linux like
13089
09:01:47,840 --> 09:01:53,360
bugs in OS will fix at a rapid pace and
13090
09:01:50,878 --> 09:01:55,680
disadvantages like developers may take
13091
09:01:53,360 --> 09:01:58,558
advantage of any weakness in the OS if
13092
09:01:55,680 --> 09:02:00,160
they are found. In Windows every user
13093
09:01:58,558 --> 09:02:03,280
would not have access to the source
13094
09:02:00,160 --> 09:02:06,160
code. Only members of a selected and
13095
09:02:03,280 --> 09:02:08,398
qualified group will have access to it.
13096
09:02:06,160 --> 09:02:10,798
Next you have license.
13097
09:02:08,398 --> 09:02:13,200
Now the Linux kernel and the GNU
13098
09:02:10,798 --> 09:02:15,760
utilities and libraries which accompany
13099
09:02:13,200 --> 09:02:18,000
it in most distributions are entirely
13100
09:02:15,760 --> 09:02:21,200
free and open- source. You can download
13101
09:02:18,000 --> 09:02:23,760
and install GNU Linux without any
13102
09:02:21,200 --> 09:02:26,478
purchase. Some companies offer paid
13103
09:02:23,760 --> 09:02:28,798
support for their Linux distributions,
13104
09:02:26,478 --> 09:02:31,520
but the underlying software is still
13105
09:02:28,798 --> 09:02:34,478
free to download and install. A funny
13106
09:02:31,520 --> 09:02:37,200
folklore here is that Lionus Orvilles
13107
09:02:34,478 --> 09:02:39,600
actually was an introvert and did not
13108
09:02:37,200 --> 09:02:41,680
want companies to communicate with him
13109
09:02:39,600 --> 09:02:44,240
through email. He did not want to be
13110
09:02:41,680 --> 09:02:46,798
spammed by all these big companies
13111
09:02:44,240 --> 09:02:49,120
running the industry to buy the source
13112
09:02:46,798 --> 09:02:51,360
code to his kernel. So basically what he
13113
09:02:49,120 --> 09:02:54,638
did was he made it open source for
13114
09:02:51,360 --> 09:02:56,318
everybody to access. Funny, isn't it?
13115
09:02:54,638 --> 09:02:59,120
Now, on the other hand, you have
13116
09:02:56,318 --> 09:03:02,318
Microsoft Windows, which usually costs
13117
09:02:59,120 --> 09:03:05,040
between $99 to $199
13118
09:03:02,318 --> 09:03:07,520
for each licensed copy. Now, Windows 10
13119
09:03:05,040 --> 09:03:09,920
was originally being offered as a free
13120
09:03:07,520 --> 09:03:13,440
upgrade to current owners of Windows 7
13121
09:03:09,920 --> 09:03:16,478
or 8.1. If they upgraded before the 29th
13122
09:03:13,440 --> 09:03:18,638
of July, 2016, but that offer is no
13123
09:03:16,478 --> 09:03:21,440
longer available. Then you have
13124
09:03:18,638 --> 09:03:23,840
reliability. Now, Windows as we know it
13125
09:03:21,440 --> 09:03:26,318
becomes sluggish day after day. You will
13126
09:03:23,840 --> 09:03:29,040
want to reinstall Windows after a while
13127
09:03:26,318 --> 09:03:31,440
when you encounter crashes or slowdowns
13128
09:03:29,040 --> 09:03:32,798
on your system. If you're using Linux,
13129
09:03:31,440 --> 09:03:34,958
you will not have to worry about
13130
09:03:32,798 --> 09:03:37,360
reinstalling it just to experience a
13131
09:03:34,958 --> 09:03:39,520
faster, smoother system. Linux helps
13132
09:03:37,360 --> 09:03:41,920
your system run smooth for a longer
13133
09:03:39,520 --> 09:03:44,398
period of time. In fact, much much
13134
09:03:41,920 --> 09:03:46,240
longer in my experience. Also, with
13135
09:03:44,398 --> 09:03:48,318
Windows, you will have to adapt to a
13136
09:03:46,240 --> 09:03:51,120
habit where you keep on rebooting the
13137
09:03:48,318 --> 09:03:53,680
system for just about everything. If you
13138
09:03:51,120 --> 09:03:56,160
just installed software, reboot. If you
13139
09:03:53,680 --> 09:03:58,478
recently uninstalled software, reboot.
13140
09:03:56,160 --> 09:04:00,958
If you just installed a Windows update,
13141
09:03:58,478 --> 09:04:04,000
reboot. And if the system seems to slow
13142
09:04:00,958 --> 09:04:06,240
down, you guessed it, reboot. However,
13143
09:04:04,000 --> 09:04:08,318
in the case of Linux, you will not have
13144
09:04:06,240 --> 09:04:10,478
to reboot for the situations previously
13145
09:04:08,318 --> 09:04:12,638
mentioned. You can comfortably continue
13146
09:04:10,478 --> 09:04:14,878
with your work and Linux will not will
13147
09:04:12,638 --> 09:04:18,000
bother you. Another fact that proves
13148
09:04:14,878 --> 09:04:20,240
Linux to be a reliable source are the
13149
09:04:18,000 --> 09:04:22,160
web servers. You could observe that most
13150
09:04:20,240 --> 09:04:24,558
of the internet giants like Google and
13151
09:04:22,160 --> 09:04:27,120
Facebook run on Linux. Even most of all
13152
09:04:24,558 --> 09:04:29,520
the supercomputers run on Linux. So why
13153
09:04:27,120 --> 09:04:32,160
isn't Windows preferred over Linux? It
13154
09:04:29,520 --> 09:04:35,680
is because Linux is far more reliable
13155
09:04:32,160 --> 09:04:38,638
than Windows. Period. No arguments.
13156
09:04:35,680 --> 09:04:40,798
Finally, we have support. Now, Windows
13157
09:04:38,638 --> 09:04:43,440
has a support which is easily accessible
13158
09:04:40,798 --> 09:04:46,558
online forums or websites and it has
13159
09:04:43,440 --> 09:04:49,280
paid support as well. In a Linux system,
13160
09:04:46,558 --> 09:04:51,200
you need not hire an expert to solve a
13161
09:04:49,280 --> 09:04:53,200
problem. You just need to search for a
13162
09:04:51,200 --> 09:04:55,360
familiar thread on the web for a
13163
09:04:53,200 --> 09:04:57,280
solution or post a thread to let others
13164
09:04:55,360 --> 09:04:59,920
know of the problem. Within minutes of
13165
09:04:57,280 --> 09:05:02,398
posting the thread on any Linux forum,
13166
09:04:59,920 --> 09:05:05,200
you may expect a reply along with a
13167
09:05:02,398 --> 09:05:08,240
detailed solution which would finally
13168
09:05:05,200 --> 09:05:10,478
help resolve your problem at no cost.
13169
09:05:08,240 --> 09:05:13,360
It's like Linux has its own Stack
13170
09:05:10,478 --> 09:05:15,600
Overflow community, doesn't it? Now
13171
09:05:13,360 --> 09:05:18,000
there are a lot of active Linux users
13172
09:05:15,600 --> 09:05:20,638
who are always ready to respond to a
13173
09:05:18,000 --> 09:05:22,958
relevant thread that might have created.
13174
09:05:20,638 --> 09:05:24,958
The number of community users active on
13175
09:05:22,958 --> 09:05:27,200
such forums is more than the number of
13176
09:05:24,958 --> 09:05:30,160
active members on any Windows focused
13177
09:05:27,200 --> 09:05:32,878
forum any day. However, the community
13178
09:05:30,160 --> 09:05:35,840
response might be depending on the Linux
13179
09:05:32,878 --> 09:05:39,040
distribution being used. With that, I
13180
09:05:35,840 --> 09:05:42,478
come to the end of my Linux versus
13181
09:05:39,040 --> 09:05:45,040
Windows segment. The last category is
13182
09:05:42,478 --> 09:05:46,718
distributions. Now before we begin, I
13183
09:05:45,040 --> 09:05:49,760
need to address one of the more
13184
09:05:46,718 --> 09:05:52,080
confusing aspects to the Linux platform.
13185
09:05:49,760 --> 09:05:54,478
While Windows has maintained a fairly
13186
09:05:52,080 --> 09:05:57,120
standard version structure with updates
13187
09:05:54,478 --> 09:06:00,160
and versions split into tiers, Linux is
13188
09:05:57,120 --> 09:06:02,798
far more complex. Originally designed by
13189
09:06:00,160 --> 09:06:05,920
the Finnish student line, the Linux
13190
09:06:02,798 --> 09:06:08,480
kernel today underpins all Linux OSS.
13191
09:06:05,920 --> 09:06:10,640
However, as it remains open- source, the
13192
09:06:08,480 --> 09:06:13,040
system can be tweaked and modified by
13193
09:06:10,640 --> 09:06:16,000
anyone for their own purposes. What we
13194
09:06:13,040 --> 09:06:18,320
have as a result are hundreds of bespoke
13195
09:06:16,000 --> 09:06:21,040
Linux- based operating systems known as
13196
09:06:18,320 --> 09:06:23,520
distributions or dros. This makes it
13197
09:06:21,040 --> 09:06:26,000
incredibly difficult to choose between
13198
09:06:23,520 --> 09:06:28,320
them. Far more complicated than simply
13199
09:06:26,000 --> 09:06:30,480
picking Windows 7, Windows 8 or Windows
13200
09:06:28,320 --> 09:06:33,278
10. Given the nature of open-source
13201
09:06:30,480 --> 09:06:36,000
software, these distros can vary widely
13202
09:06:33,278 --> 09:06:38,640
in functionality and sophistication and
13203
09:06:36,000 --> 09:06:40,878
many are constantly evolving. The choice
13204
09:06:38,640 --> 09:06:42,558
can seem overwhelming and particularly
13205
09:06:40,878 --> 09:06:44,878
the differences between them aren't
13206
09:06:42,558 --> 09:06:47,200
always immediately obvious. On the other
13207
09:06:44,878 --> 09:06:49,758
hand, this also has its own benefits.
13208
09:06:47,200 --> 09:06:52,160
The variety of different Linux distros
13209
09:06:49,758 --> 09:06:54,160
is so great that you can all find
13210
09:06:52,160 --> 09:06:56,878
something that suits your particular
13211
09:06:54,160 --> 09:07:00,718
taste. Do you prefer a Mac OS style
13212
09:06:56,878 --> 09:07:03,278
interface? you're in luck. Elementary OS
13213
09:07:00,718 --> 09:07:05,598
is a Linux distro built to mirror the
13214
09:07:03,278 --> 09:07:07,918
look and feel of an Apple interface.
13215
09:07:05,598 --> 09:07:10,558
Similarly, if you yearn for the days of
13216
09:07:07,918 --> 09:07:14,320
Windows XP, you can bring that back with
13217
09:07:10,558 --> 09:07:16,640
a Q4 OS, which darkens back to the
13218
09:07:14,320 --> 09:07:19,438
Microsoft's fan favorite. Now, there are
13219
09:07:16,640 --> 09:07:21,520
more specialized Linux flavors such as
13220
09:07:19,438 --> 09:07:24,000
distros designed to give ancient
13221
09:07:21,520 --> 09:07:26,480
lowowered computers a new lease of life
13222
09:07:24,000 --> 09:07:29,680
or super secure distros that can be
13223
09:07:26,480 --> 09:07:33,122
booted from a USB drive to keep you safe
13224
09:07:29,680 --> 09:07:35,840
when using an unfamiliar PC. Naturally,
13225
09:07:33,122 --> 09:07:38,558
there are also numerous Linux versions
13226
09:07:35,840 --> 09:07:41,122
for running servers and enterprisegrade
13227
09:07:38,558 --> 09:07:43,758
applications. For those who are new to
13228
09:07:41,122 --> 09:07:45,680
Linux, I'd like to recommend Ubuntu as a
13229
09:07:43,758 --> 09:07:48,238
great starting point. It is very
13230
09:07:45,680 --> 09:07:49,840
userfriendly even compared to Windows
13231
09:07:48,238 --> 09:07:51,758
while still being versatile and
13232
09:07:49,840 --> 09:07:54,000
featurerich enough to satisfy
13233
09:07:51,758 --> 09:07:56,960
experienced techies. It is the closest
13234
09:07:54,000 --> 09:07:58,878
thing Linux has to a default DRO.
13235
09:07:56,960 --> 09:08:01,598
Although we would urge everyone to come
13236
09:07:58,878 --> 09:08:04,238
and explore various distribution options
13237
09:08:01,598 --> 09:08:06,078
available and find out what is your
13238
09:08:04,238 --> 09:08:08,878
favorite.
13239
09:08:06,078 --> 09:08:10,960
Next, let's look at which OS is most
13240
09:08:08,878 --> 09:08:13,122
suitable for you. Now, this one depends
13241
09:08:10,960 --> 09:08:15,360
on what you need to do. Both Linux and
13242
09:08:13,122 --> 09:08:17,360
Windows are rich in multimedia
13243
09:08:15,360 --> 09:08:19,360
applications. Though setting up sound
13244
09:08:17,360 --> 09:08:21,040
and video options in the older versions
13245
09:08:19,360 --> 09:08:23,680
of Linux can be difficult for some
13246
09:08:21,040 --> 09:08:25,680
users. The main advantage of Linux is
13247
09:08:23,680 --> 09:08:27,918
that most of the multimedia applications
13248
09:08:25,680 --> 09:08:30,480
are freely available. While in the case
13249
09:08:27,918 --> 09:08:32,320
of Windows, users might have to pay a
13250
09:08:30,480 --> 09:08:34,640
hefty amount to get the software.
13251
09:08:32,320 --> 09:08:37,122
Although many open-source free versions
13252
09:08:34,640 --> 09:08:40,160
are often available. Moreever, if
13253
09:08:37,122 --> 09:08:42,800
anybody buys a copy of Windows on a CD
13254
09:08:40,160 --> 09:08:45,680
ROM, they do not get any application
13255
09:08:42,800 --> 09:08:48,000
software with it other than the bundled
13256
09:08:45,680 --> 09:08:50,238
Microsoft software. But if the same
13257
09:08:48,000 --> 09:08:51,758
person buys a copy of a Linux, it
13258
09:08:50,238 --> 09:08:53,918
typically comes with a lot of free
13259
09:08:51,758 --> 09:08:56,320
application software such as Open
13260
09:08:53,918 --> 09:08:58,320
Office, a complete free office suite,
13261
09:08:56,320 --> 09:09:01,122
including spreadsheets, presentation, so
13262
09:08:58,320 --> 09:09:02,718
on and so forth. A new computer with
13263
09:09:01,122 --> 09:09:04,558
Windows pre-installed may have
13264
09:09:02,718 --> 09:09:06,800
additional application software, but
13265
09:09:04,558 --> 09:09:08,878
that is totally up to the PC vendor, but
13266
09:09:06,800 --> 09:09:11,200
each Linux DRO comes with multiple
13267
09:09:08,878 --> 09:09:13,438
flavors. The more expensive versions
13268
09:09:11,200 --> 09:09:15,520
come up with more application software.
13269
09:09:13,438 --> 09:09:17,758
If you're a gamer and need 100%
13270
09:09:15,520 --> 09:09:20,160
compatibility with a particular software
13271
09:09:17,758 --> 09:09:24,000
or want a user-friendly system, hands
13272
09:09:20,160 --> 09:09:26,320
down, Windows wins. Steam amongst other
13273
09:09:24,000 --> 09:09:29,438
clients and options provides a huge
13274
09:09:26,320 --> 09:09:32,160
number of games for both AAA publishers
13275
09:09:29,438 --> 09:09:34,558
and small indie developers. While Steam
13276
09:09:32,160 --> 09:09:37,438
for Linux now allows you to install
13277
09:09:34,558 --> 09:09:39,918
Windows games, it is still in beta phase
13278
09:09:37,438 --> 09:09:42,000
and not all Windows games will work. It
13279
09:09:39,918 --> 09:09:44,640
can be a little frustrating for Linux
13280
09:09:42,000 --> 09:09:46,878
users like myself and no doubt the
13281
09:09:44,640 --> 09:09:50,718
situation will change in the future. But
13282
09:09:46,878 --> 09:09:52,878
as of now in 2019, many Linux users miss
13283
09:09:50,718 --> 09:09:55,680
out on the top games with their choice
13284
09:09:52,878 --> 09:09:58,078
of OS. The graphics card vendors also
13285
09:09:55,680 --> 09:10:00,480
tend to support Windows platforms rather
13286
09:09:58,078 --> 09:10:02,878
than Linux. They provide timely updates
13287
09:10:00,480 --> 09:10:05,520
and new features that don't always
13288
09:10:02,878 --> 09:10:07,918
filter to other oss. If you're an
13289
09:10:05,520 --> 09:10:10,078
advocate of open-source software or if
13290
09:10:07,918 --> 09:10:12,800
your device simply is too old or lower
13291
09:10:10,078 --> 09:10:15,278
spec to run Windows or just plain tired
13292
09:10:12,800 --> 09:10:18,160
of all the forced updates and reboots in
13293
09:10:15,278 --> 09:10:20,078
Windows, then Linux is a great option.
13294
09:10:18,160 --> 09:10:23,360
Linux supports almost all major
13295
09:10:20,078 --> 09:10:27,040
programming languages, Python, C, C++,
13296
09:10:23,360 --> 09:10:28,960
Java, Pearl, Ruby, etc. It offers a vast
13297
09:10:27,040 --> 09:10:31,200
range of applications useful for
13298
09:10:28,960 --> 09:10:33,680
programming purposes too. Now the Linux
13299
09:10:31,200 --> 09:10:35,918
terminal is superior to use over Windows
13300
09:10:33,680 --> 09:10:38,160
command line for developers. You would
13301
09:10:35,918 --> 09:10:41,278
find many libraries developed natively
13302
09:10:38,160 --> 09:10:43,200
for Linux. Also a lot of programmers
13303
09:10:41,278 --> 09:10:46,398
point out that the package manager on
13304
09:10:43,200 --> 09:10:49,122
Linux helps them get things done easily.
13305
09:10:46,398 --> 09:10:51,598
Interestingly the ability of bash
13306
09:10:49,122 --> 09:10:54,800
scripting is one of the most compelling
13307
09:10:51,598 --> 09:10:57,360
reasons why programmers prefer Linux OS.
13308
09:10:54,800 --> 09:10:59,840
Linux also brings in native support for
13309
09:10:57,360 --> 09:11:02,160
secure shell which would help you manage
13310
09:10:59,840 --> 09:11:04,558
your servers quickly. You could include
13311
09:11:02,160 --> 09:11:06,558
things like apt get commands which
13312
09:11:04,558 --> 09:11:10,758
further makes Linux one of the most
13313
09:11:06,558 --> 09:11:10,758
popular choices for programmers.
13314
09:11:15,278 --> 09:11:20,160
Let's move on to the differences between
13315
09:11:17,360 --> 09:11:23,520
both of these oss. So let's look at our
13316
09:11:20,160 --> 09:11:26,398
first basis of difference the use. Now
13317
09:11:23,520 --> 09:11:29,918
Unix is mostly used in internet servers,
13318
09:11:26,398 --> 09:11:32,480
workstations and PCs. While Linux is
13319
09:11:29,918 --> 09:11:34,878
used by everyone from home users to
13320
09:11:32,480 --> 09:11:37,758
developers and computer enthusiasts
13321
09:11:34,878 --> 09:11:40,480
alike because Linux OS can be installed
13322
09:11:37,758 --> 09:11:43,278
on various types of devices like mobile
13323
09:11:40,480 --> 09:11:46,078
phones, tablets and computers.
13324
09:11:43,278 --> 09:11:47,758
Development and distribution. Now Unix
13325
09:11:46,078 --> 09:11:50,078
systems have different versions and
13326
09:11:47,758 --> 09:11:52,640
these versions are primarily developed
13327
09:11:50,078 --> 09:11:56,078
by the AT&T as well as other commercial
13328
09:11:52,640 --> 09:11:58,078
vendors while Linux as most of us know
13329
09:11:56,078 --> 09:12:00,238
is open-source and thousands of
13330
09:11:58,078 --> 09:12:02,640
programmers collaborate online and
13331
09:12:00,238 --> 09:12:05,438
contribute to its development. It
13332
09:12:02,640 --> 09:12:08,238
features through forums etc and is
13333
09:12:05,438 --> 09:12:10,960
distributed by various vendors. Now
13334
09:12:08,238 --> 09:12:14,558
talking about the architecture, Unix is
13335
09:12:10,960 --> 09:12:18,160
available on PA Risk and Itanium
13336
09:12:14,558 --> 09:12:22,718
machines. Solaris is also available for
13337
09:12:18,160 --> 09:12:26,000
x86 or x64 based systems. Now Linux
13338
09:12:22,718 --> 09:12:28,878
originally was developed for Intel's 86
13339
09:12:26,000 --> 09:12:32,078
hardware. So the ports available are for
13340
09:12:28,878 --> 09:12:33,758
over two dozen CPU types including the
13341
09:12:32,078 --> 09:12:35,438
ERM.
13342
09:12:33,758 --> 09:12:38,320
Now let's talk a little bit about the
13343
09:12:35,438 --> 09:12:41,680
processors of the two. Now, Unix
13344
09:12:38,320 --> 09:12:45,640
supports your x86, x64,
13345
09:12:41,680 --> 09:12:45,640
spark, power attit
13346
09:12:47,680 --> 09:12:52,640
whereas the Linux has a wider variety of
13347
09:12:50,640 --> 09:12:54,480
processors that it supports which
13348
09:12:52,640 --> 09:12:58,238
include dozens of different kinds of
13349
09:12:54,480 --> 09:13:02,160
processors. File system support or the
13350
09:12:58,238 --> 09:13:07,278
supported file type. Now Unix supports
13351
09:13:02,160 --> 09:13:10,558
ZFS, HFX, GPS, XFS and VXFS systems.
13352
09:13:07,278 --> 09:13:14,878
Whereas the Linux is supported by file
13353
09:13:10,558 --> 09:13:19,278
types XFS, NFS, CRAM, FSM from 1 to 4,
13354
09:13:14,878 --> 09:13:22,640
UFS, DEF, PTS and NTFS which again is a
13355
09:13:19,278 --> 09:13:24,320
wider variety of file types. Next, let's
13356
09:13:22,640 --> 09:13:26,238
talk a little bit about something both
13357
09:13:24,320 --> 09:13:29,520
of these are very known for that is
13358
09:13:26,238 --> 09:13:32,000
their shell interface. Now the Unix was
13359
09:13:29,520 --> 09:13:34,078
originally made to work in bond shell or
13360
09:13:32,000 --> 09:13:36,480
the basic shell that we all know of.
13361
09:13:34,078 --> 09:13:39,520
However, it is now compatible with many
13362
09:13:36,480 --> 09:13:42,238
others softwares whereas in Linux bash
13363
09:13:39,520 --> 09:13:44,640
is the default shell. It offers supports
13364
09:13:42,238 --> 09:13:46,078
for multiple command interpreters. Now
13365
09:13:44,640 --> 09:13:49,200
that we've spoken about the shell
13366
09:13:46,078 --> 09:13:51,200
interface, the next logical question is
13367
09:13:49,200 --> 09:13:53,918
obviously about the graphical user
13368
09:13:51,200 --> 09:13:56,878
interface. Now the Unix has a common
13369
09:13:53,918 --> 09:13:59,598
desktop environment and also has genome
13370
09:13:56,878 --> 09:14:02,160
whereas Linux provides two GUIs which
13371
09:13:59,598 --> 09:14:06,000
are the KDE and genome though there are
13372
09:14:02,160 --> 09:14:08,078
many alternatives such as mate XFCS etc
13373
09:14:06,000 --> 09:14:10,718
which are just a few of the millions of
13374
09:14:08,078 --> 09:14:12,480
alternatives that it has next let's talk
13375
09:14:10,718 --> 09:14:15,840
a little bit about the portability of
13376
09:14:12,480 --> 09:14:18,960
each of these now Unix is not portable
13377
09:14:15,840 --> 09:14:22,480
period that's it but Linux is portable
13378
09:14:18,960 --> 09:14:26,480
and is booted from a USB stick which is
13379
09:14:22,480 --> 09:14:28,558
a big plus in the side of Linux. Now of
13380
09:14:26,480 --> 09:14:30,640
course this is the next question
13381
09:14:28,558 --> 09:14:32,878
security which is one of the most
13382
09:14:30,640 --> 09:14:35,758
important features when we move to a
13383
09:14:32,878 --> 09:14:38,718
certain OS. Now till date there are
13384
09:14:35,758 --> 09:14:42,480
between 80 to 120 viruses that have been
13385
09:14:38,718 --> 09:14:45,520
reported in Unix whereas Linux has had
13386
09:14:42,480 --> 09:14:48,640
about 60 to 100 viruses listed to date
13387
09:14:45,520 --> 09:14:50,878
which are currently not spreading. So
13388
09:14:48,640 --> 09:14:52,640
the next most logical question is the
13389
09:14:50,878 --> 09:14:55,840
thread detection and solution
13390
09:14:52,640 --> 09:14:58,238
procedures. While Unix users require
13391
09:14:55,840 --> 09:15:00,480
longer wait time to get the proper bug
13392
09:14:58,238 --> 09:15:03,438
fixing patch, thread detection and
13393
09:15:00,480 --> 09:15:06,558
solution is very fast in Linux because
13394
09:15:03,438 --> 09:15:09,918
Linux is mainly communitydriven. So if
13395
09:15:06,558 --> 09:15:12,160
Linux users post any kind of threat, a
13396
09:15:09,918 --> 09:15:14,960
team of qualified developers start
13397
09:15:12,160 --> 09:15:17,598
working to resolve this threat.
13398
09:15:14,960 --> 09:15:20,078
Now next let's talk a little bit about
13399
09:15:17,598 --> 09:15:22,238
the source code. Now this must be an
13400
09:15:20,078 --> 09:15:24,718
obvious to all of you. As we all know
13401
09:15:22,238 --> 09:15:28,398
the source code of Unix is not available
13402
09:15:24,718 --> 09:15:31,122
to anyone. Whereas Linux being an
13403
09:15:28,398 --> 09:15:34,398
open-source OS the source is available
13404
09:15:31,122 --> 09:15:37,040
to the general public. And finally the
13405
09:15:34,398 --> 09:15:39,680
license. This is something most of you
13406
09:15:37,040 --> 09:15:41,758
must be waiting for. Now in Unix
13407
09:15:39,680 --> 09:15:43,918
different flavors have different pricing
13408
09:15:41,758 --> 09:15:46,320
depending upon the type of vendor.
13409
09:15:43,918 --> 09:15:48,558
Whereas Linux is freely distributed,
13410
09:15:46,320 --> 09:15:51,598
downloaded through magazines, books,
13411
09:15:48,558 --> 09:15:54,238
websites, etc. There are priced versions
13412
09:15:51,598 --> 09:15:57,122
for Linux as well, but they are normally
13413
09:15:54,238 --> 09:15:59,680
cheaper than that of Windows. Now, let's
13414
09:15:57,122 --> 09:16:04,000
discuss a few limitations of each of
13415
09:15:59,680 --> 09:16:07,598
these OSS. Starting with Unix, shall we?
13416
09:16:04,000 --> 09:16:10,320
Now, the limitations of Unix. Firstly,
13417
09:16:07,598 --> 09:16:13,520
it has an unfriendly tur and
13418
09:16:10,320 --> 09:16:16,718
inconsistent and nonneimmonic user
13419
09:16:13,520 --> 09:16:19,360
interface. Apart from that, the Unix OS
13420
09:16:16,718 --> 09:16:21,200
is designed for a slow computer system.
13421
09:16:19,360 --> 09:16:23,680
So, you can't really expect a fast
13422
09:16:21,200 --> 09:16:26,718
performance. Versions on various
13423
09:16:23,680 --> 09:16:30,078
machines are slightly different in Unix.
13424
09:16:26,718 --> 09:16:32,640
So, it lacks consistency. And finally,
13425
09:16:30,078 --> 09:16:35,680
Unix does not provide any assured
13426
09:16:32,640 --> 09:16:37,598
hardware interrupt response time. So it
13427
09:16:35,680 --> 09:16:40,640
does not really support realtime
13428
09:16:37,598 --> 09:16:43,278
response time systems. Apart from this,
13429
09:16:40,640 --> 09:16:45,278
the shell interface can be treacherous
13430
09:16:43,278 --> 09:16:48,238
because a single typing mistake can
13431
09:16:45,278 --> 09:16:51,360
destroy a lot of files. With that, let's
13432
09:16:48,238 --> 09:16:54,960
move on to a few limitations that Linux
13433
09:16:51,360 --> 09:16:57,918
possesses. So here are a few limitations
13434
09:16:54,960 --> 09:17:00,960
in Linux. First of all, there is no
13435
09:16:57,918 --> 09:17:03,758
standard edition of Linux. Secondly,
13436
09:17:00,960 --> 09:17:05,680
Linux has a patchier support for drivers
13437
09:17:03,758 --> 09:17:07,360
which basically may result in the
13438
09:17:05,680 --> 09:17:09,758
misfunctioning of the whole entire
13439
09:17:07,360 --> 09:17:13,040
system. Many of the programs we are
13440
09:17:09,758 --> 09:17:15,840
using for Windows will only run on Linux
13441
09:17:13,040 --> 09:17:18,960
with the help of complicated emulators.
13442
09:17:15,840 --> 09:17:22,398
For example, the Microsoft Office. And
13443
09:17:18,960 --> 09:17:25,598
finally, Linux is really suitable for
13444
09:17:22,398 --> 09:17:28,718
only corporate users. It is way harder
13445
09:17:25,598 --> 09:17:31,758
to introduce in a home setting. Linux
13446
09:17:28,718 --> 09:17:35,480
for new users at least is not as easy to
13447
09:17:31,758 --> 09:17:35,480
use as Windows.
13448
09:17:39,438 --> 09:17:46,000
The first question, the basic question
13449
09:17:41,360 --> 09:17:48,800
would be what is Linux? Okay. So as a
13450
09:17:46,000 --> 09:17:51,360
layman, as a interviewer, if I ask this
13451
09:17:48,800 --> 09:17:53,122
question, what is Linux? The first
13452
09:17:51,360 --> 09:17:55,840
answer would be it is an operating
13453
09:17:53,122 --> 09:17:57,840
system. So before I get into Linux,
13454
09:17:55,840 --> 09:18:00,320
first of all, let me explain you like
13455
09:17:57,840 --> 09:18:02,718
what is an operating system. Every time
13456
09:18:00,320 --> 09:18:04,558
you switch on your computer, you see a
13457
09:18:02,718 --> 09:18:07,918
screen where you can perform different
13458
09:18:04,558 --> 09:18:10,480
activities like read and write or browse
13459
09:18:07,918 --> 09:18:12,718
the internet or watch a video. What is
13460
09:18:10,480 --> 09:18:15,200
it that makes the computer hardware work
13461
09:18:12,718 --> 09:18:16,960
like that? How does the processor on
13462
09:18:15,200 --> 09:18:20,078
your computer knows that you're asking
13463
09:18:16,960 --> 09:18:22,160
it to run a MP3 file? Well, it is the
13464
09:18:20,078 --> 09:18:25,520
operating system or the kernel which
13465
09:18:22,160 --> 09:18:27,520
does this work. A kernel is the program
13466
09:18:25,520 --> 09:18:29,598
at the heart of the operating system
13467
09:18:27,520 --> 09:18:32,078
that takes care of fundamental stuff
13468
09:18:29,598 --> 09:18:34,718
like letting hardware communicate with
13469
09:18:32,078 --> 09:18:37,278
software. So to work on your computer,
13470
09:18:34,718 --> 09:18:39,438
you need an operating system. In fact,
13471
09:18:37,278 --> 09:18:42,320
you're using one as you read this on
13472
09:18:39,438 --> 09:18:46,398
your computer. Now you may have used
13473
09:18:42,320 --> 09:18:48,800
popular oss like Windows, Apple OSX, but
13474
09:18:46,398 --> 09:18:51,840
here we will learn what Linux is and
13475
09:18:48,800 --> 09:18:55,200
what benefits it offers over other OS
13476
09:18:51,840 --> 09:18:58,320
choices. So Linux is an operating system
13477
09:18:55,200 --> 09:19:01,360
or a kernel which germinated as an idea
13478
09:18:58,320 --> 09:19:03,680
in the mind of young and bright Lionus
13479
09:19:01,360 --> 09:19:06,558
Torville when he was a computer science
13480
09:19:03,680 --> 09:19:09,918
student. Lionus Torbwells is considered
13481
09:19:06,558 --> 09:19:11,918
as father of Linux operating system. So
13482
09:19:09,918 --> 09:19:15,596
when he was as a computer science
13483
09:19:11,918 --> 09:19:18,080
student he took a Linux kernel and he
13484
09:19:15,596 --> 09:19:20,640
developed from the scratch. He used to
13485
09:19:18,080 --> 09:19:22,880
work on Unix operating system which in
13486
09:19:20,640 --> 09:19:25,360
those days called as a proprietary
13487
09:19:22,880 --> 09:19:26,880
software and thought that it needed
13488
09:19:25,360 --> 09:19:29,120
improvements.
13489
09:19:26,880 --> 09:19:31,596
However, when his suggestions were
13490
09:19:29,120 --> 09:19:33,436
rejected by the designers of Unix, he
13491
09:19:31,596 --> 09:19:36,080
thought of launching an operating system
13492
09:19:33,436 --> 09:19:38,960
which will be receptive to changes
13493
09:19:36,080 --> 09:19:41,436
modifications suggested by its users.
13494
09:19:38,960 --> 09:19:43,436
The benefits of using Linux operating
13495
09:19:41,436 --> 09:19:45,840
system. What are the main benefits and
13496
09:19:43,436 --> 09:19:48,560
why it gained more popularity compared
13497
09:19:45,840 --> 09:19:51,436
to other operating systems? The main
13498
09:19:48,560 --> 09:19:53,840
benefits are it offers a free operating
13499
09:19:51,436 --> 09:19:56,160
system. You do not have to shell
13500
09:19:53,840 --> 09:19:59,840
hundreds of dollars to get the OS like
13501
09:19:56,160 --> 09:20:02,640
Windows being open-source in modify it
13502
09:19:59,840 --> 09:20:05,200
source code. The Linux operating system
13503
09:20:02,640 --> 09:20:07,360
now offers millions of programs
13504
09:20:05,200 --> 09:20:10,080
applications to choose from. Most of
13505
09:20:07,360 --> 09:20:11,840
them are free. Now once you have Linux
13506
09:20:10,080 --> 09:20:14,560
installed you no longer needed an
13507
09:20:11,840 --> 09:20:17,276
antivirus because Linux is highly secure
13508
09:20:14,560 --> 09:20:19,756
system more so there is a global
13509
09:20:17,276 --> 09:20:22,480
development community constantly looking
13510
09:20:19,756 --> 09:20:25,520
at ways to enhance its security. With
13511
09:20:22,480 --> 09:20:29,200
each upgrade the OS becomes more secure
13512
09:20:25,520 --> 09:20:31,360
and robust. Linux is the OS of choice
13513
09:20:29,200 --> 09:20:34,160
for server environments due to its
13514
09:20:31,360 --> 09:20:37,040
stability and reliability. Mega
13515
09:20:34,160 --> 09:20:40,400
companies like Amazon, Facebook and
13516
09:20:37,040 --> 09:20:43,200
Google use Linux for their service. A
13517
09:20:40,400 --> 09:20:47,200
Linux-based server could run non-stop
13518
09:20:43,200 --> 09:20:50,160
without a reboot for years on end. Okay,
13519
09:20:47,200 --> 09:20:52,720
this is all about Linux. So, Linux is
13520
09:20:50,160 --> 09:20:56,400
just an operating system or a kernel.
13521
09:20:52,720 --> 09:20:58,800
Okay, which has been developed from Unix
13522
09:20:56,400 --> 09:21:01,916
operating system. So, this is what we
13523
09:20:58,800 --> 09:21:04,800
have discussed. And uh coming to the
13524
09:21:01,916 --> 09:21:07,916
next question, how different is Linux
13525
09:21:04,800 --> 09:21:09,276
when compared to Unix operating system?
13526
09:21:07,916 --> 09:21:11,276
You might face different types of
13527
09:21:09,276 --> 09:21:12,960
questions when you attend this type of
13528
09:21:11,276 --> 09:21:14,960
interviews in Linux operating system
13529
09:21:12,960 --> 09:21:16,880
like what is the comparison? What is the
13530
09:21:14,960 --> 09:21:19,916
differences did you find between like
13531
09:21:16,880 --> 09:21:23,436
Linux and Unix operating system? As I
13532
09:21:19,916 --> 09:21:25,596
said earlier, Linux is a Unix clone. But
13533
09:21:23,436 --> 09:21:28,560
if you considered according to the POSIX
13534
09:21:25,596 --> 09:21:30,400
standards, uh POSIX is nothing but a
13535
09:21:28,560 --> 09:21:32,880
portable operating system interface.
13536
09:21:30,400 --> 09:21:36,400
According to this standards, Linux can
13537
09:21:32,880 --> 09:21:39,040
be considered as Unix. Exactly. To quote
13538
09:21:36,400 --> 09:21:41,520
from official Linux kernel readme file,
13539
09:21:39,040 --> 09:21:45,040
Linux is a Unix clone written from the
13540
09:21:41,520 --> 09:21:48,560
scratch by Linux tobles with assistance
13541
09:21:45,040 --> 09:21:51,276
of hackers across the net. So I'll just
13542
09:21:48,560 --> 09:21:53,360
take some strategies here in terms of
13543
09:21:51,276 --> 09:21:55,916
cost, in terms of development and
13544
09:21:53,360 --> 09:21:57,680
distribution, in terms of manufacturer
13545
09:21:55,916 --> 09:22:01,120
like what are the differences between
13546
09:21:57,680 --> 09:22:03,276
Linux and Unix. In terms of cost, Linux
13547
09:22:01,120 --> 09:22:05,840
can be freely distributed, downloaded
13548
09:22:03,276 --> 09:22:09,040
freely, distributed through magazines,
13549
09:22:05,840 --> 09:22:11,120
books, etc. There are priced versions of
13550
09:22:09,040 --> 09:22:13,040
Linux also, but they are normally
13551
09:22:11,120 --> 09:22:15,680
cheaper than Windows operating system.
13552
09:22:13,040 --> 09:22:17,916
when you compare with Unix. In Unix, we
13553
09:22:15,680 --> 09:22:20,160
have different flavors of Unix have
13554
09:22:17,916 --> 09:22:22,960
different cost structures according to
13555
09:22:20,160 --> 09:22:25,360
the vendors. In terms of development and
13556
09:22:22,960 --> 09:22:28,160
distribution, Linux is developed by
13557
09:22:25,360 --> 09:22:30,480
open-source development that is through
13558
09:22:28,160 --> 09:22:33,040
sharing and collaboration of code and
13559
09:22:30,480 --> 09:22:35,436
features through forums and it is
13560
09:22:33,040 --> 09:22:38,080
distributed by various vendors. When
13561
09:22:35,436 --> 09:22:41,120
coming to Unix, Unix systems are divided
13562
09:22:38,080 --> 09:22:44,000
into various other flavors mostly
13563
09:22:41,120 --> 09:22:46,000
developed by AT&T as well as various
13564
09:22:44,000 --> 09:22:47,520
commercial vendors and nonprofit
13565
09:22:46,000 --> 09:22:50,400
organizations.
13566
09:22:47,520 --> 09:22:53,596
In terms of manufacturer, Linux kernel
13567
09:22:50,400 --> 09:22:56,400
is developed by the community by Linus
13568
09:22:53,596 --> 09:22:59,520
store. Linus store will oversee the
13569
09:22:56,400 --> 09:23:02,400
things. And when you talk about Unix,
13570
09:22:59,520 --> 09:23:06,000
three biggest distributions are Solaris
13571
09:23:02,400 --> 09:23:10,240
which is now acquired by Oracle, AIX by
13572
09:23:06,000 --> 09:23:13,756
IBM vendor, HPUX, it's by Heavlet packet
13573
09:23:10,240 --> 09:23:16,240
and Apple makes OSX which is also a Unix
13574
09:23:13,756 --> 09:23:18,880
based operating system. Okay. So I've
13575
09:23:16,240 --> 09:23:20,400
just taken three aspects here like cost
13576
09:23:18,880 --> 09:23:22,240
development and distribution and
13577
09:23:20,400 --> 09:23:25,200
manufacturer like this. We have many
13578
09:23:22,240 --> 09:23:27,916
such differences between Linux and Unix
13579
09:23:25,200 --> 09:23:30,480
operating system. Okay. So this is what
13580
09:23:27,916 --> 09:23:33,120
we have discussed. Okay. Coming to the
13581
09:23:30,480 --> 09:23:36,160
next question like what is the
13582
09:23:33,120 --> 09:23:39,040
importance of GNU project? GNU project
13583
09:23:36,160 --> 09:23:41,916
was launched in September 1983 by
13584
09:23:39,040 --> 09:23:44,640
Richard and Stalman to create a complete
13585
09:23:41,916 --> 09:23:48,240
operating system which is free software.
13586
09:23:44,640 --> 09:23:50,000
The main intention of GNU project is to
13587
09:23:48,240 --> 09:23:51,680
create an operating system which is
13588
09:23:50,000 --> 09:23:53,596
completely opensource which is
13589
09:23:51,680 --> 09:23:56,640
completely freely available for all
13590
09:23:53,596 --> 09:24:00,080
public users. The main licenses of the
13591
09:23:56,640 --> 09:24:03,120
GNU project are the GNU GPL which is
13592
09:24:00,080 --> 09:24:05,840
nothing but the general public licenses.
13593
09:24:03,120 --> 09:24:08,320
The name of the GNU project is derived
13594
09:24:05,840 --> 09:24:12,240
from the recursive acronym which is
13595
09:24:08,320 --> 09:24:15,436
nothing but GNU's not Unix. Okay, the
13596
09:24:12,240 --> 09:24:19,200
full form of GNU. It's a recursive term
13597
09:24:15,436 --> 09:24:22,160
GNU's not Unix. Unix was a very popular
13598
09:24:19,200 --> 09:24:24,960
operating system in the mid80s. So
13599
09:24:22,160 --> 09:24:27,596
Richard Tolman designed GNU to be mostly
13600
09:24:24,960 --> 09:24:30,000
compatible with Unix operating system so
13601
09:24:27,596 --> 09:24:33,040
that it would be convenient for people
13602
09:24:30,000 --> 09:24:35,360
to migrate to GNU. So the GNU project
13603
09:24:33,040 --> 09:24:38,480
was intended to create a Unix like
13604
09:24:35,360 --> 09:24:40,800
operating system but it should be freely
13605
09:24:38,480 --> 09:24:42,560
available for all the public users and
13606
09:24:40,800 --> 09:24:45,520
it should be a open-source operating
13607
09:24:42,560 --> 09:24:47,916
system. So this led to the birth of
13608
09:24:45,520 --> 09:24:50,720
Linux operating system. Okay. With the
13609
09:24:47,916 --> 09:24:53,436
help of Linux kernel and the GNU
13610
09:24:50,720 --> 09:24:56,000
utilities, the importance of the GNU
13611
09:24:53,436 --> 09:24:58,960
project, the free software movement
13612
09:24:56,000 --> 09:25:02,160
started by Richard M. Stallman.
13613
09:24:58,960 --> 09:25:04,800
Okay, you see the full form of GNU GNU's
13614
09:25:02,160 --> 09:25:06,800
not Unix. It's a recursive term. Okay.
13615
09:25:04,800 --> 09:25:09,040
And coming to the next question, the
13616
09:25:06,800 --> 09:25:11,040
question is like what is Linux kernel?
13617
09:25:09,040 --> 09:25:13,200
Okay, so this is an important question
13618
09:25:11,040 --> 09:25:15,520
would be asked in different types of
13619
09:25:13,200 --> 09:25:17,276
interviews and most of the people will
13620
09:25:15,520 --> 09:25:19,840
will get confused in answering this
13621
09:25:17,276 --> 09:25:22,160
question. What is Linux kernel? Let me
13622
09:25:19,840 --> 09:25:24,720
explain you in a simpler way. With over
13623
09:25:22,160 --> 09:25:27,276
13 million lines of code, the Linux
13624
09:25:24,720 --> 09:25:29,520
kernel is one of the largest open-source
13625
09:25:27,276 --> 09:25:32,880
projects in the world. But what is a
13626
09:25:29,520 --> 09:25:34,960
kernel and what it is used for? A kernel
13627
09:25:32,880 --> 09:25:37,436
is the lowest level of easily
13628
09:25:34,960 --> 09:25:39,840
replaceable software that interfaces
13629
09:25:37,436 --> 09:25:42,400
with the hardware in your computer. It
13630
09:25:39,840 --> 09:25:43,916
is responsible for interfacing all of
13631
09:25:42,400 --> 09:25:46,560
your applications that are running in
13632
09:25:43,916 --> 09:25:48,960
user mode down to the physical hardware
13633
09:25:46,560 --> 09:25:51,520
and allowing the processes which are
13634
09:25:48,960 --> 09:25:54,240
known as the services to get information
13635
09:25:51,520 --> 09:25:56,720
from each other using interprocess
13636
09:25:54,240 --> 09:25:59,596
communication. Technically speaking, a
13637
09:25:56,720 --> 09:26:01,916
kernel is nothing but the core of any
13638
09:25:59,596 --> 09:26:04,640
operating system and it is responsible
13639
09:26:01,916 --> 09:26:07,200
for translating the user commands into
13640
09:26:04,640 --> 09:26:10,800
equivalent language understood by the
13641
09:26:07,200 --> 09:26:12,880
computer hardware. Okay. So kernel it is
13642
09:26:10,800 --> 09:26:14,960
nothing but the heart of any operating
13643
09:26:12,880 --> 09:26:17,040
system. It's a core of any operating
13644
09:26:14,960 --> 09:26:19,276
system which is responsible for
13645
09:26:17,040 --> 09:26:22,080
translating the user commands into
13646
09:26:19,276 --> 09:26:24,960
equivalent language understood by the
13647
09:26:22,080 --> 09:26:27,596
computer hardware. Okay. So if you can
13648
09:26:24,960 --> 09:26:31,360
see this a pictorial representation on
13649
09:26:27,596 --> 09:26:34,640
the left pane okay you see applications
13650
09:26:31,360 --> 09:26:37,360
on top of kernel you see applications
13651
09:26:34,640 --> 09:26:39,436
and bottom of the kernel you see the
13652
09:26:37,360 --> 09:26:42,800
hardware devices the hardware devices
13653
09:26:39,436 --> 09:26:45,916
like CPU memory and the devices which
13654
09:26:42,800 --> 09:26:48,720
are attached to the computer okay so in
13655
09:26:45,916 --> 09:26:50,880
order to interact with the kernel okay
13656
09:26:48,720 --> 09:26:54,080
applications you see on top of operating
13657
09:26:50,880 --> 09:26:56,160
system you have applications so So in
13658
09:26:54,080 --> 09:26:58,480
order to interact with an operating
13659
09:26:56,160 --> 09:27:01,756
system, applications need to have some
13660
09:26:58,480 --> 09:27:04,560
kind of language, right? So kernel would
13661
09:27:01,756 --> 09:27:07,520
be acting as a mediator. Mediator
13662
09:27:04,560 --> 09:27:10,720
between applications and hardware
13663
09:27:07,520 --> 09:27:13,120
devices. It just translates the users
13664
09:27:10,720 --> 09:27:15,840
language to the machine language and
13665
09:27:13,120 --> 09:27:18,240
machines language to the users language.
13666
09:27:15,840 --> 09:27:21,276
It's a core. Kernel is nothing but the
13667
09:27:18,240 --> 09:27:24,640
core, the heart of any operating system.
13668
09:27:21,276 --> 09:27:27,756
Okay. And coming to the next question,
13669
09:27:24,640 --> 09:27:30,400
what is a shell? And in shell, what is
13670
09:27:27,756 --> 09:27:32,800
exactly called as a bash shell? Okay,
13671
09:27:30,400 --> 09:27:36,560
first let me explain you what is exactly
13672
09:27:32,800 --> 09:27:38,800
a shell. A shell is a user program or
13673
09:27:36,560 --> 09:27:41,360
its environment provided for user
13674
09:27:38,800 --> 09:27:43,756
interaction. A shell is an command
13675
09:27:41,360 --> 09:27:46,160
language interpreter that executes
13676
09:27:43,756 --> 09:27:48,480
commands read from the standard input
13677
09:27:46,160 --> 09:27:51,120
device which is called as a keyboard or
13678
09:27:48,480 --> 09:27:54,080
from a file. Shell is not part of system
13679
09:27:51,120 --> 09:27:56,800
kernel but uses system kernel to execute
13680
09:27:54,080 --> 09:27:59,840
programs like creating files, creating
13681
09:27:56,800 --> 09:28:02,880
directories etc. Okay. So please
13682
09:27:59,840 --> 09:28:05,756
remember shell is exactly called as a
13683
09:28:02,880 --> 09:28:07,916
user interface. In order to interact
13684
09:28:05,756 --> 09:28:10,320
with operating system we need one kind
13685
09:28:07,916 --> 09:28:13,916
of interface, right? That interface is
13686
09:28:10,320 --> 09:28:16,000
called as a shell. Okay. Shell is a
13687
09:28:13,916 --> 09:28:18,160
command language interpreter. Most of
13688
09:28:16,000 --> 09:28:21,120
the people often confuse between
13689
09:28:18,160 --> 09:28:23,680
interpreter and a compiler. Okay, please
13690
09:28:21,120 --> 09:28:26,400
remember interpreter is type of a
13691
09:28:23,680 --> 09:28:28,560
mechanism that executes commands which
13692
09:28:26,400 --> 09:28:32,160
are read from the standard input device
13693
09:28:28,560 --> 09:28:34,480
or from a file. Okay. So when you talk
13694
09:28:32,160 --> 09:28:36,800
about shell in shell we have different
13695
09:28:34,480 --> 09:28:39,360
types in Linux and Unix operating
13696
09:28:36,800 --> 09:28:42,320
system. We have bash shell, we have
13697
09:28:39,360 --> 09:28:44,560
single shell, we have con shell, we have
13698
09:28:42,320 --> 09:28:47,276
csh shell, we have public domain con
13699
09:28:44,560 --> 09:28:49,756
shell, we have different types of shells
13700
09:28:47,276 --> 09:28:52,960
used in Linux and Unix operating system.
13701
09:28:49,756 --> 09:28:55,276
But bash is the default shell. Bash has
13702
09:28:52,960 --> 09:28:58,640
been adopted as the default shell for
13703
09:28:55,276 --> 09:29:01,276
most Linux systems. Okay, bash is a
13704
09:28:58,640 --> 09:29:03,916
shell or a command language interpreter
13705
09:29:01,276 --> 09:29:07,436
for the GNU operating systems. Once
13706
09:29:03,916 --> 09:29:10,000
again, I'm using the term GNU. Okay, GNU
13707
09:29:07,436 --> 09:29:12,480
operating systems like Linux. In most
13708
09:29:10,000 --> 09:29:15,120
distributions of Linux operating system,
13709
09:29:12,480 --> 09:29:18,720
bash is incorporated as the default
13710
09:29:15,120 --> 09:29:21,756
shell. Okay, the name is an acronym for
13711
09:29:18,720 --> 09:29:24,720
the bornag again shell. Bash stands for
13712
09:29:21,756 --> 09:29:27,596
born again shell. Okay, it is named
13713
09:29:24,720 --> 09:29:29,840
after a person called Stephen Bourne.
13714
09:29:27,596 --> 09:29:31,840
Okay, he's the author for born again
13715
09:29:29,840 --> 09:29:34,080
shell. Now why bash has been
13716
09:29:31,840 --> 09:29:36,160
incorporated as a default shell because
13717
09:29:34,080 --> 09:29:38,800
in bash we have many such features.
13718
09:29:36,160 --> 09:29:42,400
Features like command aliasing, command
13719
09:29:38,800 --> 09:29:46,080
completion by using the tap keys and the
13720
09:29:42,400 --> 09:29:48,160
command history also. Okay. Like in
13721
09:29:46,080 --> 09:29:50,240
order to execute the commands like no
13722
09:29:48,160 --> 09:29:52,480
need to remember all the commands in
13723
09:29:50,240 --> 09:29:55,200
Linux operating system. Okay. With lot
13724
09:29:52,480 --> 09:29:57,840
of ease you can execute all the commands
13725
09:29:55,200 --> 09:30:00,800
by the features of bash shell. Okay.
13726
09:29:57,840 --> 09:30:03,360
command aliasing, command completion or
13727
09:30:00,800 --> 09:30:06,240
file completion by using the tap keys
13728
09:30:03,360 --> 09:30:08,320
and the command history. Okay, in order
13729
09:30:06,240 --> 09:30:09,840
to execute like previous commands, no
13730
09:30:08,320 --> 09:30:12,000
need to type the commands again and
13731
09:30:09,840 --> 09:30:14,880
again. You can recall those commands by
13732
09:30:12,000 --> 09:30:18,000
using the up and down arrow keys. Using
13733
09:30:14,880 --> 09:30:20,640
that you can recall all those commands.
13734
09:30:18,000 --> 09:30:23,120
Okay, if I show you practically one
13735
09:30:20,640 --> 09:30:25,680
particular example, we have one command
13736
09:30:23,120 --> 09:30:28,560
called clear in Linux. See this is the
13737
09:30:25,680 --> 09:30:32,160
terminal I'm using the command line
13738
09:30:28,560 --> 09:30:35,276
interface the terminal where we can gain
13739
09:30:32,160 --> 09:30:37,360
access to Linux operating system. I'm
13740
09:30:35,276 --> 09:30:39,520
just giving one particular example like
13741
09:30:37,360 --> 09:30:42,080
why bash has been incorporated as a
13742
09:30:39,520 --> 09:30:44,400
default shell. Okay let's see what is
13743
09:30:42,080 --> 09:30:46,560
exactly a command aliasing. I'm
13744
09:30:44,400 --> 09:30:48,640
executing a command called clear. The
13745
09:30:46,560 --> 09:30:51,040
command clear which is used to clear the
13746
09:30:48,640 --> 09:30:52,960
screen. So every time you want to clear
13747
09:30:51,040 --> 09:30:55,436
the screen you run the command clear.
13748
09:30:52,960 --> 09:30:58,720
Once you press enter the screen will be
13749
09:30:55,436 --> 09:31:00,960
cleared. Now instead for this lengthy
13750
09:30:58,720 --> 09:31:05,120
program and what I'll do here I'll just
13751
09:31:00,960 --> 09:31:07,436
make an alias C is equal to clear. Now
13752
09:31:05,120 --> 09:31:11,200
once you press enter for that particular
13753
09:31:07,436 --> 09:31:14,080
command clear I've been alias to C. Now
13754
09:31:11,200 --> 09:31:16,560
instead of running command clear I can
13755
09:31:14,080 --> 09:31:19,436
run the alias command called C. Once you
13756
09:31:16,560 --> 09:31:21,520
press enter the screen would be cleared
13757
09:31:19,436 --> 09:31:23,840
like this for any such programs or
13758
09:31:21,520 --> 09:31:26,000
applications. If you want to do aliyas
13759
09:31:23,840 --> 09:31:28,160
this is possible with bash shell. Now
13760
09:31:26,000 --> 09:31:30,960
these kind of features you cannot see in
13761
09:31:28,160 --> 09:31:33,756
other shells. Okay. In other shells
13762
09:31:30,960 --> 09:31:36,080
other shells like C shell con shell
13763
09:31:33,756 --> 09:31:38,000
public domain con shell you don't see
13764
09:31:36,080 --> 09:31:41,040
all the types of features in other
13765
09:31:38,000 --> 09:31:45,680
shells. In Unix operating system the
13766
09:31:41,040 --> 09:31:48,720
default shell was shell. Okay. And what
13767
09:31:45,680 --> 09:31:52,000
this person has done, Stephen Bourne has
13768
09:31:48,720 --> 09:31:54,000
incorporated some new features. Okay,
13769
09:31:52,000 --> 09:31:56,240
some features has been incorporated in
13770
09:31:54,000 --> 09:31:59,840
single shell and this has been renamed
13771
09:31:56,240 --> 09:32:02,400
as the bash shell. Okay, bash is nothing
13772
09:31:59,840 --> 09:32:05,680
but the born again shell. It is named
13773
09:32:02,400 --> 09:32:08,320
after an inventor called Stephen born.
13774
09:32:05,680 --> 09:32:10,480
Okay, in Linux, if you want to see the
13775
09:32:08,320 --> 09:32:13,120
types of shells which are supported, you
13776
09:32:10,480 --> 09:32:17,560
can check this configuration file. the
13777
09:32:13,120 --> 09:32:17,560
configuration file called /c/shells.
13778
09:32:17,916 --> 09:32:22,720
Okay, this is a configuration file where
13779
09:32:20,480 --> 09:32:25,436
you can see the number of shells
13780
09:32:22,720 --> 09:32:27,436
supported by Linux or Unix operating
13781
09:32:25,436 --> 09:32:30,160
system. If you want to see what is the
13782
09:32:27,436 --> 09:32:32,560
default shell, you can just recall the
13783
09:32:30,160 --> 09:32:34,640
environment variable called shell. This
13784
09:32:32,560 --> 09:32:37,040
will tell you what is the default shell
13785
09:32:34,640 --> 09:32:42,000
used in the operating system. You see
13786
09:32:37,040 --> 09:32:44,320
/bin / bash. Okay. So that is the
13787
09:32:42,000 --> 09:32:46,320
importance of bash shell and you must
13788
09:32:44,320 --> 09:32:48,800
have got an idea like what is shell and
13789
09:32:46,320 --> 09:32:51,840
what is the importance of bash shell?
13790
09:32:48,800 --> 09:32:54,400
Okay. And coming to the next question
13791
09:32:51,840 --> 09:32:56,480
what are demons? So this would be a
13792
09:32:54,400 --> 09:32:58,800
tricky question asked in interviews like
13793
09:32:56,480 --> 09:33:01,840
what are demons? If I put it in a
13794
09:32:58,800 --> 09:33:05,200
simpler format, uh, demon according to
13795
09:33:01,840 --> 09:33:07,680
my readings, demons are services that
13796
09:33:05,200 --> 09:33:09,596
provide several functions that may not
13797
09:33:07,680 --> 09:33:12,400
be available under the base operating
13798
09:33:09,596 --> 09:33:14,800
system. Its main task is to listen for
13799
09:33:12,400 --> 09:33:17,276
service request and at the same time to
13800
09:33:14,800 --> 09:33:19,520
act on these request. After the service
13801
09:33:17,276 --> 09:33:22,960
is done, it is then disconnected and
13802
09:33:19,520 --> 09:33:25,756
waits for further request. A demon
13803
09:33:22,960 --> 09:33:28,000
process has no controlling terminal. It
13804
09:33:25,756 --> 09:33:29,756
cannot open the terminal. For example,
13805
09:33:28,000 --> 09:33:32,880
/dev/tty.
13806
09:33:29,756 --> 09:33:35,596
If you do ps- ef and look at the ppt
13807
09:33:32,880 --> 09:33:38,000
ttty field, all demons will have
13808
09:33:35,596 --> 09:33:40,080
question mark for the tty terminal.
13809
09:33:38,000 --> 09:33:45,480
Okay, I'll give one practical example
13810
09:33:40,080 --> 09:33:45,480
here. If I run a command ps efmens,
13811
09:33:46,320 --> 09:33:52,560
usually in Linux and Unix operating
13812
09:33:48,560 --> 09:33:54,560
system, a demon would end with d. Okay,
13813
09:33:52,560 --> 09:33:58,080
you see for example, let's take this
13814
09:33:54,560 --> 09:33:59,916
particular demon here K thread D. Okay,
13815
09:33:58,080 --> 09:34:02,480
at the end you see see the character
13816
09:33:59,916 --> 09:34:05,200
here D which is nothing but a demon.
13817
09:34:02,480 --> 09:34:07,596
Okay, as I told you a demon process has
13818
09:34:05,200 --> 09:34:10,400
no controlling terminal. If you check
13819
09:34:07,596 --> 09:34:14,560
TTY field here for this particular
13820
09:34:10,400 --> 09:34:16,960
demon, you see a question mark. Okay, a
13821
09:34:14,560 --> 09:34:20,000
demon process is essentially a program
13822
09:34:16,960 --> 09:34:21,680
that runs in the background and is
13823
09:34:20,000 --> 09:34:24,000
usually started when the operating
13824
09:34:21,680 --> 09:34:26,160
system starts up. Okay, if you want me
13825
09:34:24,000 --> 09:34:28,880
to take one more example, a typical
13826
09:34:26,160 --> 09:34:30,880
demon process in a mail demon that runs
13827
09:34:28,880 --> 09:34:33,596
in the background checking to see if you
13828
09:34:30,880 --> 09:34:37,040
have received a new mail when you do it
13829
09:34:33,596 --> 09:34:39,680
notifies you. Okay, so most demons tend
13830
09:34:37,040 --> 09:34:42,160
to last a long time, be owned by root or
13831
09:34:39,680 --> 09:34:44,480
do something useful. But this is a very
13832
09:34:42,160 --> 09:34:47,040
tricky question. Okay, what is the
13833
09:34:44,480 --> 09:34:49,756
difference between a demon and a
13834
09:34:47,040 --> 09:34:52,560
process? Okay, so please don't get
13835
09:34:49,756 --> 09:34:55,200
confused between this. A demon is a
13836
09:34:52,560 --> 09:34:57,596
service that provides several functions
13837
09:34:55,200 --> 09:35:00,160
that may not be available under the base
13838
09:34:57,596 --> 09:35:02,400
operating system. Okay, the main
13839
09:35:00,160 --> 09:35:04,720
advantage, the main task is to listen
13840
09:35:02,400 --> 09:35:07,276
for service request and at the same time
13841
09:35:04,720 --> 09:35:10,400
it will be act on these request. So that
13842
09:35:07,276 --> 09:35:14,720
is about the demands. Okay, one good
13843
09:35:10,400 --> 09:35:17,040
example you can always run ps- ef and
13844
09:35:14,720 --> 09:35:19,040
you check all the demens in the tty
13845
09:35:17,040 --> 09:35:22,400
field you see the question mark that
13846
09:35:19,040 --> 09:35:24,800
means we have not initiated this system
13847
09:35:22,400 --> 09:35:28,320
the operating system has initiated all
13848
09:35:24,800 --> 09:35:31,756
these demens okay and coming to the next
13849
09:35:28,320 --> 09:35:34,000
question what is a lielo a lielo is a
13850
09:35:31,756 --> 09:35:36,160
Linux loader it's a bootloadader for
13851
09:35:34,000 --> 09:35:39,436
Linux operating system it is used to
13852
09:35:36,160 --> 09:35:41,520
load Linux into the memory and start the
13853
09:35:39,436 --> 09:35:43,520
operating system. Uh, Lilo can be
13854
09:35:41,520 --> 09:35:46,480
configured to boot other operating
13855
09:35:43,520 --> 09:35:48,320
systems as well. Lilo is customizable
13856
09:35:46,480 --> 09:35:50,640
which means that if the default
13857
09:35:48,320 --> 09:35:53,040
configuration is not correct, it can be
13858
09:35:50,640 --> 09:35:57,160
changed. The main configuration file for
13859
09:35:53,040 --> 09:35:57,160
Lilo would be /etc/lo.com.
13860
09:35:57,200 --> 09:36:02,480
Okay, as I said, Lilo stands for Linux
13861
09:36:00,320 --> 09:36:05,360
loader, which is just a bootstrap
13862
09:36:02,480 --> 09:36:07,916
program. Lilo is the code snippet which
13863
09:36:05,360 --> 09:36:10,160
loads PC BIOS into the main memory at
13864
09:36:07,916 --> 09:36:14,240
the time of starting the computer
13865
09:36:10,160 --> 09:36:17,276
system. Okay. And uh the main task it
13866
09:36:14,240 --> 09:36:19,040
handles is locating Linux kernel,
13867
09:36:17,276 --> 09:36:21,520
identifying other supporting programs
13868
09:36:19,040 --> 09:36:24,560
and loading them into the memory and
13869
09:36:21,520 --> 09:36:27,120
starting the kernel. Okay. So, Lilo is
13870
09:36:24,560 --> 09:36:29,200
not used nowadays. The default
13871
09:36:27,120 --> 09:36:32,880
bootloadader for Linux operating system
13872
09:36:29,200 --> 09:36:36,000
is now is grub which is called a grand
13873
09:36:32,880 --> 09:36:37,756
unified bootloader. Okay. When you talk
13874
09:36:36,000 --> 09:36:40,000
about the latest version of Linux
13875
09:36:37,756 --> 09:36:43,520
operating system, it has been replaced
13876
09:36:40,000 --> 09:36:45,916
with grub 2. Okay. Some more features
13877
09:36:43,520 --> 09:36:47,680
has been added in grub and they have
13878
09:36:45,916 --> 09:36:52,000
released the new version that is called
13879
09:36:47,680 --> 09:36:54,560
grub 2. Okay. So this is all about Lilo.
13880
09:36:52,000 --> 09:36:57,040
It is just a Linux loader. It is called
13881
09:36:54,560 --> 09:36:59,520
as a bootstrap program. It's a
13882
09:36:57,040 --> 09:37:02,160
bootloader which loads Linux operating
13883
09:36:59,520 --> 09:37:03,596
system into the main memory. Coming to
13884
09:37:02,160 --> 09:37:07,436
the next question, what are the
13885
09:37:03,596 --> 09:37:10,560
advantages of Linux being open-source?
13886
09:37:07,436 --> 09:37:13,436
Okay. So, we have been discussed in the
13887
09:37:10,560 --> 09:37:16,000
earlier questions also the advantages of
13888
09:37:13,436 --> 09:37:17,436
opensource operating system. Linux was
13889
09:37:16,000 --> 09:37:20,320
one of the first open-source
13890
09:37:17,436 --> 09:37:22,960
technologies, but many programmers have
13891
09:37:20,320 --> 09:37:25,596
contributed and added software that's
13892
09:37:22,960 --> 09:37:27,276
completely open-source for any user.
13893
09:37:25,596 --> 09:37:30,240
This means that you can download the
13894
09:37:27,276 --> 09:37:32,880
source code and change it at any way you
13895
09:37:30,240 --> 09:37:35,200
like. Some developers have restrictions
13896
09:37:32,880 --> 09:37:37,840
on how you can distribute the code. For
13897
09:37:35,200 --> 09:37:39,596
instance, some developers allows you to
13898
09:37:37,840 --> 09:37:42,000
change the code, but you cannot
13899
09:37:39,596 --> 09:37:44,320
distribute it for money. One main
13900
09:37:42,000 --> 09:37:47,276
advantage of opensource technologies
13901
09:37:44,320 --> 09:37:50,320
such as Linux is a wide range of options
13902
09:37:47,276 --> 09:37:53,436
available to users and the increased
13903
09:37:50,320 --> 09:37:55,436
security. With Linux being open-source,
13904
09:37:53,436 --> 09:37:58,960
several distributions are available to
13905
09:37:55,436 --> 09:38:02,800
the end user. For example, distributions
13906
09:37:58,960 --> 09:38:04,960
such as Debian, Fedora, Ubuntu, and Mint
13907
09:38:02,800 --> 09:38:07,436
are just a few of the distributions
13908
09:38:04,960 --> 09:38:09,436
available to end users. And these
13909
09:38:07,436 --> 09:38:12,480
distributions are completely free to
13910
09:38:09,436 --> 09:38:15,680
download. Security is the other main
13911
09:38:12,480 --> 09:38:18,160
advantage. Several white hat hackers
13912
09:38:15,680 --> 09:38:20,400
have contributed to the overall security
13913
09:38:18,160 --> 09:38:23,680
of Linux and by making the source
13914
09:38:20,400 --> 09:38:26,080
available to anyone, security experts
13915
09:38:23,680 --> 09:38:29,120
can help identify any main security
13916
09:38:26,080 --> 09:38:30,560
flaws in the operating system. Coming to
13917
09:38:29,120 --> 09:38:32,800
the next question like what are the
13918
09:38:30,560 --> 09:38:36,320
basic components of Linux operating
13919
09:38:32,800 --> 09:38:39,200
system? Okay, this is a general question
13920
09:38:36,320 --> 09:38:41,680
which would be asked in the interviews.
13921
09:38:39,200 --> 09:38:43,680
Linux operating system has primarily
13922
09:38:41,680 --> 09:38:46,240
three components. What we have discussed
13923
09:38:43,680 --> 09:38:49,040
already is kernel. A kernel is the core
13924
09:38:46,240 --> 09:38:51,120
part of Linux which is responsible for
13925
09:38:49,040 --> 09:38:54,160
all major activities of this operating
13926
09:38:51,120 --> 09:38:55,916
system. It consists of various modules
13927
09:38:54,160 --> 09:38:58,400
and it interacts directly with the
13928
09:38:55,916 --> 09:39:00,480
underlying hardware. Kernel provides a
13929
09:38:58,400 --> 09:39:02,400
required abstraction to hide low-level
13930
09:39:00,480 --> 09:39:04,800
hardware details to system or
13931
09:39:02,400 --> 09:39:06,640
application programs. Okay, we have
13932
09:39:04,800 --> 09:39:08,800
already discussed what is kernel. Next
13933
09:39:06,640 --> 09:39:12,080
comes the second part is system library
13934
09:39:08,800 --> 09:39:14,320
and system utility. Okay, system
13935
09:39:12,080 --> 09:39:16,320
libraries are special functions or
13936
09:39:14,320 --> 09:39:19,040
programs using which application
13937
09:39:16,320 --> 09:39:21,520
programs or system utilities accesses
13938
09:39:19,040 --> 09:39:23,596
kernel features. These libraries
13939
09:39:21,520 --> 09:39:25,520
implements most of the functionalities
13940
09:39:23,596 --> 09:39:27,840
of the operating system and do not
13941
09:39:25,520 --> 09:39:29,840
require kernel modules code access
13942
09:39:27,840 --> 09:39:32,720
rights. Like when you compare with
13943
09:39:29,840 --> 09:39:35,040
Windows, in Windows we have DLL which is
13944
09:39:32,720 --> 09:39:37,200
nothing but dynamic link libraries. In
13945
09:39:35,040 --> 09:39:39,120
Linux we have something all the
13946
09:39:37,200 --> 09:39:42,400
libraries which are there to read the
13947
09:39:39,120 --> 09:39:44,400
file write the file all this coding part
13948
09:39:42,400 --> 09:39:46,640
okay implementation of the most of the
13949
09:39:44,400 --> 09:39:50,560
functionalities will be there in the /
13950
09:39:46,640 --> 09:39:52,320
usr/lib directory or /lib directory okay
13951
09:39:50,560 --> 09:39:55,276
and coming to the next question how to
13952
09:39:52,320 --> 09:39:59,120
check memory stats and CPU stats as a
13953
09:39:55,276 --> 09:40:01,120
Linux admin okay so in interviews as I
13954
09:39:59,120 --> 09:40:03,520
said earlier the questions would be
13955
09:40:01,120 --> 09:40:05,436
always in tricky format like can expect
13956
09:40:03,520 --> 09:40:07,916
questions in theoretical ical or you can
13957
09:40:05,436 --> 09:40:09,756
expect questions in practical also. So
13958
09:40:07,916 --> 09:40:12,640
you should be well advanced, you should
13959
09:40:09,756 --> 09:40:15,596
be well prepared for the interview in
13960
09:40:12,640 --> 09:40:17,120
the practical part also. So according to
13961
09:40:15,596 --> 09:40:19,120
this question being a Linux
13962
09:40:17,120 --> 09:40:22,080
administrator how you can check the
13963
09:40:19,120 --> 09:40:24,400
memory stats and the CPU stats. So there
13964
09:40:22,080 --> 09:40:26,400
are various commands in Linux here one
13965
09:40:24,400 --> 09:40:28,720
such command would be free. If you want
13966
09:40:26,400 --> 09:40:31,200
to check memory statistics, you can run
13967
09:40:28,720 --> 09:40:34,480
the command called free - m if you want
13968
09:40:31,200 --> 09:40:35,840
to see the size in megabytes or free - g
13969
09:40:34,480 --> 09:40:38,480
if you want to see the size in
13970
09:40:35,840 --> 09:40:40,640
megabytes. And if you want to see the
13971
09:40:38,480 --> 09:40:43,596
virtual memory statistics, you have a
13972
09:40:40,640 --> 09:40:45,916
command called VM stat. Uh Linux VM
13973
09:40:43,596 --> 09:40:48,320
start command used to display statistics
13974
09:40:45,916 --> 09:40:51,276
of a virtual memory. You can also see
13975
09:40:48,320 --> 09:40:54,320
the kernel threats, the disks, system
13976
09:40:51,276 --> 09:40:57,276
processes, IO blocks, interrupts, CPU
13977
09:40:54,320 --> 09:40:59,596
activity and much more. Okay, let me
13978
09:40:57,276 --> 09:41:02,160
explain you this practically here. As I
13979
09:40:59,596 --> 09:41:03,756
said, if you want to see the memory
13980
09:41:02,160 --> 09:41:07,200
statistics, you can run the command
13981
09:41:03,756 --> 09:41:10,240
called free-m. According to my system, I
13982
09:41:07,200 --> 09:41:11,680
just got approximately some 10 GB of RAM
13983
09:41:10,240 --> 09:41:14,480
because by default, I'm seeing in
13984
09:41:11,680 --> 09:41:19,840
megabytes here. 9,838
13985
09:41:14,480 --> 09:41:22,320
MB out of which 651 is used 8,714 is
13986
09:41:19,840 --> 09:41:25,276
free or if you want to see that in
13987
09:41:22,320 --> 09:41:28,640
gigabytes you can run the command free-
13988
09:41:25,276 --> 09:41:30,400
G if you want to see that in gigabytes
13989
09:41:28,640 --> 09:41:32,880
and when you talk about virtual memory
13990
09:41:30,400 --> 09:41:36,800
statistics you have a command called VM
13991
09:41:32,880 --> 09:41:38,960
stat a okay so in this example there are
13992
09:41:36,800 --> 09:41:42,080
six columns here the significant of the
13993
09:41:38,960 --> 09:41:44,480
columns are explained okay in details
13994
09:41:42,080 --> 09:41:49,840
here As you can see the first is the
13995
09:41:44,480 --> 09:41:53,120
processes the memory swap IO system and
13996
09:41:49,840 --> 09:41:56,880
CPU. Okay, you can just find out with
13997
09:41:53,120 --> 09:41:59,596
the VM stat command. You can also check
13998
09:41:56,880 --> 09:42:01,120
the dynamic activity of your system.
13999
09:41:59,596 --> 09:42:05,520
Like for example, you see I'm running
14000
09:42:01,120 --> 09:42:08,480
the command here VMAT 2 space 6. With
14001
09:42:05,520 --> 09:42:11,360
this command, VM start execute every 2
14002
09:42:08,480 --> 09:42:14,240
seconds and stops automatically after
14003
09:42:11,360 --> 09:42:17,040
executing six intervals. See this
14004
09:42:14,240 --> 09:42:19,436
practically see the interval here. Okay,
14005
09:42:17,040 --> 09:42:22,240
interval is every 2 seconds and it will
14006
09:42:19,436 --> 09:42:24,240
stop automatically after six intervals.
14007
09:42:22,240 --> 09:42:26,960
Here you can monitor like this virtual
14008
09:42:24,240 --> 09:42:29,040
memory statistics. Okay, if you want to
14009
09:42:26,960 --> 09:42:31,840
see along with the time format here, you
14010
09:42:29,040 --> 09:42:35,436
run the command VM stat
14011
09:42:31,840 --> 09:42:37,916
okay 1, 5 for example. Once you press
14012
09:42:35,436 --> 09:42:40,960
enter you can see along with the time
14013
09:42:37,916 --> 09:42:44,960
format. Okay. So like this we have many
14014
09:42:40,960 --> 09:42:46,960
such options in VM stat the based on the
14015
09:42:44,960 --> 09:42:49,840
requirement the based on the performance
14016
09:42:46,960 --> 09:42:52,640
and monitoring you can execute those and
14017
09:42:49,840 --> 09:42:56,320
coming to the CPU you have a command
14018
09:42:52,640 --> 09:43:00,880
called SAR the system activity report.
14019
09:42:56,320 --> 09:43:04,320
Okay with SAR - U you can display the
14020
09:43:00,880 --> 09:43:08,720
CPU usage. See exactly you can see the
14021
09:43:04,320 --> 09:43:10,720
CPU usage. Okay. S - U displays the CPU
14022
09:43:08,720 --> 09:43:13,360
usage for the current day that was
14023
09:43:10,720 --> 09:43:15,436
collected until that point. Okay. If you
14024
09:43:13,360 --> 09:43:18,240
want to see the realtime CPU usage, it's
14025
09:43:15,436 --> 09:43:23,596
the same like VM stat
14026
09:43:18,240 --> 09:43:26,640
U 1 space 3. Okay. Every 1 second but
14027
09:43:23,596 --> 09:43:29,040
three intervals here you can see. Okay.
14028
09:43:26,640 --> 09:43:32,160
SAR is very very very important command.
14029
09:43:29,040 --> 09:43:35,040
It is used by uh every administrator to
14030
09:43:32,160 --> 09:43:37,596
monitor the day-to-day activity. Okay.
14031
09:43:35,040 --> 09:43:40,080
In SAR also we have many such arguments
14032
09:43:37,596 --> 09:43:43,840
here. If you want me to discuss more SAR
14033
09:43:40,080 --> 09:43:46,640
- R to see the memory free and used I'll
14034
09:43:43,840 --> 09:43:50,000
give 1 comma 3. You can also see with
14035
09:43:46,640 --> 09:43:51,840
the SAR you see the KB memory free KB
14036
09:43:50,000 --> 09:43:53,840
memory used and memory used in
14037
09:43:51,840 --> 09:43:57,040
percentage. You can see all that with
14038
09:43:53,840 --> 09:43:59,680
the SAR command also. Okay. This is all
14039
09:43:57,040 --> 09:44:01,276
about the system monitoring and the
14040
09:43:59,680 --> 09:44:03,680
performance.
14041
09:44:01,276 --> 09:44:06,320
So coming to the slide. So these are
14042
09:44:03,680 --> 09:44:08,160
some programs we have just given in the
14043
09:44:06,320 --> 09:44:10,960
slide here. We have discussed about the
14044
09:44:08,160 --> 09:44:13,120
free VM stat to see the virtual memory
14045
09:44:10,960 --> 09:44:15,360
statistics. And uh when you talk about
14046
09:44:13,120 --> 09:44:17,840
CPU statistics, you can always use the
14047
09:44:15,360 --> 09:44:21,120
program star which is nothing but system
14048
09:44:17,840 --> 09:44:23,520
activity report. Okay. So I just gave
14049
09:44:21,120 --> 09:44:25,756
you some basic examples. But if you dig
14050
09:44:23,520 --> 09:44:28,960
more into this commands, you have many
14051
09:44:25,756 --> 09:44:31,200
such options. Okay. And the frequently
14052
09:44:28,960 --> 09:44:33,916
asked questions in interviews would be
14053
09:44:31,200 --> 09:44:37,120
how to reduce or shrink the size of an
14054
09:44:33,916 --> 09:44:39,360
LVM partition. Okay. This is a
14055
09:44:37,120 --> 09:44:41,596
frequently asked question in interview.
14056
09:44:39,360 --> 09:44:44,240
See the main advantage if you just
14057
09:44:41,596 --> 09:44:47,276
compare between a partition and a
14058
09:44:44,240 --> 09:44:49,916
logical volume. Okay. The storage
14059
09:44:47,276 --> 09:44:51,360
management can be created like whenever
14060
09:44:49,916 --> 09:44:53,360
you want to create a partition,
14061
09:44:51,360 --> 09:44:56,080
partitions can be created by using a
14062
09:44:53,360 --> 09:44:59,120
tool called FDK. But if you create a
14063
09:44:56,080 --> 09:45:01,680
partition using FD, it is the fixed
14064
09:44:59,120 --> 09:45:05,276
partition size. Later it is not possible
14065
09:45:01,680 --> 09:45:08,080
for us to modify or resize or shrink the
14066
09:45:05,276 --> 09:45:11,756
partition size. That flexibility is not
14067
09:45:08,080 --> 09:45:13,916
available using fisk partitioning tools.
14068
09:45:11,756 --> 09:45:16,400
Now using advanced partitioning tool
14069
09:45:13,916 --> 09:45:19,436
like LVM which is called as a logical
14070
09:45:16,400 --> 09:45:22,640
volume manager we have a flexibility of
14071
09:45:19,436 --> 09:45:25,916
either resizing a logical volume or
14072
09:45:22,640 --> 09:45:28,720
reducing or shrinking the size of a
14073
09:45:25,916 --> 09:45:31,520
logical volume. So let's see practically
14074
09:45:28,720 --> 09:45:33,596
how you can do that in Linux operating
14075
09:45:31,520 --> 09:45:35,680
system. I'm talking about advanced
14076
09:45:33,596 --> 09:45:38,720
partitioning tool called LVM which is
14077
09:45:35,680 --> 09:45:41,436
nothing but the logical volume manager.
14078
09:45:38,720 --> 09:45:43,360
Okay. So I've already created a logical
14079
09:45:41,436 --> 09:45:46,560
volume manager here as you can see with
14080
09:45:43,360 --> 09:45:48,640
the command dfh capital T. You can see
14081
09:45:46,560 --> 09:45:52,880
for example there is a logical volume
14082
09:45:48,640 --> 09:45:55,840
here. The logical volume is zoom Linux
14083
09:45:52,880 --> 09:45:59,360
and the type of the file system is ext4.
14084
09:45:55,840 --> 09:46:01,840
The size is 4.8GB and currently this
14085
09:45:59,360 --> 09:46:05,276
logical volume is mounted on the mount
14086
09:46:01,840 --> 09:46:07,436
point called / LVM. So now I got a
14087
09:46:05,276 --> 09:46:11,040
requirement of reducing this logical
14088
09:46:07,436 --> 09:46:13,436
volume size. Okay, in other file systems
14089
09:46:11,040 --> 09:46:16,000
I'm running out of space. I would like
14090
09:46:13,436 --> 09:46:18,960
to reduce this logical volume and I want
14091
09:46:16,000 --> 09:46:21,680
to increase the logical volume for other
14092
09:46:18,960 --> 09:46:25,200
file systems. So let's see how exactly
14093
09:46:21,680 --> 09:46:27,120
we can do that. Okay. So let me take one
14094
09:46:25,200 --> 09:46:29,120
example here. There is a logical volume
14095
09:46:27,120 --> 09:46:31,756
which is of 5GB currently. I would like
14096
09:46:29,120 --> 09:46:34,560
to reduce to 3GB now. Okay. So that that
14097
09:46:31,756 --> 09:46:37,040
2GB I can accommodate to other file
14098
09:46:34,560 --> 09:46:39,360
systems. The first thing is online
14099
09:46:37,040 --> 09:46:41,916
shrinking is not possible. So first you
14100
09:46:39,360 --> 09:46:44,400
need to unmount a logical volume. The
14101
09:46:41,916 --> 09:46:47,520
command is u mount and specify either
14102
09:46:44,400 --> 09:46:50,080
the device name or the mount point and
14103
09:46:47,520 --> 09:46:51,596
then you can check whether you have any
14104
09:46:50,080 --> 09:46:55,360
problem with this particular file
14105
09:46:51,596 --> 09:46:58,320
system. You run the command e2fck - f
14106
09:46:55,360 --> 09:47:00,320
and specify the device name. Okay. So
14107
09:46:58,320 --> 09:47:02,160
this is must and should before you
14108
09:47:00,320 --> 09:47:05,360
reduce the logical volume. You just need
14109
09:47:02,160 --> 09:47:07,756
to scan your file system. Okay. E2 FSK
14110
09:47:05,360 --> 09:47:09,596
is the command to check the particular
14111
09:47:07,756 --> 09:47:11,840
file system whether you have any
14112
09:47:09,596 --> 09:47:14,960
problems or not. Now once you press
14113
09:47:11,840 --> 09:47:17,436
enter so exactly you should find this.
14114
09:47:14,960 --> 09:47:19,520
Okay. So we have no problems with this
14115
09:47:17,436 --> 09:47:21,680
particular file system. Now we can
14116
09:47:19,520 --> 09:47:25,120
reduce by using the command resize to
14117
09:47:21,680 --> 09:47:29,360
FS. Specify the logical volume name. I
14118
09:47:25,120 --> 09:47:31,916
would like to reduce from 5GB to 3GB.
14119
09:47:29,360 --> 09:47:35,200
The current size is 5GB. I would like to
14120
09:47:31,916 --> 09:47:37,276
reduce to 3GB and the remaining 2GB I
14121
09:47:35,200 --> 09:47:41,040
would like to accommodate to other file
14122
09:47:37,276 --> 09:47:44,080
systems. Enter. Now you see the logical
14123
09:47:41,040 --> 09:47:47,360
volume size has been reduced. Okay. So
14124
09:47:44,080 --> 09:47:51,916
now we can run the command lV reduce
14125
09:47:47,360 --> 09:47:55,276
capital L 3GB and specify your logical
14126
09:47:51,916 --> 09:47:58,240
volume name. Now once you press enter it
14127
09:47:55,276 --> 09:48:00,800
will be reduced to 3GB. Now from 5GB to
14128
09:47:58,240 --> 09:48:03,436
3GB. As you can see some information
14129
09:48:00,800 --> 09:48:06,720
here and then you can mount your logical
14130
09:48:03,436 --> 09:48:09,360
volume to the mount point called LVM.
14131
09:48:06,720 --> 09:48:13,680
Now you can see the logical volume size.
14132
09:48:09,360 --> 09:48:16,880
Now it has been reduced from 5GB to 3GB.
14133
09:48:13,680 --> 09:48:20,400
Okay. This is a you can reduce or you
14134
09:48:16,880 --> 09:48:23,200
can shrink the size of a logical volume.
14135
09:48:20,400 --> 09:48:26,480
Okay. So this flexibility is not
14136
09:48:23,200 --> 09:48:28,960
available in fixed disk partitions. Once
14137
09:48:26,480 --> 09:48:30,800
you create partition that's it. Now you
14138
09:48:28,960 --> 09:48:32,640
don't have a flexibility of modifying
14139
09:48:30,800 --> 09:48:35,596
the partition size or shrinking the
14140
09:48:32,640 --> 09:48:37,840
partition size. So this is possible only
14141
09:48:35,596 --> 09:48:40,480
by using advanced partitioning tool
14142
09:48:37,840 --> 09:48:44,080
called LVM which is nothing but the
14143
09:48:40,480 --> 09:48:46,720
logical volume manager. So let's get
14144
09:48:44,080 --> 09:48:48,640
back to the slides here. So we were
14145
09:48:46,720 --> 09:48:51,840
discussing about like how to reduce or
14146
09:48:48,640 --> 09:48:53,916
shrink the size of a LVM partition or a
14147
09:48:51,840 --> 09:48:56,240
logical volume. It's a five-step
14148
09:48:53,916 --> 09:49:00,240
process. First you have to unmount run
14149
09:48:56,240 --> 09:49:02,400
fsdk run the resize to fs to 3GB or
14150
09:49:00,240 --> 09:49:04,480
whatever required size you want and then
14151
09:49:02,400 --> 09:49:06,640
you run the command lv reduce to reduce
14152
09:49:04,480 --> 09:49:09,680
the logical volume then you can mount
14153
09:49:06,640 --> 09:49:11,436
that particular file system. Okay the
14154
09:49:09,680 --> 09:49:15,040
next question being explain the
14155
09:49:11,436 --> 09:49:18,000
functionality of a root user. Okay. So
14156
09:49:15,040 --> 09:49:20,000
in computing world the super user is a
14157
09:49:18,000 --> 09:49:22,080
special user account used for system
14158
09:49:20,000 --> 09:49:24,320
administration. Depending on the
14159
09:49:22,080 --> 09:49:26,960
operating system the actual name of this
14160
09:49:24,320 --> 09:49:28,320
account might be root or if you talk
14161
09:49:26,960 --> 09:49:32,080
about Windows we call as an
14162
09:49:28,320 --> 09:49:34,800
administrator or admin or supervisor. In
14163
09:49:32,080 --> 09:49:37,200
Unix like computer operating system root
14164
09:49:34,800 --> 09:49:39,916
is the conventional name of the user who
14165
09:49:37,200 --> 09:49:42,800
has all the rights or permissions to all
14166
09:49:39,916 --> 09:49:45,520
the files and programs in all modes.
14167
09:49:42,800 --> 09:49:48,240
Okay. The root user can do many things
14168
09:49:45,520 --> 09:49:50,800
which an ordinary user cannot such as
14169
09:49:48,240 --> 09:49:54,320
changing the ownerships of files binding
14170
09:49:50,800 --> 09:49:56,960
to network ports numbered below,024. So
14171
09:49:54,320 --> 09:50:00,080
root is the default account every time
14172
09:49:56,960 --> 09:50:02,480
Linux is installed. Okay, so there comes
14173
09:50:00,080 --> 09:50:05,680
your question again. What is CLI and
14174
09:50:02,480 --> 09:50:08,080
what is GUI? Okay, CLI is nothing but
14175
09:50:05,680 --> 09:50:11,120
the command line interface is a console
14176
09:50:08,080 --> 09:50:13,200
or textbased representation in which the
14177
09:50:11,120 --> 09:50:16,080
user types the commands to operate the
14178
09:50:13,200 --> 09:50:19,360
software or devices. The main advantage
14179
09:50:16,080 --> 09:50:21,680
of CLI is multiple steps can be executed
14180
09:50:19,360 --> 09:50:25,120
by specifying a single command which is
14181
09:50:21,680 --> 09:50:28,240
not possible in graphical mode. Okay. So
14182
09:50:25,120 --> 09:50:30,240
a GUI which is nothing but the graphical
14183
09:50:28,240 --> 09:50:32,800
user interface is a graphical
14184
09:50:30,240 --> 09:50:34,960
representation in which the users can
14185
09:50:32,800 --> 09:50:38,240
interact with software or devices
14186
09:50:34,960 --> 09:50:42,240
through graphical icons. Okay simple
14187
09:50:38,240 --> 09:50:44,800
definition what is CLI and what is GUI.
14188
09:50:42,240 --> 09:50:47,520
So how can you find out how much memory
14189
09:50:44,800 --> 09:50:50,080
used in Linux operating system? So again
14190
09:50:47,520 --> 09:50:52,640
uh same question here.
14191
09:50:50,080 --> 09:50:54,560
So how exactly you can find out? There
14192
09:50:52,640 --> 09:50:57,520
are many such programs here. The command
14193
09:50:54,560 --> 09:51:00,000
would be free. Okay, the free command is
14194
09:50:57,520 --> 09:51:02,640
the most simple and easy to use command
14195
09:51:00,000 --> 09:51:06,240
to check memory usage on Linux operating
14196
09:51:02,640 --> 09:51:10,160
system. So here is an example free n or
14197
09:51:06,240 --> 09:51:14,240
free- g or you can also cap the contents
14198
09:51:10,160 --> 09:51:16,080
of /pro/me info. This will also give you
14199
09:51:14,240 --> 09:51:18,080
the complete information about your
14200
09:51:16,080 --> 09:51:22,000
memory. You can see here the total
14201
09:51:18,080 --> 09:51:24,080
memory. Okay, memory in free and memory
14202
09:51:22,000 --> 09:51:26,880
available. And you see the used and
14203
09:51:24,080 --> 09:51:28,240
everything here. Okay, you can use this
14204
09:51:26,880 --> 09:51:31,276
command also. You can just cap the
14205
09:51:28,240 --> 09:51:33,840
contents of /pro/mefo.
14206
09:51:31,276 --> 09:51:38,240
Okay, or better the simple command would
14207
09:51:33,840 --> 09:51:40,560
be free - g. Okay. What is swap space
14208
09:51:38,240 --> 09:51:43,436
and what is the typical size for a swap
14209
09:51:40,560 --> 09:51:45,436
partition under Linux operating system?
14210
09:51:43,436 --> 09:51:47,040
So this is also one of the most
14211
09:51:45,436 --> 09:51:50,160
frequently asked questions in
14212
09:51:47,040 --> 09:51:53,120
interviews. So what is a swap space?
14213
09:51:50,160 --> 09:51:56,160
Swap space in Linux is used when the
14214
09:51:53,120 --> 09:51:58,560
amount of physical RAM physical memory
14215
09:51:56,160 --> 09:52:00,880
which is also called as RAM okay is
14216
09:51:58,560 --> 09:52:03,756
full. If the system needs more memory
14217
09:52:00,880 --> 09:52:06,560
resources and the RAM is full inactive
14218
09:52:03,756 --> 09:52:09,120
pages in memory are move to the swap
14219
09:52:06,560 --> 09:52:12,160
space. While swap space can help
14220
09:52:09,120 --> 09:52:13,840
machines with a small amount of RAM it
14221
09:52:12,160 --> 09:52:16,720
should not be considered as a
14222
09:52:13,840 --> 09:52:19,436
replacement for more RAM. Okay. So
14223
09:52:16,720 --> 09:52:22,640
people often get confused between main
14224
09:52:19,436 --> 09:52:25,520
memory and swap memory. Okay. So if the
14225
09:52:22,640 --> 09:52:28,560
CPU doesn't find free space in the
14226
09:52:25,520 --> 09:52:31,756
physical RAM. So what CPU does is it
14227
09:52:28,560 --> 09:52:35,040
just moves all inactive processes, all
14228
09:52:31,756 --> 09:52:37,276
inactive pages from the main memory to
14229
09:52:35,040 --> 09:52:41,360
the swap space. The swap space which is
14230
09:52:37,276 --> 09:52:43,916
created onto the disk. Okay. To ensure
14231
09:52:41,360 --> 09:52:46,800
it improves your system performance.
14232
09:52:43,916 --> 09:52:48,880
Okay. So the preferred size for spap
14233
09:52:46,800 --> 09:52:50,960
partition is twice the amount of
14234
09:52:48,880 --> 09:52:53,276
physical memory. Okay, amount of
14235
09:52:50,960 --> 09:52:55,520
physical memory available on the system.
14236
09:52:53,276 --> 09:52:57,840
If this is not possible then the minimum
14237
09:52:55,520 --> 09:53:02,480
size should be the same as the amount of
14238
09:52:57,840 --> 09:53:05,596
memory installed. Okay, swap is used in
14239
09:53:02,480 --> 09:53:07,360
normally desktops and laptops. Okay, not
14240
09:53:05,596 --> 09:53:10,640
in service because in service we have
14241
09:53:07,360 --> 09:53:14,960
equipped with more RAM. We have 32GB,
14242
09:53:10,640 --> 09:53:17,756
64GB, 128GB. On those systems, there is
14243
09:53:14,960 --> 09:53:21,276
no need to create a swap space. Okay,
14244
09:53:17,756 --> 09:53:23,436
swap space only for low-end machines
14245
09:53:21,276 --> 09:53:26,240
where we don't have enough RAM
14246
09:53:23,436 --> 09:53:28,480
available. Okay, so swap is just to
14247
09:53:26,240 --> 09:53:31,756
improve the performance of the computer,
14248
09:53:28,480 --> 09:53:34,560
nothing more. Okay. And uh how do you
14249
09:53:31,756 --> 09:53:37,120
access partitions under Linux? What is
14250
09:53:34,560 --> 09:53:39,756
the naming convention for devices in
14251
09:53:37,120 --> 09:53:42,720
Linux operating system? Okay, as you can
14252
09:53:39,756 --> 09:53:44,720
see here, I'm running the program foc.
14253
09:53:42,720 --> 09:53:47,360
And you see the first device, I got two
14254
09:53:44,720 --> 09:53:51,596
drives connected to my Linux system. The
14255
09:53:47,360 --> 09:53:54,800
first drive is /dev/ SDA and the second
14256
09:53:51,596 --> 09:53:57,120
driver is /dev/ SDB. See the naming
14257
09:53:54,800 --> 09:54:00,800
conventions here, the conventions used
14258
09:53:57,120 --> 09:54:02,800
for sky drives. In case you have ID hard
14259
09:54:00,800 --> 09:54:07,436
drives, the first convention would be
14260
09:54:02,800 --> 09:54:09,916
/dev/ HDA, HDB, something like that. If
14261
09:54:07,436 --> 09:54:13,520
you got scissy drives or SAS drives, the
14262
09:54:09,916 --> 09:54:15,680
naming conventions would be SDA and SDB.
14263
09:54:13,520 --> 09:54:17,756
And under this first hard drive here, if
14264
09:54:15,680 --> 09:54:22,080
you see, you have the partition starting
14265
09:54:17,756 --> 09:54:26,240
from SDA1 to SDA13. The first partition
14266
09:54:22,080 --> 09:54:29,276
/dev/ SDA1 and the second partition SDA2
14267
09:54:26,240 --> 09:54:32,000
like that. Okay. So these are the naming
14268
09:54:29,276 --> 09:54:34,880
conventions used for your storage
14269
09:54:32,000 --> 09:54:37,520
devices. And this is how exactly you can
14270
09:54:34,880 --> 09:54:40,960
access partitions under Linux operating
14271
09:54:37,520 --> 09:54:43,680
system. Okay, you see here ID hard drive
14272
09:54:40,960 --> 09:54:48,480
starts with H in case you got SAS and
14273
09:54:43,680 --> 09:54:50,880
scissy starts with S, SDA, SDB go on.
14274
09:54:48,480 --> 09:54:53,276
How are hard drives and floppy drives
14275
09:54:50,880 --> 09:54:56,640
referred in Linux? Just now I told you
14276
09:54:53,276 --> 09:54:59,840
right SDA, SDB and for floppy drives it
14277
09:54:56,640 --> 09:55:02,160
would be FD0, FD1. Nowadays nobody
14278
09:54:59,840 --> 09:55:04,800
accessing floppy drives but it would be
14279
09:55:02,160 --> 09:55:07,360
a question in interviews how floppy
14280
09:55:04,800 --> 09:55:10,360
drives would be referred in Linux
14281
09:55:07,360 --> 09:55:10,360
/dev/fd0/dev/fd1
14282
09:55:11,436 --> 09:55:15,680
based on the number of connections you
14283
09:55:13,276 --> 09:55:19,436
have in your system in case of hard
14284
09:55:15,680 --> 09:55:23,040
drives HDA HDB in case of IDE if you
14285
09:55:19,436 --> 09:55:25,680
have scissy or SAS drives SDA SDB
14286
09:55:23,040 --> 09:55:28,000
something like that okay these are the
14287
09:55:25,680 --> 09:55:31,040
naming conventions used for floppy
14288
09:55:28,000 --> 09:55:33,436
drives and hard drives. Similarly, in
14289
09:55:31,040 --> 09:55:35,840
Linux, how are names assigned to
14290
09:55:33,436 --> 09:55:38,160
different serial ports? What we also
14291
09:55:35,840 --> 09:55:40,560
called as communication ports. The
14292
09:55:38,160 --> 09:55:42,320
communication ports are identified as
14293
09:55:40,560 --> 09:55:46,480
/dev/T
14294
09:55:42,320 --> 09:55:49,480
S0 to TTW S1. You see practically here
14295
09:55:46,480 --> 09:55:49,480
ls-l/dev/ttar.
14296
09:55:50,880 --> 09:55:58,240
You see here the communication ports.
14297
09:55:53,756 --> 09:56:00,320
Okay. TT5 S0, TT5 S1. Okay. what we
14298
09:55:58,240 --> 09:56:01,916
normally called as communication ports
14299
09:56:00,320 --> 09:56:04,320
in Windows. Communication one,
14300
09:56:01,916 --> 09:56:06,320
communication two like that. Okay.
14301
09:56:04,320 --> 09:56:08,240
Coming to the next question asking about
14302
09:56:06,320 --> 09:56:10,480
printer ports. How exactly you can
14303
09:56:08,240 --> 09:56:13,916
identify the printer ports in Linux?
14304
09:56:10,480 --> 09:56:17,840
Same thing /dev/lpstar,
14305
09:56:13,916 --> 09:56:22,640
LP0, LP1, LP2. These are the names to
14306
09:56:17,840 --> 09:56:25,680
use for printer ports. Okay.
14307
09:56:22,640 --> 09:56:27,520
And the very basic question asked in
14308
09:56:25,680 --> 09:56:30,400
interviews is what are the kind of
14309
09:56:27,520 --> 09:56:32,720
permissions available in Linux? Okay,
14310
09:56:30,400 --> 09:56:34,640
what are the basic file permissions or
14311
09:56:32,720 --> 09:56:37,040
the directory permissions available in
14312
09:56:34,640 --> 09:56:39,040
Linux? So there are basically three
14313
09:56:37,040 --> 09:56:42,320
levels of file and directory permissions
14314
09:56:39,040 --> 09:56:44,560
in Linux. One is read. Read like users
14315
09:56:42,320 --> 09:56:46,640
only read the files or list the
14316
09:56:44,560 --> 09:56:48,800
directory contents. And the second
14317
09:56:46,640 --> 09:56:51,200
permission would be write. As the name
14318
09:56:48,800 --> 09:56:54,240
suggest, users can write information to
14319
09:56:51,200 --> 09:56:56,800
the file or create files inside the
14320
09:56:54,240 --> 09:56:59,840
directories of a subdirectory. And the
14321
09:56:56,800 --> 09:57:02,880
third permission would be execute. The
14322
09:56:59,840 --> 09:57:05,916
users can run the file or look up a
14323
09:57:02,880 --> 09:57:07,756
specific file within a directory. Okay.
14324
09:57:05,916 --> 09:57:09,916
So besides these you can have a
14325
09:57:07,756 --> 09:57:12,640
combination of all these three levels of
14326
09:57:09,916 --> 09:57:14,640
permissions and two of them or one of
14327
09:57:12,640 --> 09:57:17,360
them some combinations read write
14328
09:57:14,640 --> 09:57:19,360
execute or read write or read execute
14329
09:57:17,360 --> 09:57:22,240
the based on the requirement as an
14330
09:57:19,360 --> 09:57:23,840
administrator I can change permissions.
14331
09:57:22,240 --> 09:57:25,756
Okay basically there are three
14332
09:57:23,840 --> 09:57:28,480
permissions. The three permissions what
14333
09:57:25,756 --> 09:57:31,276
we see here that is read, write and
14334
09:57:28,480 --> 09:57:32,960
execute. Okay, coming to the next
14335
09:57:31,276 --> 09:57:35,916
question like how do you change
14336
09:57:32,960 --> 09:57:39,276
permissions under Linux? So there is a
14337
09:57:35,916 --> 09:57:41,840
command called chod. chod is a command
14338
09:57:39,276 --> 09:57:44,160
to change permissions for files and
14339
09:57:41,840 --> 09:57:46,320
directories. And the permissions can be
14340
09:57:44,160 --> 09:57:48,240
changed in two formats. One is symbolic
14341
09:57:46,320 --> 09:57:51,120
mode and other one would be absolute
14342
09:57:48,240 --> 09:57:54,000
mode. Symbolic mode is nothing but using
14343
09:57:51,120 --> 09:57:58,560
numbers and absolute mode is nothing but
14344
09:57:54,000 --> 09:58:03,040
like using characters. Okay. Like rwx
14345
09:57:58,560 --> 09:58:05,596
or 755 or 644 with help of ch mode you
14346
09:58:03,040 --> 09:58:07,916
can change permissions. Okay, in order
14347
09:58:05,596 --> 09:58:11,680
to change ownerships, you have a command
14348
09:58:07,916 --> 09:58:14,960
like chown and chp in order to change
14349
09:58:11,680 --> 09:58:18,160
ownerships for files and directories.
14350
09:58:14,960 --> 09:58:20,000
Okay, see here the command ch mode is to
14351
09:58:18,160 --> 09:58:22,240
change permissions and if you would like
14352
09:58:20,000 --> 09:58:25,840
to change the ownerships, you can use
14353
09:58:22,240 --> 09:58:28,160
the command ch and chp.
14354
09:58:25,840 --> 09:58:30,800
Okay, on the left pane you can see some
14355
09:58:28,160 --> 09:58:33,276
representation here. User groups others
14356
09:58:30,800 --> 09:58:36,320
and the permissions are read, write and
14357
09:58:33,276 --> 09:58:38,160
execute. Okay, plus is to add
14358
09:58:36,320 --> 09:58:40,880
permission. Minus is to rework
14359
09:58:38,160 --> 09:58:43,436
permission and is equal to to override
14360
09:58:40,880 --> 09:58:45,040
the existing permissions. Okay, the
14361
09:58:43,436 --> 09:58:46,800
permissions can be changed in two
14362
09:58:45,040 --> 09:58:49,436
different modes. Symbolic mode and
14363
09:58:46,800 --> 09:58:52,240
absolute mode. Symbolic using like
14364
09:58:49,436 --> 09:58:55,360
characters are wx. Absolute is using
14365
09:58:52,240 --> 09:58:58,000
numbers. Okay, combination of numbers.
14366
09:58:55,360 --> 09:59:00,800
The read value is four. Write value is
14367
09:58:58,000 --> 09:59:03,040
two. Execute value is one. You can
14368
09:59:00,800 --> 09:59:06,480
either use characters or you can use
14369
09:59:03,040 --> 09:59:10,560
numbers. Okay. Symbolic mode or absolute
14370
09:59:06,480 --> 09:59:13,276
mode. Yes. CH mode 7 0 0. What is seven?
14371
09:59:10,560 --> 09:59:15,596
Read, write, execute applicable for
14372
09:59:13,276 --> 09:59:18,400
owner. Zero means none permissions
14373
09:59:15,596 --> 09:59:21,596
applicable for group. Zero again none.
14374
09:59:18,400 --> 09:59:23,840
And this is applicable for others. Okay.
14375
09:59:21,596 --> 09:59:26,560
And coming to the next question. What
14376
09:59:23,840 --> 09:59:30,160
are symbolic links? Very interesting
14377
09:59:26,560 --> 09:59:32,640
question. Okay, symbolic links. So in
14378
09:59:30,160 --> 09:59:35,680
Linux basically we have two types of
14379
09:59:32,640 --> 09:59:38,800
links. One is symbolic link which is
14380
09:59:35,680 --> 09:59:41,200
also called as the soft link. So
14381
09:59:38,800 --> 09:59:42,960
symbolic link you can always compare. If
14382
09:59:41,200 --> 09:59:46,800
you take an example like in Windows we
14383
09:59:42,960 --> 09:59:49,680
have shortcuts. Okay, we always create a
14384
09:59:46,800 --> 09:59:52,560
desktop shortcuts. Now instead of going
14385
09:59:49,680 --> 09:59:53,916
to the lengthy part or navigating into
14386
09:59:52,560 --> 09:59:56,160
directories into directories and
14387
09:59:53,916 --> 09:59:59,040
directories we can better create a
14388
09:59:56,160 --> 10:00:01,756
shortcut on the desktop okay for easy
14389
09:59:59,040 --> 10:00:04,000
accessing and easy way of interacting
14390
10:00:01,756 --> 10:00:06,480
with the operating system. Similarly in
14391
10:00:04,000 --> 10:00:09,596
Linux it is called as a symbolic links
14392
10:00:06,480 --> 10:00:12,800
or soft links. So this is one special
14393
10:00:09,596 --> 10:00:15,040
kind of file that points to another file
14394
10:00:12,800 --> 10:00:17,840
like I've compared with Windows right we
14395
10:00:15,040 --> 10:00:20,960
have shortcuts but please remember
14396
10:00:17,840 --> 10:00:22,880
symbolic link does not contain the data
14397
10:00:20,960 --> 10:00:25,756
okay symbolic link will not have the
14398
10:00:22,880 --> 10:00:28,320
data all the data we have in the target
14399
10:00:25,756 --> 10:00:30,080
file but not in the shortcut okay and
14400
10:00:28,320 --> 10:00:33,360
what are the benefits of using symbolic
14401
10:00:30,080 --> 10:00:36,160
link it just allows instant access easy
14402
10:00:33,360 --> 10:00:38,560
of access of application or a program
14403
10:00:36,160 --> 10:00:40,720
okay without having to navigate to
14404
10:00:38,560 --> 10:00:42,800
multiple directories here. Let me show
14405
10:00:40,720 --> 10:00:44,560
you one practical example here. For
14406
10:00:42,800 --> 10:00:46,960
example, I just want to see the
14407
10:00:44,560 --> 10:00:48,960
configuration file of my LAN card,
14408
10:00:46,960 --> 10:00:51,520
network interface card. The command
14409
10:00:48,960 --> 10:00:54,240
would be cat/etc/sis
14410
10:00:51,520 --> 10:00:56,000
config network scripts and the
14411
10:00:54,240 --> 10:00:58,400
configuration file would be starting
14412
10:00:56,000 --> 10:01:01,756
like this. This is my configuration file
14413
10:00:58,400 --> 10:01:04,960
for my LAN card03.
14414
10:01:01,756 --> 10:01:07,120
See the path here etc sysconfig network
14415
10:01:04,960 --> 10:01:11,360
scripts. Under this directory we have a
14416
10:01:07,120 --> 10:01:13,520
file called if cfg - np0 s3. Now instead
14417
10:01:11,360 --> 10:01:17,840
what I'll do here I'll create a symbolic
14418
10:01:13,520 --> 10:01:19,916
link. See ln - s is the command. ln
14419
10:01:17,840 --> 10:01:21,596
stands for link. Now what type of link
14420
10:01:19,916 --> 10:01:24,400
I'm creating here? I'm creating a
14421
10:01:21,596 --> 10:01:27,756
symbolic link. The path would be etc
14422
10:01:24,400 --> 10:01:30,880
sysconfig network scripts if ccfgen
14423
10:01:27,756 --> 10:01:33,276
emp3. For this particular file, I'm
14424
10:01:30,880 --> 10:01:36,400
creating a shortcut under my root
14425
10:01:33,276 --> 10:01:39,276
directory with the name called ifcfg.
14426
10:01:36,400 --> 10:01:41,520
Enter. The link has been established.
14427
10:01:39,276 --> 10:01:43,596
Now, instead of viewing the LAN
14428
10:01:41,520 --> 10:01:46,560
information, instead of going to this
14429
10:01:43,596 --> 10:01:48,560
lengthy path better, I can read from the
14430
10:01:46,560 --> 10:01:51,120
shortcut. Now, which one is easy to
14431
10:01:48,560 --> 10:01:52,960
access? Either this one or the from the
14432
10:01:51,120 --> 10:01:56,320
shortcut. I know it is from the
14433
10:01:52,960 --> 10:01:59,360
shortcut. See the properties here ls-l/
14434
10:01:56,320 --> 10:02:02,080
ifcfg because this is exactly pointing
14435
10:01:59,360 --> 10:02:04,800
to the original file the target file
14436
10:02:02,080 --> 10:02:06,960
this is a link file the symbolic link
14437
10:02:04,800 --> 10:02:09,120
file which is pointing to the target
14438
10:02:06,960 --> 10:02:12,080
file now instead of using this lengthy
14439
10:02:09,120 --> 10:02:14,800
part here I can better use my shortcut
14440
10:02:12,080 --> 10:02:17,360
okay so these are called symbolic links
14441
10:02:14,800 --> 10:02:19,680
please remember symbolic link does not
14442
10:02:17,360 --> 10:02:22,000
contain the data all the data we have in
14443
10:02:19,680 --> 10:02:24,560
the target file we don't have anything
14444
10:02:22,000 --> 10:02:27,436
over here Okay. What are the qualities
14445
10:02:24,560 --> 10:02:30,240
of symbolic link? Now, both the files
14446
10:02:27,436 --> 10:02:33,360
will have different iode numbers. We'll
14447
10:02:30,240 --> 10:02:35,520
discuss about iodes. Both files, the
14448
10:02:33,360 --> 10:02:37,680
source file and the target file will
14449
10:02:35,520 --> 10:02:40,080
have different iode numbers. Will have
14450
10:02:37,680 --> 10:02:43,436
different permissions and the different
14451
10:02:40,080 --> 10:02:46,000
size also. Okay. Soft link will always
14452
10:02:43,436 --> 10:02:47,840
have different name. Same content both
14453
10:02:46,000 --> 10:02:50,560
will be having same content but the
14454
10:02:47,840 --> 10:02:53,756
different name. Okay. And remember soft
14455
10:02:50,560 --> 10:02:55,840
links can be created only for files and
14456
10:02:53,756 --> 10:02:58,080
directories. When you compare with hard
14457
10:02:55,840 --> 10:03:00,800
link, hard link can be created only for
14458
10:02:58,080 --> 10:03:02,640
files but not for directories. But soft
14459
10:03:00,800 --> 10:03:05,596
links can be created for files and
14460
10:03:02,640 --> 10:03:07,916
directories. And soft link can cross the
14461
10:03:05,596 --> 10:03:10,640
file systems also. You can establish a
14462
10:03:07,916 --> 10:03:12,720
link between file systems whereas hard
14463
10:03:10,640 --> 10:03:16,080
link you cannot span across file
14464
10:03:12,720 --> 10:03:18,320
systems. Okay, I hope you got me about
14465
10:03:16,080 --> 10:03:21,360
symbolic links here. See the qualities
14466
10:03:18,320 --> 10:03:23,200
of soft links what we have discussed.
14467
10:03:21,360 --> 10:03:25,756
Okay. Both files will have different
14468
10:03:23,200 --> 10:03:28,400
iode numbers, different permissions,
14469
10:03:25,756 --> 10:03:30,880
different size but the same content but
14470
10:03:28,400 --> 10:03:34,560
with a different name. Okay. What are
14471
10:03:30,880 --> 10:03:37,120
hard links? Now in computing a hard link
14472
10:03:34,560 --> 10:03:39,520
is a directory entry that associates a
14473
10:03:37,120 --> 10:03:42,000
name with a file on a file system. All
14474
10:03:39,520 --> 10:03:44,160
directory based file systems must have
14475
10:03:42,000 --> 10:03:47,756
at least one hard link giving the
14476
10:03:44,160 --> 10:03:50,720
original file for each directory. Okay.
14477
10:03:47,756 --> 10:03:52,480
The hard link is usually only used in
14478
10:03:50,720 --> 10:03:55,840
the file system that allows more than
14479
10:03:52,480 --> 10:03:58,160
one hard link for the same file. Okay.
14480
10:03:55,840 --> 10:04:00,880
Hard links can be created only for files
14481
10:03:58,160 --> 10:04:03,520
but not for directories. And hard link
14482
10:04:00,880 --> 10:04:05,436
you cannot span across partitions. It
14483
10:04:03,520 --> 10:04:08,080
should be created within the file
14484
10:04:05,436 --> 10:04:10,320
system. Okay. So these are some of the
14485
10:04:08,080 --> 10:04:13,120
differences between the symbolic links
14486
10:04:10,320 --> 10:04:14,720
and hard links here. Okay. And coming to
14487
10:04:13,120 --> 10:04:16,880
the next question like what is the
14488
10:04:14,720 --> 10:04:19,276
maximum length of a file name under
14489
10:04:16,880 --> 10:04:21,436
Linux. This is also one of the important
14490
10:04:19,276 --> 10:04:24,640
question which is frequently asked in
14491
10:04:21,436 --> 10:04:28,160
Linux interviews. Linux has the maximum
14492
10:04:24,640 --> 10:04:32,080
file length of 255 characters. Okay. For
14493
10:04:28,160 --> 10:04:34,000
most file systems like ext3, ext4. In
14494
10:04:32,080 --> 10:04:37,680
those file systems you can have a file
14495
10:04:34,000 --> 10:04:42,080
up to length of 255 characters. Okay.
14496
10:04:37,680 --> 10:04:44,080
And a maximum path of 4096 characters.
14497
10:04:42,080 --> 10:04:47,680
Okay, what we have discussed here the
14498
10:04:44,080 --> 10:04:50,800
maximum path you can have up to 4096
14499
10:04:47,680 --> 10:04:54,640
characters and one particular file name
14500
10:04:50,800 --> 10:04:56,480
you can have up to 255 characters. Okay,
14501
10:04:54,640 --> 10:04:58,880
coming to the next question. Which type
14502
10:04:56,480 --> 10:05:00,960
of files are prefixed with a dot? So
14503
10:04:58,880 --> 10:05:04,400
generally in Linux and Unix operating
14504
10:05:00,960 --> 10:05:06,480
system if any objects starts with dot or
14505
10:05:04,400 --> 10:05:09,120
prefixed with dot those are called
14506
10:05:06,480 --> 10:05:11,436
hidden files. I'm under super user home
14507
10:05:09,120 --> 10:05:14,960
directory. If I want to see all the
14508
10:05:11,436 --> 10:05:17,436
files here, you can run a command ls- a
14509
10:05:14,960 --> 10:05:19,840
including all the files. You see one
14510
10:05:17,436 --> 10:05:22,320
particular file prefixed with dot. So
14511
10:05:19,840 --> 10:05:24,560
this is exactly a hidden file. This is a
14512
10:05:22,320 --> 10:05:26,320
regular file which is not starting with
14513
10:05:24,560 --> 10:05:28,240
dot. And this is a file which is
14514
10:05:26,320 --> 10:05:31,680
prefixed with dot. This is the hidden
14515
10:05:28,240 --> 10:05:34,000
file. Okay. And you see a directory also
14516
10:05:31,680 --> 10:05:36,160
which is prefixed with dot. And you see
14517
10:05:34,000 --> 10:05:39,040
the regular directory. Public is the
14518
10:05:36,160 --> 10:05:42,480
regular directory. dot cache is the
14519
10:05:39,040 --> 10:05:44,080
hidden directory. So these files can be
14520
10:05:42,480 --> 10:05:47,040
sometimes called as the configuration
14521
10:05:44,080 --> 10:05:49,756
files also which holds some important
14522
10:05:47,040 --> 10:05:52,960
data. If you see one example here cat
14523
10:05:49,756 --> 10:05:55,596
bash rc some aliases has been mentioned
14524
10:05:52,960 --> 10:05:58,400
here for that particular environment.
14525
10:05:55,596 --> 10:06:00,560
Right? So mostly in Linux and Unix
14526
10:05:58,400 --> 10:06:03,200
operating system if any objects begins
14527
10:06:00,560 --> 10:06:05,276
with dot those are called hidden files
14528
10:06:03,200 --> 10:06:07,520
and hidden directories.
14529
10:06:05,276 --> 10:06:10,720
Coming to the next question like what is
14530
10:06:07,520 --> 10:06:13,840
a virtual desktop? Virtual desktop like
14531
10:06:10,720 --> 10:06:15,436
whenever a user's desktop environment
14532
10:06:13,840 --> 10:06:17,916
when you talk about users desktop
14533
10:06:15,436 --> 10:06:22,720
environment like icons, wallpapers,
14534
10:06:17,916 --> 10:06:24,480
windows like folders, toolbars, okay, is
14535
10:06:22,720 --> 10:06:27,120
stored in a remote server rather than on
14536
10:06:24,480 --> 10:06:29,436
a local PC then it's exactly called as a
14537
10:06:27,120 --> 10:06:31,916
virtual desktop. Okay. The desktop
14538
10:06:29,436 --> 10:06:33,756
virtualization software separates the
14539
10:06:31,916 --> 10:06:36,240
physical machine from the software and
14540
10:06:33,756 --> 10:06:39,360
presents an isolated operating system
14541
10:06:36,240 --> 10:06:41,916
for users. Desktop virtualization tools
14542
10:06:39,360 --> 10:06:45,040
include like Microsoft virtual PC,
14543
10:06:41,916 --> 10:06:48,000
VMware Workstation and Parallel Desktop
14544
10:06:45,040 --> 10:06:49,680
for Mac operating system.
14545
10:06:48,000 --> 10:06:51,916
The main benefits of desktop
14546
10:06:49,680 --> 10:06:54,480
virtualization, it just includes like
14547
10:06:51,916 --> 10:06:57,680
cost savings because resources can be
14548
10:06:54,480 --> 10:06:59,916
shared and allocated as a needed basis
14549
10:06:57,680 --> 10:07:02,560
and more efficient use of resources and
14550
10:06:59,916 --> 10:07:06,000
energy. Improved data integrity because
14551
10:07:02,560 --> 10:07:08,880
backup is centralized and centralized
14552
10:07:06,000 --> 10:07:10,960
administration. Okay, this is about the
14553
10:07:08,880 --> 10:07:14,080
virtual desktop. What we have discussed
14554
10:07:10,960 --> 10:07:17,040
the benefits of virtual desktops. Okay.
14555
10:07:14,080 --> 10:07:19,916
And uh what does a nameless empty
14556
10:07:17,040 --> 10:07:23,040
directory represents? Empty directory as
14557
10:07:19,916 --> 10:07:24,800
you know empty directory name serves as
14558
10:07:23,040 --> 10:07:27,756
a nameless base for the Linux file
14559
10:07:24,800 --> 10:07:30,320
system. This serves as a attachment for
14560
10:07:27,756 --> 10:07:34,160
other directories, files, drives and
14561
10:07:30,320 --> 10:07:36,240
devices. Okay, empty directory. How can
14562
10:07:34,160 --> 10:07:39,200
you create folders and files using the
14563
10:07:36,240 --> 10:07:41,360
terminal? So in Linux operating system
14564
10:07:39,200 --> 10:07:44,400
if you want to create a directory you
14565
10:07:41,360 --> 10:07:47,520
can use the command mkdir and to create
14566
10:07:44,400 --> 10:07:50,720
files we have many such programs for
14567
10:07:47,520 --> 10:07:53,840
example like vi cat command or you can
14568
10:07:50,720 --> 10:07:57,680
use graphical based editors like gedit
14569
10:07:53,840 --> 10:08:00,960
nedit pico nano you have many such
14570
10:07:57,680 --> 10:08:03,596
programs to create files okay you even
14571
10:08:00,960 --> 10:08:05,840
have line editors screen based editors
14572
10:08:03,596 --> 10:08:08,000
graphical based editors to create files
14573
10:08:05,840 --> 10:08:09,756
in Linux and Unix operating system.
14574
10:08:08,000 --> 10:08:11,756
Okay. But if you want to create a
14575
10:08:09,756 --> 10:08:15,680
directory, you want to create a folder,
14576
10:08:11,756 --> 10:08:16,960
use the command mkdir. Okay. And uh next
14577
10:08:15,680 --> 10:08:18,960
question would be what are the different
14578
10:08:16,960 --> 10:08:20,720
ways to view the contents of a file.
14579
10:08:18,960 --> 10:08:22,560
Okay. To view the contents of a file,
14580
10:08:20,720 --> 10:08:25,120
once again we have many such programs
14581
10:08:22,560 --> 10:08:27,596
here. We have many such inbuilt Linux
14582
10:08:25,120 --> 10:08:29,840
programs. You can either use graphical
14583
10:08:27,596 --> 10:08:33,596
based editors or textbased editors.
14584
10:08:29,840 --> 10:08:35,840
Something like cat, vi, vim, gedit. You
14585
10:08:33,596 --> 10:08:38,720
have pico nano. you have many such
14586
10:08:35,840 --> 10:08:41,276
programs. Okay. What are environment
14587
10:08:38,720 --> 10:08:42,800
variables? One important and interesting
14588
10:08:41,276 --> 10:08:45,596
question. What are environment
14589
10:08:42,800 --> 10:08:48,080
variables? Environment variables are
14590
10:08:45,596 --> 10:08:50,960
global settings that control the
14591
10:08:48,080 --> 10:08:53,276
behavior of a shell. Okay. Software
14592
10:08:50,960 --> 10:08:55,916
packages installed in Linux and other
14593
10:08:53,276 --> 10:08:58,080
processes. The path where the various
14594
10:08:55,916 --> 10:09:00,560
softares are installed will be stored as
14595
10:08:58,080 --> 10:09:02,880
a environment variables. Environment
14596
10:09:00,560 --> 10:09:05,436
variables are used to pass information
14597
10:09:02,880 --> 10:09:07,520
into processes that are spawned from the
14598
10:09:05,436 --> 10:09:09,916
shell. Shell variables and variables
14599
10:09:07,520 --> 10:09:12,720
that are contained exclusively within
14600
10:09:09,916 --> 10:09:15,276
the shell in which they were set or
14601
10:09:12,720 --> 10:09:17,040
defined while interacting with your
14602
10:09:15,276 --> 10:09:19,040
server through a shell session. There
14603
10:09:17,040 --> 10:09:21,520
are many pieces of information that a
14604
10:09:19,040 --> 10:09:25,200
shell compiles to determine its behavior
14605
10:09:21,520 --> 10:09:27,200
and access to resources. Some examples
14606
10:09:25,200 --> 10:09:29,200
if you want to see in environment
14607
10:09:27,200 --> 10:09:31,680
variables also we have different types.
14608
10:09:29,200 --> 10:09:34,240
We have system variables and we have
14609
10:09:31,680 --> 10:09:36,000
userdefined variables. In the case if
14610
10:09:34,240 --> 10:09:39,120
you want to see the system variables,
14611
10:09:36,000 --> 10:09:41,436
you can run the command env. ENV is a
14612
10:09:39,120 --> 10:09:44,000
command to display all the environment
14613
10:09:41,436 --> 10:09:46,720
variables which are set by default with
14614
10:09:44,000 --> 10:09:48,880
the operating system. Okay, one good
14615
10:09:46,720 --> 10:09:52,720
example of an environment variable would
14616
10:09:48,880 --> 10:09:55,520
be path. Okay, this is a system variable
14617
10:09:52,720 --> 10:09:57,520
which has the information about the path
14618
10:09:55,520 --> 10:10:00,560
of all your binaries, all your
14619
10:09:57,520 --> 10:10:02,080
executables. Okay, if you take one more
14620
10:10:00,560 --> 10:10:04,560
example, you see the environment
14621
10:10:02,080 --> 10:10:07,916
variable called home. What is the super
14622
10:10:04,560 --> 10:10:10,880
user home directory which is /root?
14623
10:10:07,916 --> 10:10:13,596
Okay, these are some examples here.
14624
10:10:10,880 --> 10:10:16,880
Environment variables. Okay, system
14625
10:10:13,596 --> 10:10:19,120
variables and userdefined variables.
14626
10:10:16,880 --> 10:10:21,520
What is the functionality of a tap key
14627
10:10:19,120 --> 10:10:23,916
in CLI? We were discussing about the
14628
10:10:21,520 --> 10:10:26,560
features of bash shell, right? I was
14629
10:10:23,916 --> 10:10:29,756
talking about command aliasing, command
14630
10:10:26,560 --> 10:10:31,756
completion by using tap keys and command
14631
10:10:29,756 --> 10:10:33,520
history. Let me show you practically
14632
10:10:31,756 --> 10:10:36,320
here in the current working directory
14633
10:10:33,520 --> 10:10:39,040
called /root. I have a file called
14634
10:10:36,320 --> 10:10:41,200
anaconda case. Cfg. Let's take one
14635
10:10:39,040 --> 10:10:44,080
example here. There is a file called
14636
10:10:41,200 --> 10:10:46,400
anaconda case. CFG. If I want to see the
14637
10:10:44,080 --> 10:10:49,436
contents of this file, I can run a
14638
10:10:46,400 --> 10:10:52,240
program called less or more or cat. You
14639
10:10:49,436 --> 10:10:55,756
can do anything here. But I have to type
14640
10:10:52,240 --> 10:10:58,560
the complete file name case.cfg. Rather
14641
10:10:55,756 --> 10:11:01,040
what I'll do here? I'll simply type few
14642
10:10:58,560 --> 10:11:02,880
letters. I'll use the tab key here.
14643
10:11:01,040 --> 10:11:06,320
Automatically the file name would be
14644
10:11:02,880 --> 10:11:08,480
completed. See cat anaconda case. CFG.
14645
10:11:06,320 --> 10:11:11,200
I'm not typing the complete file name.
14646
10:11:08,480 --> 10:11:14,320
I'm just using a few letters and then
14647
10:11:11,200 --> 10:11:16,160
I'm using the tap keys. Enter to see the
14648
10:11:14,320 --> 10:11:18,480
contents of this particular file.
14649
10:11:16,160 --> 10:11:21,276
Similarly, there are many programs in
14650
10:11:18,480 --> 10:11:23,916
Linux starts with the character C. I'll
14651
10:11:21,276 --> 10:11:27,120
type C here. I'll use the tap key. I can
14652
10:11:23,916 --> 10:11:29,520
see with the C letter, I have 162
14653
10:11:27,120 --> 10:11:32,080
possibilities. That means I have 162
14654
10:11:29,520 --> 10:11:35,436
programs here. You see one such program
14655
10:11:32,080 --> 10:11:38,240
called CAT. If you want to see CA, use
14656
10:11:35,436 --> 10:11:40,720
the tap key here with the CA. We have
14657
10:11:38,240 --> 10:11:43,360
this many possibilities here. One good
14658
10:11:40,720 --> 10:11:46,080
example is cat. One good example would
14659
10:11:43,360 --> 10:11:48,960
be calendar. Okay. So these are the
14660
10:11:46,080 --> 10:11:51,120
features of the bash shell. Okay. To
14661
10:11:48,960 --> 10:11:53,840
complete a command or to complete a file
14662
10:11:51,120 --> 10:11:56,160
name or the directory name.
14663
10:11:53,840 --> 10:11:58,080
Okay. What is redirection in Linux? This
14664
10:11:56,160 --> 10:12:01,840
is also one of the frequently asked
14665
10:11:58,080 --> 10:12:05,200
questions in Linux share. Okay. So what
14666
10:12:01,840 --> 10:12:07,520
is exactly a redirection? So in Linux
14667
10:12:05,200 --> 10:12:10,080
redirection is used to pass the output
14668
10:12:07,520 --> 10:12:12,080
of one operation as input to another
14669
10:12:10,080 --> 10:12:15,276
operation in the same command. If you
14670
10:12:12,080 --> 10:12:18,080
see one example here as an administrator
14671
10:12:15,276 --> 10:12:19,840
I would like to find out like the users
14672
10:12:18,080 --> 10:12:22,320
who logged in with my operating system
14673
10:12:19,840 --> 10:12:24,640
who currently using my operating system.
14674
10:12:22,320 --> 10:12:28,560
I can run the command called W. With the
14675
10:12:24,640 --> 10:12:31,120
W I can have all this information. Okay.
14676
10:12:28,560 --> 10:12:32,960
Since when my PC is up and running,
14677
10:12:31,120 --> 10:12:35,200
okay, for how long a PC is up and
14678
10:12:32,960 --> 10:12:37,040
running, how many users are connected
14679
10:12:35,200 --> 10:12:39,276
and what is the load average of my
14680
10:12:37,040 --> 10:12:41,680
computer? And you see the remaining
14681
10:12:39,276 --> 10:12:43,596
information here, the users, the
14682
10:12:41,680 --> 10:12:45,520
terminal they logged in, from which
14683
10:12:43,596 --> 10:12:48,800
system they logged in, you see the login
14684
10:12:45,520 --> 10:12:50,800
time, you see the idle, the JCPU, PCPU,
14685
10:12:48,800 --> 10:12:53,436
and what exactly they're doing, what
14686
10:12:50,800 --> 10:12:56,320
commands they're executing. Okay, I just
14687
10:12:53,436 --> 10:12:58,880
want to send this report to one of my
14688
10:12:56,320 --> 10:13:01,520
lead manager so that he can have this
14689
10:12:58,880 --> 10:13:03,756
information here. W and I would like to
14690
10:13:01,520 --> 10:13:05,916
save this particular information in one
14691
10:13:03,756 --> 10:13:08,800
particular file. So this is exactly
14692
10:13:05,916 --> 10:13:10,640
called as a redirection. Okay. So
14693
10:13:08,800 --> 10:13:14,240
redirection is nothing but which is used
14694
10:13:10,640 --> 10:13:17,360
to pass the output of W command. Okay.
14695
10:13:14,240 --> 10:13:20,800
Output of one operation will be the
14696
10:13:17,360 --> 10:13:23,040
input for another operation. Okay. W
14697
10:13:20,800 --> 10:13:25,680
will display all this information and
14698
10:13:23,040 --> 10:13:28,320
this will pass to this particular file.
14699
10:13:25,680 --> 10:13:30,800
See cat log all this information has
14700
10:13:28,320 --> 10:13:33,276
been passed here. This is exactly called
14701
10:13:30,800 --> 10:13:36,640
as a redirector. The greater than
14702
10:13:33,276 --> 10:13:38,960
symbol. Okay. It is called as the
14703
10:13:36,640 --> 10:13:41,520
redirector. The redirector symbol. The
14704
10:13:38,960 --> 10:13:44,800
greater than symbol. Okay. They give one
14705
10:13:41,520 --> 10:13:47,040
more examples here. The cat files file
14706
10:13:44,800 --> 10:13:51,040
one file two. The contents of file one
14707
10:13:47,040 --> 10:13:53,596
file two will be in file three. Okay, if
14708
10:13:51,040 --> 10:13:55,596
file three already exist, the file 3
14709
10:13:53,596 --> 10:13:57,040
would be overwritten. And if you don't
14710
10:13:55,596 --> 10:14:00,000
want to overwritten, if you want to
14711
10:13:57,040 --> 10:14:03,916
append, you use double redirecting to.
14712
10:14:00,000 --> 10:14:06,480
Okay. And uh what is gp? So this command
14713
10:14:03,916 --> 10:14:09,040
is used for searching for a particular
14714
10:14:06,480 --> 10:14:11,276
string or you can also call as a word
14715
10:14:09,040 --> 10:14:13,840
searching for particular word in a text
14716
10:14:11,276 --> 10:14:16,000
file. Okay. It also supports
14717
10:14:13,840 --> 10:14:17,596
patternbased searching. The pattern
14718
10:14:16,000 --> 10:14:20,400
based searching is done by including
14719
10:14:17,596 --> 10:14:24,080
options and parameters in the command.
14720
10:14:20,400 --> 10:14:26,880
Okay. One such example is the command is
14721
10:14:24,080 --> 10:14:29,276
grab. I have one file here. The file
14722
10:14:26,880 --> 10:14:32,320
called testing. In this particular file,
14723
10:14:29,276 --> 10:14:34,320
I have some words and characters and
14724
10:14:32,320 --> 10:14:37,120
numbers here. I would like to grab this
14725
10:14:34,320 --> 10:14:39,200
word. The command is g. The word you
14726
10:14:37,120 --> 10:14:43,200
want to search for from the file called
14727
10:14:39,200 --> 10:14:45,520
testing. see gp the string or the word
14728
10:14:43,200 --> 10:14:48,320
you want to search for from the file
14729
10:14:45,520 --> 10:14:50,560
called testing here. Okay, if you want
14730
10:14:48,320 --> 10:14:52,960
to see with the line numbers, you can
14731
10:14:50,560 --> 10:14:55,520
pass an argument called hyphen n. At
14732
10:14:52,960 --> 10:14:58,640
line number 17, I have the word called
14733
10:14:55,520 --> 10:15:01,200
sd. If you want to see the count of the
14734
10:14:58,640 --> 10:15:04,720
word, you can use an argument called
14735
10:15:01,200 --> 10:15:06,720
hyphen c. I just have only one word
14736
10:15:04,720 --> 10:15:08,880
called sd in the file called testing.
14737
10:15:06,720 --> 10:15:11,916
the count like this. We have many such
14738
10:15:08,880 --> 10:15:14,000
arguments in GP. Okay. The pattern based
14739
10:15:11,916 --> 10:15:16,880
searching is also possible in GP
14740
10:15:14,000 --> 10:15:19,276
command. Okay. And coming to the next
14741
10:15:16,880 --> 10:15:21,916
question like how to terminate on
14742
10:15:19,276 --> 10:15:24,640
ongoing process in Linux here. So in
14743
10:15:21,916 --> 10:15:27,756
Linux every process in Linux operating
14744
10:15:24,640 --> 10:15:30,400
system is identified by a Unix process
14745
10:15:27,756 --> 10:15:33,040
which is called as a P ID number. Okay.
14746
10:15:30,400 --> 10:15:35,520
P ID is nothing but the process ID. To
14747
10:15:33,040 --> 10:15:37,840
terminate any process, we can use the
14748
10:15:35,520 --> 10:15:40,560
command kill. You can either use the
14749
10:15:37,840 --> 10:15:43,520
process name or you can use the process
14750
10:15:40,560 --> 10:15:45,596
ID. Okay, you see the command kill. And
14751
10:15:43,520 --> 10:15:48,080
if you want to terminate all process at
14752
10:15:45,596 --> 10:15:50,320
once, you can use the command kill zero.
14753
10:15:48,080 --> 10:15:53,040
Okay, it shouldn't be executed on
14754
10:15:50,320 --> 10:15:55,200
production environments. Kill zero. Not
14755
10:15:53,040 --> 10:15:57,680
recommended command but only for
14756
10:15:55,200 --> 10:16:01,680
information sake. And how to insert
14757
10:15:57,680 --> 10:16:03,436
comments in command prompt? So this is a
14758
10:16:01,680 --> 10:16:06,320
very basic question. Comments are
14759
10:16:03,436 --> 10:16:09,200
inserted by using the hash symbol before
14760
10:16:06,320 --> 10:16:11,596
the comment text. You see any such
14761
10:16:09,200 --> 10:16:15,000
configuration file for example if you
14762
10:16:11,596 --> 10:16:15,000
take /c/grub.com
14763
10:16:15,120 --> 10:16:20,160
or /c/profile
14764
10:16:17,916 --> 10:16:22,400
for example. Okay you see the comments
14765
10:16:20,160 --> 10:16:25,596
here. The comments can be provided by
14766
10:16:22,400 --> 10:16:28,320
using the hash symbols. So these are the
14767
10:16:25,596 --> 10:16:31,756
commented lines and these are called
14768
10:16:28,320 --> 10:16:33,680
unccommented lines. Okay. So, can you
14769
10:16:31,756 --> 10:16:36,400
insert several commands in a single
14770
10:16:33,680 --> 10:16:39,200
command line entry? If so, then how?
14771
10:16:36,400 --> 10:16:42,000
It's a very good question. So, this is
14772
10:16:39,200 --> 10:16:44,560
also called as a command chaining. Like
14773
10:16:42,000 --> 10:16:48,960
you can execute multiple commands one by
14774
10:16:44,560 --> 10:16:51,040
one. Okay. By using a semicolon. Okay.
14775
10:16:48,960 --> 10:16:53,596
If I give you one practical example
14776
10:16:51,040 --> 10:16:55,840
here, the first thing is I would like to
14777
10:16:53,596 --> 10:16:58,240
create a directory called directory 1.
14778
10:16:55,840 --> 10:16:59,840
And then I want to go to this directory.
14779
10:16:58,240 --> 10:17:02,320
Then under this directory I would like
14780
10:16:59,840 --> 10:17:05,040
to create all these files. So this is
14781
10:17:02,320 --> 10:17:08,320
called command chaining. One after the
14782
10:17:05,040 --> 10:17:10,000
other the commands would be executed.
14783
10:17:08,320 --> 10:17:12,240
The first command is to create a
14784
10:17:10,000 --> 10:17:14,160
directory and the second command to
14785
10:17:12,240 --> 10:17:16,560
execute a directory. Under this
14786
10:17:14,160 --> 10:17:19,756
directory I'm creating all these files
14787
10:17:16,560 --> 10:17:21,840
with the names called J, K and L. Okay,
14788
10:17:19,756 --> 10:17:24,480
this is exactly called the series of
14789
10:17:21,840 --> 10:17:26,880
commands in a single entry. You go to
14790
10:17:24,480 --> 10:17:29,840
this directory. See the files has been
14791
10:17:26,880 --> 10:17:32,160
created here. Okay. Write a command that
14792
10:17:29,840 --> 10:17:34,160
will display all the txt files along
14793
10:17:32,160 --> 10:17:36,480
with its permissions.
14794
10:17:34,160 --> 10:17:38,800
Okay. Write a command that will display
14795
10:17:36,480 --> 10:17:42,240
all the txt files. Means we have to use
14796
10:17:38,800 --> 10:17:46,160
the regular expressions. And the common
14797
10:17:42,240 --> 10:17:48,320
extension we have to use is txt. So I'll
14798
10:17:46,160 --> 10:17:51,040
use the command ls-
14799
10:17:48,320 --> 10:17:53,596
al.txt.
14800
10:17:51,040 --> 10:17:56,160
Okay. So in this particular directory I
14801
10:17:53,596 --> 10:17:57,756
don't have anything here with start.txt
14802
10:17:56,160 --> 10:18:00,720
but this would be the command. The
14803
10:17:57,756 --> 10:18:03,360
command is ls- alt
14804
10:18:00,720 --> 10:18:05,360
txt. It would display all the files
14805
10:18:03,360 --> 10:18:09,680
including hidden files with the
14806
10:18:05,360 --> 10:18:12,080
properties. Okay see here I got gita.txt
14807
10:18:09,680 --> 10:18:15,520
report.txt along with the properties
14808
10:18:12,080 --> 10:18:16,960
here. Okay. And the next question would
14809
10:18:15,520 --> 10:18:19,360
you write a command that will look for
14810
10:18:16,960 --> 10:18:22,640
files with .txt extension and has the
14811
10:18:19,360 --> 10:18:25,360
occurrence of the string edurea in it.
14812
10:18:22,640 --> 10:18:27,436
Okay. So we have to use combination of
14813
10:18:25,360 --> 10:18:30,320
commands here and that combination would
14814
10:18:27,436 --> 10:18:33,040
be I'll give an example here of find
14815
10:18:30,320 --> 10:18:35,756
forward slash search from the complete
14816
10:18:33,040 --> 10:18:39,596
directory. Here I would like to search
14817
10:18:35,756 --> 10:18:42,320
the txt files here. From the txt files I
14818
10:18:39,596 --> 10:18:45,520
would like to search for a word pattern
14819
10:18:42,320 --> 10:18:48,400
called edureka. Okay, the combination of
14820
10:18:45,520 --> 10:18:51,360
commands here. First, it would find all
14821
10:18:48,400 --> 10:18:53,840
the files which has the extension txt
14822
10:18:51,360 --> 10:18:56,480
and then using the advanced command
14823
10:18:53,840 --> 10:18:58,720
called x arguments, I'm running a
14824
10:18:56,480 --> 10:19:00,400
command called gre.
14825
10:18:58,720 --> 10:19:05,120
I'm searching for the word pattern
14826
10:19:00,400 --> 10:19:08,320
called edureka. Okay, find will list all
14827
10:19:05,120 --> 10:19:10,960
the files with extension.xt and gp is
14828
10:19:08,320 --> 10:19:13,436
used to search for the string edurea.
14829
10:19:10,960 --> 10:19:16,560
This is how you can do it. Same thing
14830
10:19:13,436 --> 10:19:18,400
how to find the status of a process. If
14831
10:19:16,560 --> 10:19:20,800
you want to find the status of a process
14832
10:19:18,400 --> 10:19:24,800
in Linux operating system, you can run
14833
10:19:20,800 --> 10:19:27,596
the command called ps- aux.
14834
10:19:24,800 --> 10:19:31,520
Okay. So you see the status here the
14835
10:19:27,596 --> 10:19:34,000
status of a process. If it is s it is
14836
10:19:31,520 --> 10:19:36,560
interruptible sleep state. That means it
14837
10:19:34,000 --> 10:19:39,596
is waiting for an event to complete.
14838
10:19:36,560 --> 10:19:42,320
Okay. If you find D somewhere here D
14839
10:19:39,596 --> 10:19:44,960
that is uninterruptible sleep state
14840
10:19:42,320 --> 10:19:48,320
usually it is waiting for IO operation
14841
10:19:44,960 --> 10:19:51,120
to complete. If it is R that is a
14842
10:19:48,320 --> 10:19:53,680
running state. If it is Z that is
14843
10:19:51,120 --> 10:19:57,040
nothing but the defunct process which is
14844
10:19:53,680 --> 10:20:00,080
also called as a zombie process. Okay.
14845
10:19:57,040 --> 10:20:03,040
The process which is terminated but not
14846
10:20:00,080 --> 10:20:06,320
reaped by its parent. If it is T all of
14847
10:20:03,040 --> 10:20:09,120
you that is it is a stopped state either
14848
10:20:06,320 --> 10:20:12,240
by a job control signal or anything it
14849
10:20:09,120 --> 10:20:14,240
can be okay you can also see some code
14850
10:20:12,240 --> 10:20:17,916
meaning here you have the greater than
14851
10:20:14,240 --> 10:20:19,916
symbol and you have n you have l there a
14852
10:20:17,916 --> 10:20:22,480
greater than symbol is nothing but the
14853
10:20:19,916 --> 10:20:25,840
process which is of high priority you
14854
10:20:22,480 --> 10:20:28,560
see here okay interruptible sleep state
14855
10:20:25,840 --> 10:20:30,880
which is of high priority if it is n
14856
10:20:28,560 --> 10:20:33,756
here somewhere you see n here n is
14857
10:20:30,880 --> 10:20:36,720
nothing But the low priority if it is L
14858
10:20:33,756 --> 10:20:39,120
means the process where the pages has
14859
10:20:36,720 --> 10:20:41,200
been logged into memory. Okay. Like this
14860
10:20:39,120 --> 10:20:45,756
you can find out the process states by
14861
10:20:41,200 --> 10:20:47,596
using the command ps a ux the status of
14862
10:20:45,756 --> 10:20:51,040
a process. You should look into this
14863
10:20:47,596 --> 10:20:53,520
column the status of a process.
14864
10:20:51,040 --> 10:20:56,640
Okay. And uh what is the command to
14865
10:20:53,520 --> 10:20:58,080
calculate the size of a folder?
14866
10:20:56,640 --> 10:21:00,000
This is also one of the important
14867
10:20:58,080 --> 10:21:02,800
question and you can find out with the
14868
10:21:00,000 --> 10:21:05,916
command du which is nothing but the
14869
10:21:02,800 --> 10:21:08,880
directory usage and with the arguments
14870
10:21:05,916 --> 10:21:11,756
hyphen sh of the directory boot. You see
14871
10:21:08,880 --> 10:21:15,596
for the directory boot it is occupied
14872
10:21:11,756 --> 10:21:18,000
135 MB. Okay. The command du is to find
14873
10:21:15,596 --> 10:21:20,960
out the directory usage of a particular
14874
10:21:18,000 --> 10:21:22,960
directory. Okay. How to check the memory
14875
10:21:20,960 --> 10:21:27,840
status of the system? The command is
14876
10:21:22,960 --> 10:21:30,800
free m or free- g. Okay. same thing and
14877
10:21:27,840 --> 10:21:32,720
uh how to login as root in Linux from
14878
10:21:30,800 --> 10:21:35,040
the terminal. I've already logged in as
14879
10:21:32,720 --> 10:21:38,080
a root here. Let's say for example I
14880
10:21:35,040 --> 10:21:40,240
have a user called Edureka.
14881
10:21:38,080 --> 10:21:43,596
This is a user logged in with the user
14882
10:21:40,240 --> 10:21:46,720
Edureka. I want to gain access to super
14883
10:21:43,596 --> 10:21:48,960
user. Okay. I want to login as root.
14884
10:21:46,720 --> 10:21:52,080
Simple. I can run the command pseudo
14885
10:21:48,960 --> 10:21:54,000
su-en and uh I think I don't have sudos
14886
10:21:52,080 --> 10:21:56,720
configured here. I'll simply run the
14887
10:21:54,000 --> 10:21:59,276
command su-en and then I need to provide
14888
10:21:56,720 --> 10:22:02,800
a super user password. Then I can login
14889
10:21:59,276 --> 10:22:05,596
as a root. See here the prompt has been
14890
10:22:02,800 --> 10:22:08,160
changed from the dollar sign to the hash
14891
10:22:05,596 --> 10:22:11,436
prompt. Dollar sign is the prompt
14892
10:22:08,160 --> 10:22:14,160
provided for all users and the hash
14893
10:22:11,436 --> 10:22:17,520
prompt is the prompt only provided for
14894
10:22:14,160 --> 10:22:20,800
super user. Okay. The command su su
14895
10:22:17,520 --> 10:22:23,360
stands for substitute user with the user
14896
10:22:20,800 --> 10:22:27,040
edureka. I gained access to the
14897
10:22:23,360 --> 10:22:29,680
operating system as root user. Okay,
14898
10:22:27,040 --> 10:22:31,520
like this you can do the command su. And
14899
10:22:29,680 --> 10:22:33,200
the next question is how can you run a
14900
10:22:31,520 --> 10:22:35,596
Linux program in the background
14901
10:22:33,200 --> 10:22:37,520
simultaneously when you start your Linux
14902
10:22:35,596 --> 10:22:39,756
server? This is a very very important
14903
10:22:37,520 --> 10:22:42,080
question and this is frequently asked in
14904
10:22:39,756 --> 10:22:44,960
interviews and the command would be no
14905
10:22:42,080 --> 10:22:47,120
hub. Okay, the command is no hub. By
14906
10:22:44,960 --> 10:22:49,436
using the nohub command, the process
14907
10:22:47,120 --> 10:22:52,240
will run in the background. Okay, any
14908
10:22:49,436 --> 10:22:54,720
process which receives the NOHUB signal,
14909
10:22:52,240 --> 10:22:57,276
okay, will be terminated when you log
14910
10:22:54,720 --> 10:22:58,560
out the program. Okay, until then the
14911
10:22:57,276 --> 10:23:00,960
process would be running in the
14912
10:22:58,560 --> 10:23:04,080
background all the time. Okay, please
14913
10:23:00,960 --> 10:23:07,040
remember the command would be no hub.
14914
10:23:04,080 --> 10:23:09,916
Okay, by default it just plays the
14915
10:23:07,040 --> 10:23:11,916
process in the background. Which demon
14916
10:23:09,916 --> 10:23:14,160
tracks events on your computer? Events
14917
10:23:11,916 --> 10:23:16,880
on a Linux system. Okay, we have the
14918
10:23:14,160 --> 10:23:19,840
demons like cyst log D. We have demons
14919
10:23:16,880 --> 10:23:21,840
like R sys log. We have so many tracking
14920
10:23:19,840 --> 10:23:24,800
events in Linux and Unix operating
14921
10:23:21,840 --> 10:23:28,720
system. Okay, the answer should be cyst
14922
10:23:24,800 --> 10:23:31,916
log D or R sys log. Okay, so what is
14923
10:23:28,720 --> 10:23:34,160
partial backup? So partial backup is
14924
10:23:31,916 --> 10:23:35,916
nothing but a type of backup where the
14925
10:23:34,160 --> 10:23:38,480
complete operating system is not taken
14926
10:23:35,916 --> 10:23:40,560
as a backup. Okay, only certain files,
14927
10:23:38,480 --> 10:23:43,040
certain folders have been backed up but
14928
10:23:40,560 --> 10:23:45,276
not the complete file system. That is
14929
10:23:43,040 --> 10:23:47,596
exactly called as a partial backup.
14930
10:23:45,276 --> 10:23:50,000
Okay. So when you select only some
14931
10:23:47,596 --> 10:23:51,916
portion of a directory okay in a single
14932
10:23:50,000 --> 10:23:53,520
partition that is exactly called as a
14933
10:23:51,916 --> 10:23:55,680
partial backup. Partial backup is not
14934
10:23:53,520 --> 10:23:58,400
the complete backup only certain files
14935
10:23:55,680 --> 10:24:00,480
and folders have been backed up. Okay.
14936
10:23:58,400 --> 10:24:04,000
So in Linux we have many such backup
14937
10:24:00,480 --> 10:24:06,480
programs like tar cpio dump restore.
14938
10:24:04,000 --> 10:24:08,640
Okay. Using this you can take a backup
14939
10:24:06,480 --> 10:24:10,720
either complete file system backup or
14940
10:24:08,640 --> 10:24:13,040
the selected files and folders based on
14941
10:24:10,720 --> 10:24:16,160
the requirement. And next question would
14942
10:24:13,040 --> 10:24:19,360
be I note very very important one. Ide
14943
10:24:16,160 --> 10:24:21,916
is nothing but uh the contents of any
14944
10:24:19,360 --> 10:24:24,560
file will be stored in data blocks.
14945
10:24:21,916 --> 10:24:26,800
Whereas information about that file will
14946
10:24:24,560 --> 10:24:30,160
be stored in iode. So when we talk about
14947
10:24:26,800 --> 10:24:31,916
data data has two parts. The contents
14948
10:24:30,160 --> 10:24:34,560
the contents will be stored in the data
14949
10:24:31,916 --> 10:24:36,560
blocks and information about the file
14950
10:24:34,560 --> 10:24:39,680
what we called as metadata. That
14951
10:24:36,560 --> 10:24:42,960
metadata will be there in the iode.
14952
10:24:39,680 --> 10:24:45,360
Okay. So information what type of
14953
10:24:42,960 --> 10:24:48,480
information is stored in iode like the
14954
10:24:45,360 --> 10:24:50,880
file size the permissions the user
14955
10:24:48,480 --> 10:24:53,756
ownership the group ownership the link
14956
10:24:50,880 --> 10:24:57,840
count when exactly the file was last
14957
10:24:53,756 --> 10:25:01,276
accessed or last modified. Okay all that
14958
10:24:57,840 --> 10:25:04,560
you can see in iode. So an iode number
14959
10:25:01,276 --> 10:25:06,400
points to an iode table which is a data
14960
10:25:04,560 --> 10:25:08,720
structure that stores all that
14961
10:25:06,400 --> 10:25:11,840
information. the size of the file, the
14962
10:25:08,720 --> 10:25:15,360
device ID, the user ID, group ID, the
14963
10:25:11,840 --> 10:25:17,360
file mode permissions, everything. Okay.
14964
10:25:15,360 --> 10:25:20,320
So, which command is used to set a
14965
10:25:17,360 --> 10:25:23,276
processor inensive job to execute less
14966
10:25:20,320 --> 10:25:26,240
CPU time? Very very important question
14967
10:25:23,276 --> 10:25:29,596
and the answer would be the command nice
14968
10:25:26,240 --> 10:25:33,596
and reice. Okay, these are the programs
14969
10:25:29,596 --> 10:25:36,000
which are used to set a priority. Okay,
14970
10:25:33,596 --> 10:25:39,916
you can change the process priority
14971
10:25:36,000 --> 10:25:42,480
using nice and renice programs. So nice
14972
10:25:39,916 --> 10:25:45,680
command will launch a process with an
14973
10:25:42,480 --> 10:25:47,756
userdefined scheduling priority. Reise
14974
10:25:45,680 --> 10:25:52,000
command will modify the scheduling
14975
10:25:47,756 --> 10:25:54,720
priority of a running process. Okay. So
14976
10:25:52,000 --> 10:25:58,160
the process scheduling priority ranges
14977
10:25:54,720 --> 10:26:00,480
from minus20 to 19. Keep this in mind.
14978
10:25:58,160 --> 10:26:02,560
This is very important. Okay. The
14979
10:26:00,480 --> 10:26:05,520
process scheduling priority range from
14980
10:26:02,560 --> 10:26:08,480
minus20 to 19. We also call this as a
14981
10:26:05,520 --> 10:26:11,680
nice value. Okay, a nice value of
14982
10:26:08,480 --> 10:26:14,640
minus20 represents the highest priority
14983
10:26:11,680 --> 10:26:17,916
and the nice value of 19 represents the
14984
10:26:14,640 --> 10:26:20,240
least priority of a process. Okay, if I
14985
10:26:17,916 --> 10:26:23,040
show you one practical example here, let
14986
10:26:20,240 --> 10:26:25,596
me just create one particular file. Cat
14987
10:26:23,040 --> 10:26:28,400
redirecting file one. I'm creating a
14988
10:26:25,596 --> 10:26:31,120
file. Okay. So in the back end one
14989
10:26:28,400 --> 10:26:33,200
process would be invoked because I'm
14990
10:26:31,120 --> 10:26:35,840
creating a file here. Let me open
14991
10:26:33,200 --> 10:26:38,880
another session here. Let me show you by
14992
10:26:35,840 --> 10:26:42,480
just running the command psl
14993
10:26:38,880 --> 10:26:44,560
and the process name called cat. Okay.
14994
10:26:42,480 --> 10:26:47,680
See this particular process by default
14995
10:26:44,560 --> 10:26:50,800
you see the nice value the nice value is
14996
10:26:47,680 --> 10:26:52,800
zero. Whenever you submit a process by
14997
10:26:50,800 --> 10:26:56,960
default every process will have a nice
14998
10:26:52,800 --> 10:26:59,840
value zero. Okay. See here similarly if
14999
10:26:56,960 --> 10:27:03,596
I submit a program with the less
15000
10:26:59,840 --> 10:27:06,880
priority for example minus 10 okay minus
15001
10:27:03,596 --> 10:27:09,120
10 cat redirecting file one here now you
15002
10:27:06,880 --> 10:27:10,880
see the nice value let me open the other
15003
10:27:09,120 --> 10:27:13,360
other this one let me recall the same
15004
10:27:10,880 --> 10:27:16,240
command now you see the nice value for
15005
10:27:13,360 --> 10:27:18,880
cat command the nice value is 10 okay
15006
10:27:16,240 --> 10:27:21,520
the nice value ranges from minus 20 to
15007
10:27:18,880 --> 10:27:24,960
19 minus 20 being the highest priority
15008
10:27:21,520 --> 10:27:27,120
and 19 being the least priority see I
15009
10:27:24,960 --> 10:27:30,400
launched a program with the nice value
15010
10:27:27,120 --> 10:27:32,560
with the least value called 10. Okay, if
15011
10:27:30,400 --> 10:27:35,120
you want to launch a program with the
15012
10:27:32,560 --> 10:27:36,960
highest priority, I'll give minus 10.
15013
10:27:35,120 --> 10:27:40,800
Okay, do not get confused here. It is
15014
10:27:36,960 --> 10:27:43,360
not hyphen. It is minus 10. Now you see
15015
10:27:40,800 --> 10:27:46,560
now it is minus 10. Okay, that means
15016
10:27:43,360 --> 10:27:49,840
this command requires more CPU time.
15017
10:27:46,560 --> 10:27:51,756
Okay. Similarly, unlike nice, if there
15018
10:27:49,840 --> 10:27:53,756
is already a running process, that can
15019
10:27:51,756 --> 10:27:57,360
be changed by using the command called
15020
10:27:53,756 --> 10:28:00,720
renise. Okay, the command is renice
15021
10:27:57,360 --> 10:28:02,480
hyphen n the priority you want. Okay,
15022
10:28:00,720 --> 10:28:05,916
and you can give the process name or the
15023
10:28:02,480 --> 10:28:07,916
process ID, you can do with the renise.
15024
10:28:05,916 --> 10:28:11,200
Reise can be used if the program is
15025
10:28:07,916 --> 10:28:13,756
already in used. Okay, very important
15026
10:28:11,200 --> 10:28:17,360
programs. See here the priority ranges
15027
10:28:13,756 --> 10:28:19,916
from minus20 to 19. Minus20 being the
15028
10:28:17,360 --> 10:28:23,276
highest and 19 being the lowest
15029
10:28:19,916 --> 10:28:25,436
priority. And the last question is like
15030
10:28:23,276 --> 10:28:28,720
what are shadow passwords and how they
15031
10:28:25,436 --> 10:28:31,520
are enabled. So shadow passwords are
15032
10:28:28,720 --> 10:28:33,596
given for better system security. Every
15033
10:28:31,520 --> 10:28:35,360
user's passwords will be stored in
15034
10:28:33,596 --> 10:28:37,360
/c/pass
15035
10:28:35,360 --> 10:28:39,916
file. And by implementing shadow
15036
10:28:37,360 --> 10:28:42,960
passwords, all passwords will be stored
15037
10:28:39,916 --> 10:28:44,560
in encrypted format in a new file called
15038
10:28:42,960 --> 10:28:46,960
/c/
15039
10:28:44,560 --> 10:28:48,800
shadow. Okay. The passwords in the
15040
10:28:46,960 --> 10:28:51,596
original file will then be replaced with
15041
10:28:48,800 --> 10:28:53,680
X. In multi-user environments, it is
15042
10:28:51,596 --> 10:28:56,400
very important to use a shadow
15043
10:28:53,680 --> 10:28:59,040
passwords. Okay. If I give one small
15044
10:28:56,400 --> 10:29:01,680
example, like in Linux, we have two such
15045
10:28:59,040 --> 10:29:04,800
database files here. One database file
15046
10:29:01,680 --> 10:29:06,400
will have information about users and
15047
10:29:04,800 --> 10:29:11,276
other database file will have
15048
10:29:06,400 --> 10:29:14,160
information about users passwords /c/
15049
10:29:11,276 --> 10:29:16,800
shadow. Okay, we have two such database
15050
10:29:14,160 --> 10:29:21,120
files here which keeps information about
15051
10:29:16,800 --> 10:29:23,916
users and users passwords. Okay, so this
15052
10:29:21,120 --> 10:29:26,640
is to improve the security. In earlier
15053
10:29:23,916 --> 10:29:28,960
days, in earlier versions of Linux and
15054
10:29:26,640 --> 10:29:30,800
Unix operating system, there used to be
15055
10:29:28,960 --> 10:29:33,436
only one particular file which has
15056
10:29:30,800 --> 10:29:37,360
everything user and the users file. See
15057
10:29:33,436 --> 10:29:39,360
an example here. Example called password
15058
10:29:37,360 --> 10:29:41,436
convert
15059
10:29:39,360 --> 10:29:43,200
cat/et/
15060
10:29:41,436 --> 10:29:45,360
password used to have everything like
15061
10:29:43,200 --> 10:29:47,916
this in one particular file. You have
15062
10:29:45,360 --> 10:29:49,916
users, the users passwords and
15063
10:29:47,916 --> 10:29:52,800
everything. But the problem is this
15064
10:29:49,916 --> 10:29:56,960
particular file is readable by everyone.
15065
10:29:52,800 --> 10:29:58,800
See here /c/ password is owned by root.
15066
10:29:56,960 --> 10:30:01,596
He got full permissions here. Even
15067
10:29:58,800 --> 10:30:03,916
others got read permissions. Okay. Which
15068
10:30:01,596 --> 10:30:06,960
does not impose security on this
15069
10:30:03,916 --> 10:30:09,120
particular file. Okay. So that is the
15070
10:30:06,960 --> 10:30:12,720
reason there are two database files
15071
10:30:09,120 --> 10:30:15,200
maintained. One is etc password and etc
15072
10:30:12,720 --> 10:30:17,680
shadow files. Now you see the shadow
15073
10:30:15,200 --> 10:30:20,080
file is only has read permissions for
15074
10:30:17,680 --> 10:30:24,160
root. For others you see we have none
15075
10:30:20,080 --> 10:30:26,160
permissions. Okay. So this is our we
15076
10:30:24,160 --> 10:30:28,320
have two database files here. ETC
15077
10:30:26,160 --> 10:30:30,960
password which has information about
15078
10:30:28,320 --> 10:30:34,400
users and etc shadow which has
15079
10:30:30,960 --> 10:30:35,916
information about users passwords. Okay.
15080
10:30:34,400 --> 10:30:38,560
Not only passwords you also have
15081
10:30:35,916 --> 10:30:40,560
information about the password age also
15082
10:30:38,560 --> 10:30:43,040
for how long we can use this password
15083
10:30:40,560 --> 10:30:45,916
when password would be expired. All this
15084
10:30:43,040 --> 10:30:47,120
information can be used in etc shadow
15085
10:30:45,916 --> 10:30:49,200
file.
15086
10:30:47,120 --> 10:30:51,916
>> And with this we have come to an end to
15087
10:30:49,200 --> 10:30:53,596
this full course on Linux. If you
15088
10:30:51,916 --> 10:30:56,000
enjoyed listening to this full course,
15089
10:30:53,596 --> 10:30:57,680
please be kind enough to like it and you
15090
10:30:56,000 --> 10:30:59,520
can comment on any of your doubts and
15091
10:30:57,680 --> 10:31:02,160
queries. We will reply to them at the
15092
10:30:59,520 --> 10:31:04,880
earliest. And do look up for more videos
15093
10:31:02,160 --> 10:31:07,120
and playlist and subscribe to Idora's
15094
10:31:04,880 --> 10:31:11,480
YouTube channel to learn more. Thank you
15095
10:31:07,120 --> 10:31:11,480
for watching and happy learning.
1172855
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.