This content is an introductory tutorial to Linux, covering its history, popular distributions, fundamental commands, file operations, user management, and permissions, aiming to equip beginners with practical skills.
Mind Map
Click to expand
Click to explore the full interactive mind map • Zoom, pan, and navigate
Hey guys, my name is Van and I'll be
your instructor for today. So on behalf
of I welcome you all to this webinar on
Linux tutorial and in today's session
I'm going to give you a complete
overview of Linux. Okay. So it doesn't
matter if you're a beginner or if if you
have good knowledge about Linux but I'm
going to teach you concepts that you can
take away home and you can execute for
yourself. So guys before I get started
let me just take a quick confirmation
from you people. I hope uh you can hear
my voice and see my screen. If that's
the case, uh, please put that in the
chat box and I'll get started.
Okay, so I'm getting a couple of
acknowledgements here. Ravi says he can
hear my voice and see my screen and so
does Akash and the same can be said for
even Hmon. All right, so guys, seems
like it's all fine. Let's get started
with the session. All right. Now, before
I uh get started with the first topic,
let me just show you the agenda and tell
you what we're going to cover today.
Okay. So, this is the agenda and uh I'll
be covering the topics in this flow.
Okay, first I'll talk about the birth of
Linux and tell you why they became
popular. All right, and then I'll talk
about the various distributions of
Linux. Okay, so Linux is basically a
kernel. Most of the people think that
Linux is an operating system in itself.
Well, that's not the case. So I'll talk
about the various uh versions of Linux.
Okay, the various operating systems of
Linux. I will talk about those things
and then we'll get started with the
hands-on right after that topic. Okay.
So in the hands-on we have uh I've
categorized this into different phases
where you know I'll talk about the basic
Linux commands first and then I'll show
you how to work with files and
directories and then I'll show you how
to add and delete users. You know you
will learn all those administration
aspects and finally there will be one
networking aspect which I'll cover in
Linux. Okay. So there is something
called as SSH. Okay. SSH stands for
secure shell and this is used for
communication. Supposing you want to
communicate with the remote host. Right.
When I say remote host, it means a
system that's uh located remotely which
you don't have physical access to. So
that kind of a machine, how will you
access that machine with the help of
SSH? So I will talk about all these
things and uh yeah so if you guys have
any doubt or any problems during the
session, please put that in the chat box
and uh I'll answer them right away. All
right guys, cool. Ravi, is it fine? All
right, great. Ravi says that he's new to
Linux. Oh great, Ravi, no problem.
That's exactly the uh target audience
for this webinar. Right? So uh you know
this is going to be a complete basic
tutorial and you know for anyone that's
going to get started with Linux for let
it be college students or professionals
who are absolutely new right so we're
all used to using Windows or Mac right
so most of the people in here would have
just used Windows because it's cheaper
and it's better but Linux is something
that is a software developer's favorite
operating system right so that's why uh
you know there is so much hype and so
much demand for Linux professionals and
Linux administrators and uh if If you
want you know to get started with a
career in that domain then we can get
started from uh this tutorial from
today. All right guys. Okay. So uh
without wasting much time let's go to
the first topic and that is why did
Linux become popular? Well uh before I
talk about uh you know why they became
popular let's look at the birth of Linux
how things started off. Okay so back in
1969 there was this person called uh you
know in fact there were two people
Dennis Richie and Ken Thompson right? So
they were working in the AT&T Bell Labs
and what they did was they created this
C programming right so we're all aware
of programming right so we're all aware
of these basic programming languages
right so C is one of the most basic and
one of the most effective and the root
of all the other programming languages
so that was C and it was them that
developed C and the Unix operating
system so that was what happened in 1969
okay and then in the decade that
followed okay so basically in the 1970s
people started developing or
contributing to the development of these
two things. Okay. So, they started
contributing to the development of the C
programming language and the Unix
operating system. So, in our session,
we'll discuss more on Unix operating
system and uh since it's about Linux,
right? So, Unix is basically the mother
of Linux because uh Linux is based on
the Unix operating system. Okay, I'll
tell you how that's the case uh in some
more time. But that's why we are
starting off with Unix operating system.
Okay, so I'm not going to cover about uh
C and getting back to our slides. So it
says growth of Unix because of
open-source collaboration and there was
commercial sale of Unix. Now what this
meant is that you know the product that
Dennis Richie and Ken Thompson created
right that those were you know something
really attractive. There were some
amazing software and operating systems
that would you know power machines and
computers. Now what this meant was uh
you know they had to be developed to
become even better right. So they made
it open source. It was uh when we say
open source it means that it was freely
available to use by anyone. So anybody
any person any scientist or uh any
engineer or anybody could just get
access to the source code and start
improving that source code and if they
feel that they have improved the
software in any way then they can just
uh you know give that code back to uh
the developers. So basically it was all
about collaborated development. So
that's what happened with Unix operating
systems in the 70s. many hippies,
scientists, they all collaborated
together, wrote their own code, their
own version of Unix operating system and
contributed to the development of Unix
operating system. And uh since AT&T,
they were the uh ones who built Unix or
the ones that were responsible for
founding Unix. They were the ones that
gained a lot of benefit. They got help
from other people for uh you know
developing the operating system and what
they did in turn was they made it a
business, right? So they made money out
of that by you know starting commercial
sale of Unix and uh this was something
that did not go down well with many
people and this did not go down well
with the other developers and scientists
because it was their effort which
contributed to the growth of Unix but
however they are not getting any
benefits of you know Unix because
adentry that was making money out of
somebody else's work. So that's what
happened in the 1970s. Okay. And then
came the 1980s which was a little more
different. So instead of you know buying
uh you know Unix from AT&T and uh you
know having two different versions of
Unix one was a free PSD and the other
one was the paid AT&T version of Unix.
So instead of going to go for them
companies started developing their own
Unix. So IBM came up with their own uh
Unix version called the AIX. Solaris
came up with their own version called
the sun operating system and HP came up
with their own version of Unix called
HPUX. So there are other versions also
like pix and all these things. Now since
there were many versions right many
flavors and many dialects of the same
Unix operating system it was becoming a
little problematic because each of the
dialects would be a little different. So
the IBM's Unix would be different from
HP's Unix and Solar's Unix or it would
be different from POSIX. Okay. So each
of them would be different but however
they're all based on the same thing. So
it was unnecessary you know confusion
there with so many versions of Unix. So
that is when this person called Richard
Stallman came up with something called
as the GNU project. Okay. So I told you
earlier that uh Linux is just a kernel
and not an operating system on its own.
So what this person did was you know he
came up with something called as a free
software movement. So he wanted
something like you know back in the 70s
when everyone could collaborate and work
on the same one single operating system
like that. He tried to bring back that
era and this free software movement of
his this idea led to the GNU project. So
the GNU project was all about people
being able to access an operating system
for free and you know developing that
operating system. So that's what uh this
led to and uh that's what we call even
today right. So GNU is basically the
operating system and the uh Linux is the
kernel that powers the operating system.
So a combination of these two is what
results in one of the distributions of
Linux. So we have multiple distributions
like Ubuntu CentOS Redat Debian Fedora
all these things. So all these things
are a flavors a combination of one of
the operating systems and the uh you
know Linux kernel. Okay. So that's what
they are. So this is what happened in
the 1980s and then you know mid to late
1980s was when Richard Stallman came
into the picture and he came up with the
GU project where people could develop uh
you know and use free operating system.
So that's what happened here and the
event that happened after this is what
is a result of today's world. Okay. So
after that then in the 1990s so probably
1991 or 1992 that was when this person
called Lin Star Talls who was still back
in college at that time he put the Linux
kernel source code online so he was
trying to use the Pix version with one
hardware called 386 and he thought that
it's compatible only with that hardware
and so he put the source code online for
anyone to use and later they found out
that it could be used with the GNU and
that's when the whole uh thing gained
popularity. So that's when we uh you
know came up with something called as
the Linux plus GNU this whole term of
having a kernel plus this operating
system and getting them to work
together. So that's what happened here.
All right. So guys uh that's how Linux
was born. Okay. Now without wasting any
more time let me go to the next slide
and talk about the various distributions
of Linux. So I told you that there are
many versions like Ubuntu CentOS and
all. So let's talk about those. And uh
when we talk about distributions the
most important and the most famous ones
are those of Red Hat Enterprise Linux,
Fedora and Debian. Okay. So these three
are primarily different companies and
enterprises. Well, Debian is basically
not one company. It's kind of you know
let's say a group of developers
developing this uh version of Linux.
Okay, this version of Linux and the
Ubuntu version. So that is what Debian
is. And the Red Hat is basically an
enterprise. It's a company that is
commercially selling the Linux
distribution. Okay. And it's probably
the most used and the most popular of
them all. Uh why? Because they are very
stable. They are very reliable. And as
it's written here, servers and
workstations, right? So it's the
preferred Linux distribution for servers
and workstations. The Red Hat Enterprise
Linux. So they have a free version. So
that's called the uh CentOS and uh
today's demonstration I'll be showing it
to you on CentOS only. Okay. So they
have that and they have various other
distributions. In fact even Fedora right
that which we are going to talk about
next. Even Fedora is a company that's
funded by Red Hat itself. So it's again
one of the variations of Red Hat and
Federa has its own set of you know
distributions under it and that's about
the Federa distribution. Then comes the
Debian. So this again I spoke about
Debian. So Debian is you know the Linux
distribution that is developed with the
help of many developers. So this is not
developed for commercial purpose. It's
basically free and open source software
and anybody with the skills can start
contributing to this software and you
have many other distributions. Okay. So
these are among the important and the
commercial ones. And if you're talking
about some of the free distributions
which people can use then they are
Ubuntu, Linux Mint, CentOS, opensource
Gen 2 and many more. Okay. So there are
almost 100 Linux distributions today and
you can use any of them. you know if
you're getting started with Linux then I
would suggest you to either start off
with Ubuntu or CentOS because uh CentOS
is you know something that's really
reliable and that's really fast okay and
Ubuntu is the most popular Linux
distribution out there okay and so I
read somewhere that Ubuntu is the third
most used operating system okay so
that's what Ubuntu is all about of
course it's not as fast as CentOS but
still Ubuntu is you know a very popular
and very handy tool and Mint is the
other distribution which can be used for
playing movies and listening to music
because uh this gives you more of a
windows like interface. So that's what
Linux Mint is. So we have various
distributions like this and yeah so guys
any doubts I mean some of you told me
that you know you people are newcomers
and haven't started with Linux. So you
can start off with one of these
distributions mentioned here you can
either go for the Red Hat Enterprise
Linux or the Fedora or the Debian or the
other operating systems which are based
on them. Okay. So the CentOS here it is
based on Red Hat Enterprise Linux. Okay.
So the real right we call them re. So
they have the free version that you know
they provide for enterprise users are is
that of CentOS and Fedora again for that
matter of fact you know uh they have
multiple distributions under them under
their name and Debian are the people who
are the founders of Ubuntu. Okay. So
Ubuntu is a distribution that is based
on Debian and since Ubuntu is so popular
there are different versions of Ubuntu
itself right there are other
distributions like X Ubuntu or Ed Ubuntu
all these things and they are the other
you know versions of Ubuntu. So that's
about the uh different Lunar
distributions and you guys can probably
you know if you're newcomers then I
would suggest you to go for either
Ubuntu or CentOS like I said earlier. So
seems like people are all good. Okay. So
I'm getting a couple of comments from
people. All right, great. So, let me go
to the next slide then. Okay, so now we
are in this slide and uh let's talk
about the features of Linux here. Okay,
so the Linux features, you know, when we
say features, it's basically those
compared to the other operating systems
compared to Windows and compared to Mac.
Okay, so compared to them, how does
Linux perform and you know, what are the
benefits with Linux? And uh first of all
we have uh this feature of uh you know
the updates being very easy to be
performed. If you have any software in
your operating system or if it's the
operating system itself which you want
to update then it's really easy with
Linux. It's uh just going to be one
command that you need to run and you
know you can run that command from the
terminal. Okay for those guys who don't
know what a terminal is. So let me just
open my uh Linux version and show you
what a terminal is. Okay. So this is my
uh CentOS version of Linux. All right.
And then you have different options
here. Right. So the terminal that you
see here, this is what I was talking
about. So when you open the terminal,
there's another window that opens. Okay.
Now this is the command line interface.
So when I say command line interface, uh
this is where I can uh put in my
commands and I can get my uh you know
software or my kernel to listen to those
commands and perform actions by creating
a process for uh those commands. So the
whole benefit of Linux is this CLI
because the CLI is really helpful. If
you're going for Windows or something,
you have a very good GUI. All right. So
even in Linux you have a GUI. So let me
show you the GUI aspect. So similar to
Windows you can just go to the computer
and you can go to file system. You can
open various other folders and
directories. So you have multiple
directories and folders here, right? So
I mean directories are basically
folders. Folders is what you call in
Windows and here you call them
directories. So I can go into any of
these uh you know directories and I can
close them like this. I can access any
of these directories. I can access any
software or anything that's installed
anywhere. So, Linux basically provides a
GUI too. Okay, but the thing with Linux
is that you also have a terminal, right?
This terminal is basically a command
line and interface where you can, you
know, put in your uh commands and you
can get the software to behave the way
you want to. You can run certain
commands, you can install software, you
can run uh programs, you can run codes.
So, that's what the advantage with the
uh CLI is and this is basically the
reason why uh it's very popular among
all these software developers. Okay. So
I told you earlier that software
developers the favorite tool right
Linux. So that's because uh Linux is uh
the free version of Unix and it's also
you know possible to develop and create
so many programs. So that's the thing
with Linux. So that's why it's so
popular. So back in the slides I told
you that it was very easy to perform
updates right so those updates can be
you know easily performed by just
running a few commands here. You know by
uh writing one single command I can
update a particular software. Supposing
I have Java installed in my uh system,
then I can just write a command for
updating that. I can just say sudo yum
update and the uh package name. If it's
Java, I can just put the Java version.
If it's uh any other uh language or if
it's any other software, then I can put
that software name over here and update
the uh application. So that's how simple
and that's how easy uh you know it is to
update softwares over here. So I was
talking about uh this aspect. So let me
go back to the slides and talk about the
other features. Okay, so that was how
updates can be easily performed. And
then another feature is that the
software is free. You don't have to pay
for uh Linux. So because Windows of
course you all know that Windows is
paid, you can't, you know, have a
pirated version. If you're caught having
a pirated version, you'll be fined. Of
course, home, you know, desktop users
and home users don't really have that
problem because there are no routine
checks. But companies cannot use uh the
pirated version of Windows because if
there are audits, they can come and
seize the computers and put a heavy fine
on the company. So that's what we say
when the free software licensing is
there in Linux because you don't have to
have any license. You can just uh you
know get all the folks in your company
to work on Linux for free. So that's the
free software licensing aspect and then
you have the access to source code right
so when we say access to source code I
told you that back in the 70s people
could just collaborate together and
develop the operating system. So that is
what I'm talking about here. So the
entire the source code for uh running
this OS the basically the Ubuntu or the
CentOS source code is available to you
and you can customize it and you can uh
you know change it the way you want you
can make it behave the way you want to
and uh if it's a really good visual that
you've added then you can also share
your discoveries and your uh you know
features with other people with other
fellow developers you can do all these
things so you have complete uh you know
access to the source code and you have
complete freedom with what your OS can
do and how it behaves. But the same
thing cannot be set for Windows right.
So Windows you cannot change it
completely. You don't get access to the
source code at all and you can't change
all the features the way you want to
because that's proprietary tool and it's
programmed to behave in one way and if
you try changing too many things then
your uh you know windows will uh report.
So that's what is going to happen. So
that's about the uh access to source
code feature. And then we have another
feature that is multiple distributions.
So I spoke about the different
distributions in the previous slide. So
the basic distributions are those of Red
Hat, Debian or Fedora, right? So you
have various versions of them itself.
You have different flavors in the Red
Hat and you have different ones in the
Debian and again Fedora has a lot of
other distributions further. Many
distributions are based on them. So you
have so many options and if you don't
like one of the distributions then you
can work on another distribution right.
Right? So if you don't like CentOS is
because uh you know you don't get
support for everything then you can use
Ubuntu. Okay. It is the most popular
operating system and it has support for
almost every application and every
software. So you can use that. But if
you're unhappy with the speed of Ubuntu
then you can probably switch to CentOS.
So you have all that flexibility and all
this flexibility without any cost. Okay.
Uh no cost with respect to uh energy or
having to learn something new because
all these are Linux. At the end of the
day, the commands will be the same.
Almost 98% of commands will be the same.
There are just going to be minor
differences in the commands that will be
executed in uh the different uh
distributions. But yeah, 98% of them
would be the same. You won't have a
tough transition time also. You'll have
uh you know, you can gain so many
benefits by using Linux. And the last
but not the least, right? So this
feature is probably the highlight of
Linux. So it says better malware
protection. So when we say better
malware protection, we say that it's the
ultimate. Okay. uh in Windows if you
people uh would have noticed that you
need an antivirus because uh it's prone
to viruses and attacks and bugs and all
these things. So people can easily hack
into your system, right? So the same
thing cannot uh you know happen with
Linux. You don't need an antivirus at
all. Linux is completely antivirus free.
Okay? 100% you don't need an antivirus
and in fact you don't even have an
antivirus. But of course it doesn't mean
that you know it's completely secure
also. Uh security is something that's
really good but it's still developing in
Linux but it's definitely better than
Windows, right? So you can be sure that
no one's going to hack your system so
easily. So that's what uh Linux is all
about. So guys that brings us to the end
of this slide of Linux features. Okay.
And if you guys have uh you know any
doubts even now about Linux and how good
Linux is then um that should have been
clarified and put to rest by now. Okay.
So I have not got any question from any
participant and uh if you guys have any
doubts please put them in the chat box
and I'll answer them. All right. Okay.
So moving on. So uh enough with the
theory. Now let's straight away get
started with our hands-on. Okay. So I'm
going to show you how to run commands
and how to do various other things with
the CentOS operating system. Okay. So
the first of all the first part of this
hands-on session is going to be about
you know an introduction to the terminal
and the various commands and the basic
commands and how to browse through the
uh different uh directories. Okay. So we
use commands like pwd clear ls and cd
commands. Okay. Now let me go to my
centtos. Okay. In case I uh forgot to
mention it earlier then guys I'm using a
VM here. Okay. So I'm running my Windows
operating system on my uh laptop and I
have a virtual box installed and in the
virtual box I have instantiated my uh
Linux virtual machine. Okay. So my Linux
distribution here is uh CentOS. Let me
just show you another thing. Okay. So
this is the virtual box that I was
talking about. This is what I'm running
in my Windows and I have uh you know
multiple options. So I can choose any VM
that I want to. So this is the virtual
box and all these are the different VMs
that we have in my virtual box. So
currently I'm running this VM called
master. Okay. And later on I'll be
turning on even this VM called slave.
Now I'll be doing these two for uh
showing you how SSH works. So I told you
in the agenda slide that I'll you know
get two remote machines to access each
other right. So for that purpose I need
these two VMs and of course both are
CentOS and uh yeah as you can see the
information it says that 32-bit system
I've called it or named it master and
this one is named it as slave. So
similarly I have the Ubuntu also. So the
Ubuntu 64-bit is uh this. So let me just
uh turn on the Ubuntu and show you how
Ubuntu looks like. Okay. So let's just
Okay. So let me just enter the password
And here we are. This is my Ubuntu uh
OS, right? So even this is being hosted
on the same virtual box. So I am kind of
running two different virtual machines
at the same time. Okay. So we have
options uh to browse the internet and I
can open the terminal here. The terminal
option is right here in my Ubuntu
operating system. Okay. So I just wanted
to show you the uh Ubuntu operating
system. So let me just quickly turn it
off and uh go back to my uh CentOS and
start running a couple of commands.
Okay. So I was uh showing you the uh
CentOS, right? So login. Okay. So this
is my uh terminal and uh first of all
the main difference that you people need
to understand is between Windows and
Linux is that in Windows it was you know
the storing uh files or folders it was
all in drives okay so we had a C drive
we had a D drive we had many more drives
like that and we could store ouruh
documents all in those folders okay but
in Linux it's a little different from
how uh Windows works in Linux we have
something called as the root directory
okay so we have file system here right
so basically whatever folders or
documents or directories you have
everything can be accessed from the file
system when I clicked on file system
then you would have noticed that I got a
forward slash here okay so this forward
slash basically means root okay this
means I'm in the root directory and in
the root directory every document and
every folder is present in this root
directory okay now whether it is uh me
storing some kind of uh you know
important files or uh MP3s or videos
then everything can be accessed from the
root So you can think of this something
like a tree hierarchal structure. Okay.
So you have one root and all the other
branches and all the uh leaves and all
those things. You can consider them to
be the different directories and the
files inside. So they can all be
accessed from the root. And if you want
me to show you where uh one minute.
Okay. So now this is your desktop,
right? So you have the different icons
here and each of these icons are for
different operation. So you have home
and then you have a terminal and you
have an LMS. So this is a folder and
this is a document. Okay. So read me is
a document. So uh what I'm going to do
is I'm going to browse to the desktop
folder. So from uh root directory if you
go to this folder called home right. So
under home directory you have other
option you have edrica and uzi. Okay. So
now if I go to the edka directory then
you have other options of desktop
documents downloads uh music and all
these things. So if I go to desktop then
in this directory you have the files and
the different things that are present on
my desktop. So LMS was a folder that was
present. Readme this was a file that was
present. The terminal was present on my
desktop. So that is available here. So
Eclipse IDE is present here. So all this
was present in my desktop. So I get the
same thing accessed from here. And
similarly if you're downloading
something from the internet, then that
will get downloaded to uh this folder,
the downloads folder, right? So you have
a documents folder. Similarly you have a
videos folder, music folder. So all
these files or folders will be stored in
some place. Right? So they will be
stored in your uh /home/reka.
Okay, if you're downloading them and uh
you know if not if it's going to be
softares which you're going to install
then you can install them in any other
uh directory here. In fact, most of the
softwarees that you install, they'll be
by default they'll get installed in this
directory in the bin directory. Right?
So you have the bin directory, you have
the lib directory which will have a list
of all the different libraries that the
OS would use and then you have the sbin.
You have all these things, right? So
they can all be accessed from here and
uh that's about accessing them from the
GUI aspect. Okay? And the same thing can
be done through the terminal. Okay? Now
uh let me go to my terminal and show you
how that is done.
So this is my uh terminal. Okay, this is
the command line interface where I can
uh put in my commands and when those
commands are executed by the uh kernel
or by the shell, then uh program will
get activated and some kind of uh
features will run. All right. Okay guys,
uh so before I get started, let me go
back to my slides and show you what are
the different basic commands that I want
to run first of all. Okay. So as you can
see it says Linux provides a CLI to
communicate with the operating system
right so that was a terminal that I
showed you the CLI is called the
terminal and the CLI is basically it's
better for tasks which cannot be
performed with the GUI you know uh I
showed you the concept of going to
different directories and different
folders right so it was a little tough I
had to go to go through multiple
directories so through the GUI that's
one kind of a you know drawback you'll
have to spend a lot of time navigating
but with the uh CLI It's easier. It's
just one command and you can access the
directory that you want to. That's the
advantage with the CLI. Okay. And this
is just one basic example that I'm
giving you. There are many more advanced
concepts and topics which is not very
easy to perform with the help of a GUI.
So in those places you can just use the
CLI to perform those tasks and the CLI
is also much faster in quite a few ways.
Okay. So that's the advantage with the
CLI and running the commands. Basically
the first and foremost you have the pwd.
Okay. Now this stands for print working
directory. Okay. And what it does is it
displays the current working directory
of the terminal. Okay. Then there's this
forward slash and I told you that the
forward slash represents the root
directory. Okay. Now let me go to the
terminal and show you these two things.
So uh right now we are in the home
directory. Okay. Now let me just type it
down. Let me just put pwd. And when I
put pwd it prints the current working
directory. Okay. The presently working
directory. So that is home/DRA.
Now uh if I go to the uh computer and
file system and home and inside this eda
then what you see here right so this is
the folder that I'm accessing through my
terminal because the present working
directory is set to this folder okay now
if I want to you know say I want to
change the directory it means I want to
change from this particular folder to a
different folder so there are other
options like desktop folder and
documents folder right if I want to move
to one of these folders then how will I
do it using the terminal so I'm just
going to show you how that is done. I
just want to minimize this a little bit.
Yeah, the command for that is cd space
the name of the folder. Supposing I want
to go to the desktop folder, then I can
just put ds k.
All right. And when I put enter, then
I'm inside this folder. So earlier you
had you saw this option, right? So this
represents the directory I'm in. Okay, I
was in fact in the home directory and
right now I'm in the desktop directory.
So desktop is uh the directory inside
bome. And if I want to you know list
down the contents in the uh desktop then
I can run the ls command. Okay. So when
I put ls it basically lists down the
different folders and the different
files that are present in that
directory. Okay. So we have the eclipse
we have lms which is a folder. We have
readme which is another file. We have
all these things. Okay. So let me just
go to the desktop folder and show you
the same. Okay. We have the terminal. We
have the lms which is a folder. And
similarly going back to the terminal if
I want to enter this Linux folder then I
can again uh you know just say cd and
space lms. Okay when I do this I'm
inside this folder. Okay now if I put ls
then I have the list of the folders or
documents that are present in this lms
folder. Okay so uh ls is basically the
command to list down the folders or
files in that directory and yeah cd
space the file name or the directory
name would move you to that particular
directory. Now that is the same thing
that I've discussed in uh this slide
here also. Okay. So I spoke about the
present working directory which displays
the current uh directory that your
terminal is uh in and then you have the
root directory from where all your
directories or folders are marked right.
So everything can be accessed from the
root directory. So that is this and then
you have something called as the echo
command. You have the su and the pseudo
commands. Okay. Uh these are something a
little advanced. So before I show this
let me show you the uh clear command.
Let me explain the clear command. Okay.
Now getting back to my u terminal. When
I type clear, the whole uh CLI is
cleared, right? My terminal is cleared.
So whatever commands I ran previously,
those are not present anymore. But what
happens is those commands, they don't
get deleted or something. They are just
scrolled down. So as you can see, they
are still present here. So when I scroll
down, what happens is, you know, it just
makes sure that the other documents or
the other commands that I specified
earlier, those are all hidden and I'm
showed something new. So that's what
happens here. Okay. So that is this. Now
I told you that you know by giving CD
you can go to the directory or the
folder that's in the present working
directory. Right? But how about going
back to the previous directory. So
basically from EDA folder to go to
desktop we clicked on this and then we
entered this folder. Right? So from this
directory by clicking on LMS you go to a
different directory. Right? So you go in
here but using the GUI you can just
click on the uh cross mark here and you
can exit that directory. But how about
you're doing that with the help of the
terminal. How will you do it here? So to
do that we have the option called CD
space two period marks. Period marks or
full stop. So that's what we call it
right dot. So if you have uh two dots
after CD this means you want to navigate
to the previous directory. So we are
currently in the LMS. And when I give
enter I'm back to the desktop folder
right the desktop directory. Now again
if I uh give the same command again then
from desktop I need to go back to this
edurea directory. Correct? So there we
go. till day symbol here it represents
that we are in the home directory okay
so the home directory is basically I can
also access the home directory by just
giving cd and enter okay that I can do
it from any other directory so let's say
I am just doing an ls and I'm changing
directory to downloads okay d o w n l o
a ds okay so just you got to remember to
give the exact name of the folder or the
directory that you want to travel to so
only then it'll work otherwise if you
just give d it won't really work. Okay.
So after this uh if you give enter then
you go to the downloads uh folder and uh
do we have anything inside downloads?
No, we don't have any other folder or
directory under download. So now let's
try going to the home directory from
here straight away. Okay. So I initially
told you that by having two period marks
after uh you know cd you go to the
previous directory in that path right.
So instead of that if I uh just give a
cd okay and if I give enter then I'll
straight away go to the home directory.
And this is with respect to uh any
directory no matter in uh which
directory I am in. So if I just give CD
then it'll go to the home directory.
Okay. So that's what the benefit with CD
command is you can give CD to move to
any directory. Okay. So I have a
question here from uh Shashant and
Shashikant is asking me uh should we
have to do CD and ls every time? It
seems a little complicated. So
Shashikant you don't need to really do
that because uh I was just about to get
to that point. Okay. If you want to go
to a different directory or a different
folder, you don't need to give cd and ls
every time. Okay. So ls is basically
only for you to figure out or understand
what are the different directories
inside a particular directory. Okay. If
I know the path then I can just feed it
right away in one command and enter that
directory. Now let's say I am currently
in the cd directory. So this is uh cd.
So this is my home directory. Okay. Now
if I click on desktop and if I click on
lms and then you have another folder
here. Okay. You have hedge. Okay. Now
supposing I want to go to any of these
uh directories from my terminal then I
don't have to you know put cd three
different times and uh followed by ls
and then go to those directories. I can
just uh specify this thing in just one
command. So what I'm going to do is I'm
going to say cd space or since right now
we are in the uh home directory I need
to give uh desktop. Okay. Now one more
thing which I want to show you people is
there is this option of tab on your
keyboard. Right? when you give tab then
the command here will be autofilled
right the option will be autofilled so
uh let me explain that again so I'm just
going to go back so in the home
directory right so you have different
options you have desktop and documents
so what I'm going to show you is by
clicking on uh cd and space and then if
I just type three or four characters of
desk okay I want to go to this directory
but I've just typed dsk okay now if I
click on tab then the remaining uh
characters of that particular option is
already uh filled. Okay, it gets
autofilled. So that is what the tab
would do by clicking on tab it will get
autofilled. So similarly under desktop
you have the option of LMS, right? So
I'll just put L and if I press tab the
remaining will get autofilled. Correct?
And inside LMS you have different
directories. We saw that we have hbase,
we have hive and all these things. So
let me go there and show you what are
the different directories that are
there. So we have hbase, hive, map
produce and uzi. Okay. Now uh let's go
to the terminal again. Supposing I want
to go to Uzi directory. Okay. Now when I
just click on capital O and if I click
on tab then uh it kind of autofills the
directory. Okay. But in case let's take
the example of hive or HB over here.
Okay. Now since both start with H I'm
going to type H and if I click on tab
that doesn't work. Okay. It gives me
further options of HB and hive. So that
is because there are more than one
options for uh you know starting with H
right? There are more than one folders
or directories that start with H. So
that's why you're getting further
options. That's why it's not
autofilling. But if you see the second
character here is B and the second
character here is I. So if you either
give B and now if you press tab then HB
is what is going to be picked up. Okay?
Because uh after H and B there's only
the only option is uh of HB. There's no
other folder that has HB as the first
letters of the name. So similarly if I
just type IV and if I do tab then hive
gets autofilled. So things like that. So
uh since our mission was to go to the HB
directory I'm just going to say HB.
Okay. Now inside HB I wanted to go to
one of the directories in here. So let's
say we go to advanced hedgebased
practicals. Okay. Now for that if you
want to go there then you just got to
give this. Okay. So this is your
complete path to access that particular
folder. And when I give enter then I am
in uh the advanced hedgebased practicals
module 9. Okay. So I'm in this
particular folder or this particular
directory. So that is what you can do
with the help of feeding a path after C.
So Shashikan this was your doubt right?
So is it cleared? Okay. So Shashikan
says yes. All right. So see this was the
issue that you had right? You had
concerns that you had to put in commands
multiple times. Multiple times you had
to put CD and ls. So that's not uh
needed right. So you can just feed the
path if you know it. You can just feed
the path in just one command and you can
execute that. So similar to this you
have softwares and other uh you know
other things which can be installed
other programs. So they can be executed
and run with just one single command and
it eliminates a lot of confusion. So GUI
is a little complicated in that way
right it takes a lot of time and a lot
of security and permission is needed but
with the help of the CLI and the
terminal then this job is simpler. Okay.
So now if I want to go back to my home
directory, I'm just going to click on cd
and put enter. Okay. So uh that is this.
Now let me go back to my slides. I'm
just going to close all these uh
folders. Okay. Now going back to my
slides, I showed you the print working
directory command and I showed you the
root directory and I showed you the
clear. Okay. So the echo and the pseudo
commands is something that I did not
show you. But I also spoke about the ls
and the cd commands. Right? So what I'm
going to do is uh before I go into
details of cd and ls, right? I'm going
to just show you the echo command and
the uh pseudo user. Okay. Now going back
to my terminal, the echo command, right?
So what is uh the echo command? So uh
what is the echo command? Echo command
is something that writes its arguments
to standard output. So when we say
arguments it means whatever we type
after echo we'll type echo space and
followed by that whatever we write so
that will be specified to standard
output and when we say standard output
uh it is the output that will be
displayed by the u cla so in your
terminal whatever output you get so
we'll get specified to that particular
standard output okay now let me show you
a practical example only then you'll be
able to understand that so let just
clear the screen so another shortcut to
clear the screen is ctr L okay if not
you can just give the clear command like
this. Okay, this will clear your screen.
Otherwise, you can just give control + L
which will again uh you know just clear
the screen. It's a keyboard shortcut.
Okay, so I told you that I was talking
about the echo command. So when I say
echo and if I give enter then there is
nothing that is displayed. But if I uh
say echo and say hi, see what the output
came. So when we executed this command,
this was the output that came back. It
says hi. And uh if I say echo hi my name
is uh
bdan when I say this then whatever uh
was specified as arguments right so this
was basically specified as arguments to
this command so the argument is
specified as the output this is the
takeaway from the definition so the
definition was basically that whatever
the argument is that is specified to
standard output so that's what it
happens so that's what comes here so
this is one thing and in fact there's
another uh functionality also now uh we
We're all aware of the concept of
variables, right? So, we can assign some
kind of value to a variable and we can
also print that with the help of the
echo command. Now, let's say that we
have a variable x okay and let's give it
a value 100. Okay. So, now if I uh just
say echo dollar x then the value that is
stored in this variable right that be
printed uh because uh echo is something
that's just going to print the uh
argument to standard output. Okay, it'll
display the value that is present over
here. So if it's just a string then that
will be printed and if it's a variable
that I'm specifying then even that be
printed. So the difference between uh
the variable and string is this dollar.
Okay. Now if I just give echo dollar x
then I've set the 100 value to x. Right?
So that 100 will be printed here. So
like I told you 100 is printed. But uh
the same thing if I give echo x without
the dollar then see what's printed. it
is x which is printed. So that is the
difference between the string and a
variable. Okay. So you can you know have
again a variable uh called name or you
can have a variable called van and you
can store the value of 10. Okay. But if
you want the value to be displayed then
you got to append dollar before the
variable name. Okay. So that is about
the echo command and uh in fact there
are lot of advantages with this command
and I will talk about the other features
and the other places where this is used
later during the session but uh till
then this kind of an introduction is uh
enough for now. Okay so going back to
the uh slides what else do I have? Uh
okay so we have the su command correct
so as it says su is used to switch to
the root user. Okay. Uh so that you
super user permissions can be used to
execute commands. All right. And then
you have su username uh used to switch
to a different user. And then you have
pseudo command which executes only that
particular command with the root or
super user privileges. Now what these
three what they essentially mean is that
you get more permissions. So if I go
back to my terminal so if you guys
remember then I logged into centers with
the edureka user right? So that is
displayed here also. So uh it says EDA
at localhost right. So uh this is the
username of this account and uh
similarly you have something called as
the root user. Okay this is my user and
then you have the root user and what the
root user is is the root user gives you
a lot of permissions. So that's like the
ultimate uh super user of this
particular system. So basically if there
is any folder that cannot be accessed uh
by my user. Okay, my user name is uh
Hedraka and if I do not have the
permissions to access that particular uh
directory or that particular folder then
we can use the root user because root
has the ultimate privileges. So any
command that is executed with the root
user then that will be executed. Okay.
So because root has all the privileges.
It has all the permissions. So that's
what the root user is. And uh you know
there are certain uh functionalities
which need the su user or the root
user's uh permission and I will show you
all those things later. But for now what
you need to understand is by just giving
su then you can switch to the root user.
Okay. And uh it asks for the password.
Of course you got to know what is the
password for your root user. And when
you give the password, you will be
logged in as a root user. So you're not
eda anymore. Okay. And as you can see
here, you are root at rate local host.
So this is the host name and this is my
uh username. Okay. Root. So earlier you
might have noticed that there was a
dollar symbol. Okay. But now it is a
hash. So this basically this hashtag
represents that we are inside the root
user and we are accessing the you know
executing commands as a root user. So
that's what it means. And if you want to
get out or exit the root user then you
can just type exit and give enter. So
now you're back as yourself. Now you're
going to be executing commands as EDA
user. Okay. And uh another thing that
you can do is if you have multiple
users. Okay. And if you want to switch
to one of the other users then you can
also give the su command and go to
switch to the user. Uh supposing the
username is uh let's say ABC is the
username. Then I can just give su space
ABC. Okay. Now since I don't have any
user uh uh you know a user account
called ABC, it will probably throw me an
error or tell me that it does not exist.
Okay. But the point that you need to
note is that if you have any user then
you can just switch to that user from
the terminal by using the su command.
Okay, su space the name of the user
account. So again uh later during the
session there's a topic about creating
and deleting user. So at that time I
will show you how you can switch to
another user uh from the terminal. Okay.
So let's park it for for later because
uh it's a little complicated if I tell
you that right now. So u I think I've
covered pretty much uh everything about
su and there's one other command called
pseudo. Okay. So p sudo basically lets
you execute a particular command as a
root user. So when I give uh sudo and ls
then what happens is uh this particular
command ls command which will list down
all the other directories or folders in
the current working directory. Right? So
this will be executed as a root user.
Okay. So uh similarly so earlier I
excluded the su command and I gave a
password for that. The difference
between the two is that with the help of
p sudo then only that particular command
will be executed as a root user. But
whereas with su then the entire set of
commands after that will be executed as
the root user as you will be logged in
as a root user itself. So let me just
show it to you again. So this was the ls
command which I executed as a pseudo
user. Okay as a pseudo user or as a root
user. But if I just uh give su and if I
give the password then I enter and I can
uh enter the same details. Okay, I can
put the same command ls as a root user.
So basically the kind of results I get
will be the same. Okay, but it's just
the difference is that the uh user that
will be executing that particular
command. So I hope uh this clears your
doubt. Okay, so I'm just going to say
exit and clear the screen. And if I go
back to my slides, I'll just read out
the definition. So sudo basically
executes only that particular command
with the root or the super user
privileges. Okay. And when you give
pseudo username, you can switch to a
different user. And when you give SEO,
you can switch to the root user. So
that's what uh I showed you the
differences between the three. You first
give SEO and then it'll ask you for the
password. You specify the password and
then you'll be logged in as a root user
and then you can execute your commands.
You can execute any number of commands
you want to and then you can exit that
particular root access and then come
come out of it. And if you want to
execute another command with the uh root
permission. Okay. And if it's just one
command which you want to execute, then
you can just give uh p sudo and then you
can put your command there. Right? So I
will uh you know talk about these things
later. But uh for now what you need to
understand is the basics and these are
the basics. Okay. The pbwd the echo the
su commands because all these things
come in handy when you go to the
advanced uh concepts. So going on to the
next slide we have the ls commands here.
Okay. I showed you one command that is
what happens when you just put the ls
command. So now there are different
options that you can uh use along with
the ls right. So basically ls stands for
listing all the contents in the current
working directory. Okay. And uh if I go
back to my slides right now we are in
the uh home directory and if I give ls
here it list down all the directories
that are uh present in my home
directory. Okay. So let me just clear
the screen and execute that again. ls.
So uh right now we have desktop,
downloads and music. So these three are
some folders. We have documents which is
another folder. All these things are
folders and these are documents. Okay,
documents and files. So these are the uh
directories or folders. These are the
documents or files. So this is what you
get when you execute the ls command. Now
if you go to the slides then you will
notice that you have certain options
that you can type along with the ls. So
when you say ls path then you can uh you
know probably list down the list of
contents that is there in that
particular path. Okay. Uh let me go back
to the uh terminal. If I say ls and if I
say the path where I want to list down
the contents. Okay. Right now I might be
in the home directory. Okay. But what if
I want to list down the contents that
are present in the desktop directory.
Then at that time I can use ls path. So
what I'll do is uh I can just put
desktop. Okay. And inside desktop there
are many other folders. If you remember
there's one folder called LMS. So if I
put LMS okay this is the path right? So
I have given ls followed by the path
desktop/ lms. Now if I give enter then
the uh folders or the directories that
will be present in this uh particular
directory or this folder will be
displayed to me that is hbase hive map
produce uzi and ping. So that is what ls
and path does. Now if you go to the
slides there are other options right. So
these options they can be also referred
to as flags. So there is a hyphen
followed by one letter character. Okay
there's one character here that is l.
There is a character called a. There's
another set of characters here author.
So all these are called options or
they're also called as flag. We refer to
them as l flag or a flag or author flag.
All these things. Okay. Now if you give
the L flag what happens is it lists down
all the contents similar to just giving
ls but along with its owner settings its
uh permissions and the time stamp. So
when we say owner settings permissions
and time stamp it is with respect to uh
the particular folder inside that
directory. So let me show you an example
of that. So by uh giving ls you have all
the different folders that are present
in this root directory. Okay. Now if I
give ls -l l so the same directories or
same documents are listed down here but
we have additional uh options here right
so we have additional information so
these are the set of permissions that a
particular user has we have different we
have username and we have the host name
we have the memory size we have the date
the time stamp and all these things
followed by the name of the file so if
you see desktop desktop is something uh
it was created on this day and this is
the size of it and all these things okay
This is called the long format. I will
explain each of these permissions and
what each of these stands for. What one
stands for? what is eda here and what is
eda here I'll explain the all these
things in some more time because before
I explain those things there are other
commands which I want to show with
respect to ls right so in ls other than
ls minus l you have ls minus a you have
ls author okay so let's see what happens
when we give the a flag it should
ideally show you the list of all the
hidden contents in the specified
directory okay and then if it's uh if
you're using the author flag then it'll
list down all the contents in that
directory along with its owner correct
Okay. So let's try executing ls - a
first. So when we give a all the hidden
directories also should be displayed. So
as you can see these were the other uh
folders which were not visible when I
gave just ls because ls just shows the
list of contents that are available in
the GUI. Right? So in the GUI if you go
to uh if you go to desktop from the GUI
aspect you only get to see these. Okay.
So these are the regular files which are
not hidden. But of course there are
going to be many hidden and those can be
accessed by uh the terminal by giving
the ls minus a command. Okay. So that is
what this uh helped in doing. Now if I
give ls and if I use the author flag now
see what happens. You have the author
also. So instead of having the username
and the host name here you have the
author of that particular uh document.
So if this is the particular uh folder
or file or a document then who is the
author for that? It is eda because I'm
the user right. So the author name will
be present over here followed by the
size and the time stamp it was created
and all these things and we get the list
of contents for all the directories or
folders which are present in uh that
particular uh directory. So that's what
ls does. Okay. So guys uh that was about
uh the author flag and uh in case we
want to use a combination of uh these
flags then even that is possible. So I
showed you earlier that there is this ls
minus l flag and then there is ls minus
a flag right. So minus a displays all
the hidden contents in that directory.
So let me use a combination of them. So
let me say ls - l and a since there are
two flags which I want to use then I'm
just going to use one hyphen symbol for
two different flags. So when I do this
then all the hidden contents will also
be displayed along with their extended
long format. Okay. So uh those are the
different folders or directories which
are present in this uh home directory of
mine. Okay. So that is the combination
of ls minus l and ls - a. So we saw a
combination and again so similarly if I
instead of those flags if I use the
hyphen s flag then it will sort that
entire list by the size. Okay. And let
me show you an example of that. So we
used ls minus l. Right? Now if I use s
over here, it will sort this entire list
of directories with the size. The high
the the folder with the largest size
will be on top and the one with the
smallest size will be at the bottom. So
as you can see here, it was all jumbled.
It was uh this is basically the size
block. Right? So this is basically for
the size block. Here if you see the
previous time when I just ran ls - la
then it was in a different order. But uh
since I ran ls hyphen LA and capital s
this has sorted the result in as per the
uh size of the blocks of the folders the
folder with the highest size is
displayed first and the one with the
lowest is displayed last. So that is
about the ls - hyphen s. So there is one
more command that I want to uh show you
which can be executed with the help of
the ls command. Okay, we executed the
lsy l a and s flags right. So we
executed this one previously. Now what
if you want to uh store these details?
So whatever the output here was, if you
want to store it into another file, how
will you do that? We have uh an option
for that. Okay, and that is this symbol
greater than symbol. Okay, it's called
the direction flag. Input output
direction flag. And by using this flag,
whatever the result or the output of the
command that comes right prior to this
symbol, those will be stored in the file
that precedes this symbol. So let's say
that you know I want to create a new
file. I'm going to create that. Okay,
I'm currently in the home directory,
right? So, let's not execute it here.
What I'm going to say is uh let me first
change directory to documents. Okay.
Now, in here, of course, uh I don't
think there are any uh hidden documents
either. So, there are no folders here.
So, what I'm going to do is u ls minus l
a s. Okay. And I'm going to run the uh
this command at the home/reure
directory. Okay, I'm going to uh
basically run the same l. So basically
this same results I will run them by
specifying this uh directory and I will
be storing this file inside my new file.
Okay. Now let me name that file file 1.xt.
1.xt.
Okay. Now uh the reason I moved to uh
this directory is because I can store
the file in this directory. Okay. Uh had
I not moved to this directory and had I
just executed this uh ls minus l
followed by uh this direction then what
would have happened is it would have
just created this new file in my the
home directory itself. Okay. So if I
give an enter here there's a new file
that would have been created under my uh
documents directory. Okay. Now when I
ran ls inside documents there was no
folder but now let's uh run ls. So now
you can see that there's a new file
that's created and that is called file
1.xt. Now that is because I uh used this
uh direction symbol nothing but the
greater than uh symbol and when I do
this whatever result that gets generated
from uh this command right from these
options on these flags those will be
stored in a new file and uh the file
Okay, so that was the wrong command that
I used. It's not ls. So, uh what I need
to do is let me just view that file.
Okay, so to view this particular file or
any file, we have to use the vi editor
or we have to use a gedit editor or we
can use the cat command. Okay. Now, the
most common one is the vi editor. So,
let's uh just execute the vi and open
this file from here. Okay. And the
reason that this ls do file did not
execute was because it listed down the
files, right? And this is a wrong usage.
I did a mistake by specifying ls and uh
by not giving a directory. So I should
have used vi instead. So that's why that
did not come. But anyways, if I give vi
and file name, then that file opens,
right? So the file which I created and
this file has the output that was
displayed earlier. Okay. So basically
whatever was generated by the ls and a
flags of ls. So that result instead of
coming in the terminal, it got stored in
a different file. Okay. Now uh let's
just exit this via file and explain the
same thing. So what you saw inside this
file file 1.txt the content is the same
as uh this one. Okay. So we ran the same
command ls- l but it is that instead of
getting the output in the terminal we
gave a direction command over here to uh
save it in a different uh file and we
stored this file in the home/ora
directory. Okay. Now supposing if I want
to store this file in the same directory
then even that can be done okay it's not
a big deal so this is the command right
so if I remove the path over here then
what happens is whatever the output gets
that gets generated from uh this option
and this command that will be stored in
the file one txt inside my uh home
directory okay if I'm inside the
documents directory right so let me just
go back one path so right now I am
inside the uh home directory right so
here if I execute that command. Okay.
Then a new file will be created with uh
the name file 1.exe and it will have the
same details. So I'm have done that and
uh let's see what are the contents of
that file. Okay. So it's nice right? So
you can uh in this way whatever output
that you have that you can directly
store it into another file. So it's a
very handy uh command and a very handy
option and I'll uh talk about more such
advantages like this later. Okay. So for
now I just wanted to show you how the
direction uh works. So uh getting back
to my slides I think I've shown you how
to work with uh the ls uh command and in
the previous slide I showed you the
basic commands with respect to uh
present working directory and clear
directory and the sudo and the echo
commands. So I've done with ls also and
now I'm going to show you how to work
with the cd directory. So some of the CD
directories I showed you earlier also I
showed you how to switch to a new
directory. So uh when you type CD it'll
just change the directory to the home
directory. Okay. So the /home/ora.
Okay. Now that is my home directory. My
home directory is set to that path. So
if I go cd it will uh go to that
particular home directory. And uh
similarly if I uh you know give even cd
and space till day symbol as you can see
here then even this command will uh
change the directory to the home
directory. Okay. But however if you give
uh cd space uh just slash this will
change it to the root directory. So it
changes the current directory to the
root directory. That is because uh the
forward slash here it represents the
root. I uh told you this number of times
earlier. Okay. And if there's any other
path or any other folder which you want
to move to then you start from the root.
So you specify the absolute address
right you start from the root you say
slash and then you put the folder name
you again uh say slash and then you put
the next folder name. So uh it is
similar to that the first forward slash
represents the uh root directory and the
subsequent slashes are to differentiate
between the different parent and the uh
subdirectories. So that's what they are.
So this will change you to the root
directory and then you have the uh cd
double period mark okay two period
symbols and when you give uh cd space
dot right if you give two dots cd space
dot dot then it will change to parent
directory. So supposing I'm inside the
desktop directory. So desktop's parent
is home directory right? So it will
change me to the home directory. But
supposing if I was uh inside let's say
the uh if I'm inside a directory called
uh directory C and if C's parent was B
then by running CD space dot dot from
the C directory then it will switch me
to the parent directory which is B. So
that's what this does and then we have
one more command here that is uh cd
within single quotation marks we have
some kind of path. Now this is useful at
times when your folder name or your
directory name has two words. Okay. So
if you have two words then if you have a
space in between then the space will be
considered as an argument. Okay. So
terminal will consider that as an
argument. So if you want to switch to a
document in that kind of a situation you
know or if you want to switch to a directory which has a space or a
directory which has a space or a document which has a space in the
document which has a space in the middle. So in that kind of situation you
middle. So in that kind of situation you can use a single quotation mark or
can use a single quotation mark or double quotation mark. Okay. So it's uh
double quotation mark. Okay. So it's uh you know you also have the comfort to
you know you also have the comfort to switch to double quotation mark. So I'll
switch to double quotation mark. So I'll execute all these things and show you.
execute all these things and show you. Okay. So first I'll show you the uh the
Okay. So first I'll show you the uh the CD till day then with the forward slash
CD till day then with the forward slash then with the dot mark. This of course I
then with the dot mark. This of course I showed you earlier also and then I'll
showed you earlier also and then I'll show you how to switch to another folder
show you how to switch to another folder with you know which is having two
with you know which is having two different names with a space in the
different names with a space in the middle. So going back to my uh root. So
middle. So going back to my uh root. So um right now we are inside the uh home
um right now we are inside the uh home directory itself. So if I give uh cd
directory itself. So if I give uh cd desktop okay now in here we have my
desktop okay now in here we have my other directories. And if I do cd and
other directories. And if I do cd and lms, I'm inside the lms directory. Okay.
lms, I'm inside the lms directory. Okay. Now from here if I give cd and if I give
Now from here if I give cd and if I give use the till day option, right? Then it
use the till day option, right? Then it will switch me to the uh root directory.
will switch me to the uh root directory. Uh so see this was the t symbol earlier.
Uh so see this was the t symbol earlier. Okay. So this t symbol represents root
Okay. So this t symbol represents root and since I said change directory to t
and since I said change directory to t symbol this which implies root, it
symbol this which implies root, it basically uh decodes it as change
basically uh decodes it as change directory to the root directory. So when
directory to the root directory. So when I did that I have automatically switched
I did that I have automatically switched to root directory while earlier it was
to root directory while earlier it was LMS. So uh similarly if you're in the uh
LMS. So uh similarly if you're in the uh LMS directory and if you also just press
LMS directory and if you also just press CD right if you just give this command
CD right if you just give this command even this will switch you to the root
even this will switch you to the root directory. So basically uh cd and cd
directory. So basically uh cd and cd space till day they are uh both the same
space till day they are uh both the same but uh however if you give cd with
but uh however if you give cd with forward slash then it will uh switch you
forward slash then it will uh switch you to the root directory. So when I give
to the root directory. So when I give enter as you can see I'm in the root
enter as you can see I'm in the root directory. So if I give ls over here I
directory. So if I give ls over here I have a list of other directories which I
have a list of other directories which I showed you earlier. So in in your file
showed you earlier. So in in your file system right so yeah so inside your file
system right so yeah so inside your file system if you open this folder then you
system if you open this folder then you have the root directory. So inside this
have the root directory. So inside this directory you have home and network and
directory you have home and network and this is where desktop and documents are
this is where desktop and documents are all present as a subdirectory of this
all present as a subdirectory of this parent directory. Okay. So this is the
parent directory. Okay. So this is the root directory where everything is
root directory where everything is stored. So any document or any folder in
stored. So any document or any folder in Linux operating system, they can be
Linux operating system, they can be referred or they can be accessed from
referred or they can be accessed from this root directory. Okay. Now going
this root directory. Okay. Now going back to the terminal, let me show you an
back to the terminal, let me show you an example of that. I've already moved to
example of that. I've already moved to the uh root directory. Now let me say cd
the uh root directory. Now let me say cd bin and uh okay, we have this. So now
bin and uh okay, we have this. So now when I uh give cd space bin, then it
when I uh give cd space bin, then it moved me to the bin folder inside my
moved me to the bin folder inside my root directory. So uh I ran the root
root directory. So uh I ran the root directory. I did an ls which listed down
directory. I did an ls which listed down the list of uh folders inside my root
the list of uh folders inside my root directory. These were the options uh
directory. These were the options uh bin, boot, dev. These are all the
bin, boot, dev. These are all the different folders. And when I said
different folders. And when I said change directory to bin, it uh shifted
change directory to bin, it uh shifted me or it moved me to this particular
me or it moved me to this particular folder. Okay. Inside the root directory.
folder. Okay. Inside the root directory. So right now I am in the bin directory
So right now I am in the bin directory and inside the bin directory I ran the
and inside the bin directory I ran the ls command which basically uh means
ls command which basically uh means listing down all the uh contents whether
listing down all the uh contents whether it's documents or whether it's uh
it's documents or whether it's uh folders or directories all those will be
folders or directories all those will be listed down. Okay so these are the list
listed down. Okay so these are the list of all those uh contents in the uh bin
of all those uh contents in the uh bin directory. Okay now that we are in bin
directory. Okay now that we are in bin let me go back to my root directory by
let me go back to my root directory by giving double dot. Okay so from bin it
giving double dot. Okay so from bin it again I I go back to my uh uh root
again I I go back to my uh uh root directory. Okay, so this uh forward
directory. Okay, so this uh forward slash represents root directory like I
slash represents root directory like I told you earlier. And if I do ls then
told you earlier. And if I do ls then I'm back to this directory where we have
I'm back to this directory where we have bin boot dev and etc home and all these
bin boot dev and etc home and all these things. So now what I'm going to do is
things. So now what I'm going to do is uh so now that I'm in the root directory
uh so now that I'm in the root directory now let me say change directory to home
now let me say change directory to home and inside home there is EDA I want to
and inside home there is EDA I want to go to EDA inside EDA let's go to desktop
go to EDA inside EDA let's go to desktop and then there is LMS okay and uh in
and then there is LMS okay and uh in here if I do ls then these are the list
here if I do ls then these are the list of uh folders here okay now I'm going to
of uh folders here okay now I'm going to change directory to hbase and if I do an
change directory to hbase and if I do an ls over here then you can see that there
ls over here then you can see that there is one particular folder called advanced
is one particular folder called advanced hbase practicals module 9. Okay, if I
hbase practicals module 9. Okay, if I now just say cd and if I put adv space
now just say cd and if I put adv space hb then I will not be able to autofill
hb then I will not be able to autofill the option. Okay, that's because uh the
the option. Okay, that's because uh the terminal or the CLI is not able to
terminal or the CLI is not able to recognize this particular uh command
recognize this particular uh command because there's a space over here. Okay,
because there's a space over here. Okay, so it treats ADV as a separate folder.
so it treats ADV as a separate folder. But since it's not able to find any
But since it's not able to find any folder here as ADV, that is the uh
folder here as ADV, that is the uh problem. Okay, let me show you via the
problem. Okay, let me show you via the GUI what it looks like. So we are in the
GUI what it looks like. So we are in the desktop and inside LMS we have hedgebase
desktop and inside LMS we have hedgebase inside hedgebase we have advanced
inside hedgebase we have advanced hedgebased practical. So this was what I
hedgebased practical. So this was what I was talking about this particular
was talking about this particular folder. Correct. So let me minimize this
folder. Correct. So let me minimize this for you. Okay. Now this is a classic
for you. Okay. Now this is a classic situation of when you need to use double
situation of when you need to use double quotation mark or single quotation mark.
quotation mark or single quotation mark. Okay. Now if I just uh put the same name
Okay. Now if I just uh put the same name uh like say ADV and uh
uh like say ADV and uh hedge base then it kind of autofills
hedge base then it kind of autofills automatically right. So even the
automatically right. So even the quotation mark ends over here. So that
quotation mark ends over here. So that indicates that this is another folder
indicates that this is another folder that's present. So if I uh you know just
that's present. So if I uh you know just put enter then it will change my
put enter then it will change my directory to this particular folder. So
directory to this particular folder. So that is what the uh quotation mark does.
that is what the uh quotation mark does. So when I do enter then I'm inside this
So when I do enter then I'm inside this folder. When I do ls I have the list of
folder. When I do ls I have the list of folders and directories inside this
folders and directories inside this advanced hbase practicals folder. All
advanced hbase practicals folder. All right, guys. So, I'm just going to do a
right, guys. So, I'm just going to do a CD to my home directory. And I'm here.
CD to my home directory. And I'm here. And that was about the different uh CD
And that was about the different uh CD commands that are available which I
commands that are available which I wanted to show you. Okay. So, let me
wanted to show you. Okay. So, let me just go back to my slides now and go to
just go back to my slides now and go to the next slide. I showed you all the uh
the next slide. I showed you all the uh different commands here. Okay. So, the
different commands here. Okay. So, the next set of commands that I'm going to
next set of commands that I'm going to talk about are those of cat, GP, sort,
talk about are those of cat, GP, sort, and pipe commands. Okay. So uh let's
and pipe commands. Okay. So uh let's first go to the next slide and start off
first go to the next slide and start off with cat command. Okay. So when would we
with cat command. Okay. So when would we use the cat command guys? So it's pretty
use the cat command guys? So it's pretty obvious right from what it's written
obvious right from what it's written here. It says when you're working with
here. It says when you're working with files that time you can use the cat
files that time you can use the cat command. So uh the cat command it is
command. So uh the cat command it is basically used to display the content of
basically used to display the content of the text files and concatenate several
the text files and concatenate several files into one. So uh what this means is
files into one. So uh what this means is if I have a particular uh you know I
if I have a particular uh you know I have a text file. So earlier we created
have a text file. So earlier we created one text file having all the file
one text file having all the file permissions right. So if I have that
permissions right. So if I have that kind of a text file and if I want to uh
kind of a text file and if I want to uh display the content of that text file
display the content of that text file then I can use the cat command. I can
then I can use the cat command. I can say cat and if I give the file name then
say cat and if I give the file name then that content will be displayed. So when
that content will be displayed. So when I use only the cat command with one file
I use only the cat command with one file name it's very similar to how the vi
name it's very similar to how the vi command works or how the nano command
command works or how the nano command works right. So it will display the
works right. So it will display the content in the terminal itself.
content in the terminal itself. Correct. But the difference with cat
Correct. But the difference with cat command is that with cat I can list down
command is that with cat I can list down the contents of multiple files. So it's
the contents of multiple files. So it's not just one. Okay. I can have I can
not just one. Okay. I can have I can even display I can specify three
even display I can specify three different file names. And if I put enter
different file names. And if I put enter then the content of all the three files
then the content of all the three files will be displayed in my terminal. The
will be displayed in my terminal. The same thing won't happen with vi. So if I
same thing won't happen with vi. So if I say vi then only that particular files
say vi then only that particular files content will be displayed. So same thing
content will be displayed. So same thing with nano right. So uh let me just go to
with nano right. So uh let me just go to the terminal and show you an example of
the terminal and show you an example of the cat command. So right now we are in
the cat command. So right now we are in the cd directory. Let me just maximize
the cd directory. Let me just maximize this. Okay, I'm going to clear the
this. Okay, I'm going to clear the screen. Present working directory is uh
screen. Present working directory is uh the home/rega directory. This is the uh
the home/rega directory. This is the uh home directory. And from here let me go
home directory. And from here let me go to uh documents. Okay. If I do an ls,
to uh documents. Okay. If I do an ls, there is this file one.exe which I
there is this file one.exe which I created earlier. Correct? So this was
created earlier. Correct? So this was where the different file permissions
where the different file permissions were present. Right. So if I do cat
were present. Right. So if I do cat hyphen file name and if I give enter
hyphen file name and if I give enter then I get the list of the contents of
then I get the list of the contents of that particular file. So in that file
that particular file. So in that file there are only these three rows because
there are only these three rows because this was the latest updated permissions
this was the latest updated permissions that I specified in the file 1.xt. Okay.
that I specified in the file 1.xt. Okay. So guys I earlier told you that you can
So guys I earlier told you that you can enter uh details to a file by using the
enter uh details to a file by using the direction command. Right? So that was
direction command. Right? So that was the greater than uh symbol. So I'm going
the greater than uh symbol. So I'm going to use that kind of a symbol over here
to use that kind of a symbol over here and I'll create a new file by adding
and I'll create a new file by adding details by using that command. Okay. So,
details by using that command. Okay. So, initially it was I used the ls minus l.
initially it was I used the ls minus l. But this time I'll use the cat command
But this time I'll use the cat command itself and uh say I'm going to give the
itself and uh say I'm going to give the direction symbol here and when I'm done
direction symbol here and when I'm done with that let me give the name of the
with that let me give the name of the new file. Let's say file 2.txt. Now when
new file. Let's say file 2.txt. Now when I hit enter the command is not executed
I hit enter the command is not executed completely. Okay. So I'm inside this
completely. Okay. So I'm inside this place where I can enter the text. So
place where I can enter the text. So it's basically going to create a new
it's basically going to create a new file. Okay. Now whatever text I enter
file. Okay. Now whatever text I enter here that will be stored inside this
here that will be stored inside this file. So uh let's say hi
file. So uh let's say hi my name is uh Vardan and if I give enter
my name is uh Vardan and if I give enter I can go to the next line and uh here
I can go to the next line and uh here let's say
let's say welcome to
welcome to Linux
Linux tutorial by
tutorial by Edurea.
Edurea. Okay now if I want to uh you know just
Okay now if I want to uh you know just add these two lines to this particular
add these two lines to this particular uh file called filecore.txt txt then I
uh file called filecore.txt txt then I can press Ctrl D now. Okay, by pressing
can press Ctrl D now. Okay, by pressing Ctrl D I come back to my uh command
Ctrl D I come back to my uh command line. So what this command basically
line. So what this command basically does is this cat command would have uh
does is this cat command would have uh created a new file file 2.txt and the uh
created a new file file 2.txt and the uh text that we entered below it right uh
text that we entered below it right uh this will be entered inside this text.
this will be entered inside this text. So if I do cat file 2 txt then whatever
So if I do cat file 2 txt then whatever I typed earlier that got saved in this
I typed earlier that got saved in this file. Now similarly if you see the uh
file. Now similarly if you see the uh file 1.txt
file 1.txt the contents are these. Okay. So this is
the contents are these. Okay. So this is the contents of this one and this is the
the contents of this one and this is the content of uh this file. Now I told you
content of uh this file. Now I told you that with the help of cat command you
that with the help of cat command you can uh display the content of two
can uh display the content of two different files. So let me show you that
different files. So let me show you that option. Okay. I'm going to say file 1.xt
option. Okay. I'm going to say file 1.xt and then I'm going to say file 2.xt. So
and then I'm going to say file 2.xt. So in this way I'm going to basically
in this way I'm going to basically display two files cat. I want to display
display two files cat. I want to display file one and file two. When I give
file one and file two. When I give enter, first the file two contents will
enter, first the file two contents will be displayed and then the file two
be displayed and then the file two contents or the lines in file 2.txt will
contents or the lines in file 2.txt will be displayed. Right? So first these were
be displayed. Right? So first these were the permissions that were there in the
the permissions that were there in the first file and then uh this was what was
first file and then uh this was what was there in the second file. All right
there in the second file. All right guys, now uh this brings us to another
guys, now uh this brings us to another important concept of how to append
important concept of how to append files. So cat basically stands for
files. So cat basically stands for concatenate, right? So that's the most
concatenate, right? So that's the most important option. So if you want to
important option. So if you want to concatenate a particular file with you
concatenate a particular file with you know some kind of lines then I showed
know some kind of lines then I showed you how that is done by creating a new
you how that is done by creating a new file what I did was I I created a new
file what I did was I I created a new file file 2.xt and I concatenated these
file file 2.xt and I concatenated these lines into this particular file. So if I
lines into this particular file. So if I just give cat and uh if I give file one
just give cat and uh if I give file one dot txt and if I give uh double marks
dot txt and if I give uh double marks okay so double direction marks which is
okay so double direction marks which is uh nothing but the greater than symbol
uh nothing but the greater than symbol okay we also call it direction marks. So
okay we also call it direction marks. So if you uh give file 1.txt and followed
if you uh give file 1.txt and followed by this if you give file 2 txt then
by this if you give file 2 txt then what's going to happen is whatever
what's going to happen is whatever contents are there in file one those
contents are there in file one those will get appended or concatenated to
will get appended or concatenated to this file 2 txt okay so in my file.txt
this file 2 txt okay so in my file.txt txt we have these two lines. Okay. Hi,
txt we have these two lines. Okay. Hi, my name is Van and welcome to Linux by
my name is Van and welcome to Linux by Eda and file one has uh these three
Eda and file one has uh these three lines. So basically when I uh enter now
lines. So basically when I uh enter now there will be uh a file two in which
there will be uh a file two in which there will be extra lines. Okay. So let
there will be extra lines. Okay. So let me uh do a cat file 2.txt. So as you can
me uh do a cat file 2.txt. So as you can see initially when I ran my uh cat file
see initially when I ran my uh cat file 2 txt over here I had only these two
2 txt over here I had only these two lines right. But now after using the
lines right. But now after using the birectional uh symbol okay the direction
birectional uh symbol okay the direction symbol what has happened is I have three
symbol what has happened is I have three extra lines so it says hi my name is van
extra lines so it says hi my name is van welcome to Linux tutorial bya after that
welcome to Linux tutorial bya after that I have the permissions which was present
I have the permissions which was present in the previous uh file okay so uh
in the previous uh file okay so uh that's what happens here okay in fact
that's what happens here okay in fact it's actually four other lines thanks
it's actually four other lines thanks for pointing that out so Hmon you know
for pointing that out so Hmon you know who's another person on our session he
who's another person on our session he said that there are four lines in the
said that there are four lines in the 51.xt txt actually he's correct. So
51.xt txt actually he's correct. So total eight so this is the first line
total eight so this is the first line and these are the other three lines uh
and these are the other three lines uh so you can also see that from uh here
so you can also see that from uh here okay so the first time when I ran cat
okay so the first time when I ran cat file one.txt txe right I first got total
file one.txt txe right I first got total 8 this was the first line and after that
8 this was the first line and after that I got the permissions okay so this is
I got the permissions okay so this is the first line and then you have the
the first line and then you have the list of the other contents so when we
list of the other contents so when we ran the ls minus l the total number of
ran the ls minus l the total number of entries were right so that was what uh
entries were right so that was what uh this total 8 stands for so these are the
this total 8 stands for so these are the four lines that got appended to my file
four lines that got appended to my file 2 txt okay but however there wouldn't be
2 txt okay but however there wouldn't be any changes to my file 1 txt because I
any changes to my file 1 txt because I didn't make any changes there so let me
didn't make any changes there so let me anyway show you that also uh if you see
anyway show you that also uh if you see here again the contents here are the
here again the contents here are the same it's only that the file 2 has got
same it's only that the file 2 has got these four lines extra. So that is what
these four lines extra. So that is what the direction symbol does. So these are
the direction symbol does. So these are the uh advantages with the uh cat
the uh advantages with the uh cat command. All right. So um what I'm going
command. All right. So um what I'm going to do now is uh let me go back to my
to do now is uh let me go back to my slides and show you some more options.
slides and show you some more options. Okay. So we have flags like we have the
Okay. So we have flags like we have the B flag, the N flag, S flag and E flag.
B flag, the N flag, S flag and E flag. Let's see what each of those stand for.
Let's see what each of those stand for. Okay. So when we use the B flag, it's
Okay. So when we use the B flag, it's going to add line numbers to the
going to add line numbers to the non-blank lines. Okay. So whichever line
non-blank lines. Okay. So whichever line there is some text. So those lines are
there is some text. So those lines are going to be numbered. Okay? And when you
going to be numbered. Okay? And when you say minus n then it is used to add line
say minus n then it is used to add line numbers to all lines. It doesn't matter
numbers to all lines. It doesn't matter if it's blank lines or non-blank lines.
if it's blank lines or non-blank lines. It's just going to add numbers
It's just going to add numbers everywhere. Line numbers. Okay. And when
everywhere. Line numbers. Okay. And when you give the s flag, it is basically to
you give the s flag, it is basically to squeeze all the blank lines. Supposing
squeeze all the blank lines. Supposing you have three blank lines one after the
you have three blank lines one after the other. Then it will squeeze all those
other. Then it will squeeze all those blank lines and it will reduce it. Okay?
blank lines and it will reduce it. Okay? So that's what the S does. And then the
So that's what the S does. And then the e flag is going to show you a dollar at
e flag is going to show you a dollar at the end of each line. So let me go back
the end of each line. So let me go back to my terminal and show you this option.
to my terminal and show you this option. So first of all, let's see the cat file
So first of all, let's see the cat file 2.xt and uh let me use the uh flag minus
2.xt and uh let me use the uh flag minus n. So this will list the number of
n. So this will list the number of lines, right? So there are basically
lines, right? So there are basically four lines from file one and these were
four lines from file one and these were the two lines that were earlier present.
the two lines that were earlier present. So these are the six lines in total we
So these are the six lines in total we have in this file 2.txt. Okay, let me
have in this file 2.txt. Okay, let me just clear the screen cuz uh it's a
just clear the screen cuz uh it's a little uh tough to see everything,
little uh tough to see everything, right? So, yeah. So, when I ran the
right? So, yeah. So, when I ran the minus n command, the file 2.txt, the
minus n command, the file 2.txt, the lines in there were numbered. Okay, 1 to
lines in there were numbered. Okay, 1 to 6. Uh and then we have another uh flag
6. Uh and then we have another uh flag called minus b flag, right? Minus b flag
called minus b flag, right? Minus b flag will add numbers to also the uh
will add numbers to also the uh non-blank lines. So, but for that we
non-blank lines. So, but for that we need to first have blank lines over
need to first have blank lines over here. So, what we'll do is uh I'm going
here. So, what we'll do is uh I'm going to do a cat and uh do this and file
to do a cat and uh do this and file 2.txt. txt. So when I do this, I'll be
2.txt. txt. So when I do this, I'll be adding uh lines to this file 2.xt. Okay,
adding uh lines to this file 2.xt. Okay, I'll be appending lines over here. So
I'll be appending lines over here. So let me just give one blank line. Enter
let me just give one blank line. Enter some random text and then enter, you
some random text and then enter, you know, blank line and then random text.
know, blank line and then random text. Okay, so this is what I'm going to just
Okay, so this is what I'm going to just enter or append to my file 2.xt. Okay,
enter or append to my file 2.xt. Okay, you press Ctrl D to exit this. And now
you press Ctrl D to exit this. And now these would have been saved to my file
these would have been saved to my file 2.txt. So let me just run the same
2.txt. So let me just run the same command again. Oh, sorry. I should have
command again. Oh, sorry. I should have ran this cat file 2.txt. Okay, when I do
ran this cat file 2.txt. Okay, when I do this, as you can see, uh, it starts from
this, as you can see, uh, it starts from here. And these are the other lines that
here. And these are the other lines that were appended. Okay, and now if I use
were appended. Okay, and now if I use the cat hyphen B flag, okay, see what
the cat hyphen B flag, okay, see what happens. Only the non-blank lines are uh
happens. Only the non-blank lines are uh numbered, right? So these lines are not
numbered, right? So these lines are not numbered. But if I use the minus N which
numbered. But if I use the minus N which I used earlier, what it would do is it
I used earlier, what it would do is it will number each and every line. So
will number each and every line. So that's the difference between minusb and
that's the difference between minusb and uh the minus n flag. Okay. So n numbers
uh the minus n flag. Okay. So n numbers all the lines irrespective of it being
all the lines irrespective of it being empty or not. But whereas minus b
empty or not. But whereas minus b numbers only lines which are non-blank.
numbers only lines which are non-blank. Okay. So that is uh this one. And there
Okay. So that is uh this one. And there is another flag which is the uh hyphen s
is another flag which is the uh hyphen s flag. Okay. So it's not capital s it is
flag. Okay. So it's not capital s it is small s. Right. So when I say minus s
small s. Right. So when I say minus s then you get the list of the documents.
then you get the list of the documents. So as you can see here all the u spaces
So as you can see here all the u spaces are squeezed into one. Uh seems like
are squeezed into one. Uh seems like there were no multiple spaces right no
there were no multiple spaces right no multiple blank lines. So what we'll do
multiple blank lines. So what we'll do is let's edit the file 2.txt again. Okay
is let's edit the file 2.txt again. Okay or in fact let me open it via the uh
or in fact let me open it via the uh editor vi editor. Okay. So when I do
editor vi editor. Okay. So when I do this these are the uh existing ones. So
this these are the uh existing ones. So when you uh press insert or when you
when you uh press insert or when you press I button or insert button, you can
press I button or insert button, you can start entering text details inside this
start entering text details inside this file. Okay. Now u right now I'm here.
file. Okay. Now u right now I'm here. Let me add multiple blank lines here.
Let me add multiple blank lines here. Okay.
Okay. So as you can see there are around three
So as you can see there are around three blank lines here. 1 2 3 4 there are four
blank lines here. 1 2 3 4 there are four blank lines and here there are three
blank lines and here there are three blank lines. Okay. Now uh let me press
blank lines. Okay. Now uh let me press escape. Okay. Now if I give escape.
escape. Okay. Now if I give escape. Okay. So now we are in insert mode. So
Okay. So now we are in insert mode. So what I do is uh I'm going to press
what I do is uh I'm going to press escape and then followed by that if you
escape and then followed by that if you give colon and wq this would uh save
give colon and wq this would uh save this file. Okay. So I've made changes
this file. Okay. So I've made changes right? I've added lines here. So it
right? I've added lines here. So it would save that changes and it would
would save that changes and it would quit the vi editor mode. So if I give
quit the vi editor mode. So if I give enter so I'm outside that file. So now
enter so I'm outside that file. So now if you see the uh cat file 2.xt then it
if you see the uh cat file 2.xt then it has additional lines right. So uh now
has additional lines right. So uh now I'm going to run the command that I ran
I'm going to run the command that I ran earlier. Cat hyphen flag s and then file
earlier. Cat hyphen flag s and then file name. So when I do this all the uh
name. So when I do this all the uh multiple blank lines are squeezed into
multiple blank lines are squeezed into one. So as you can see here there there
one. So as you can see here there there have been multiple lines here when I ran
have been multiple lines here when I ran the file 2.xt. But here when I ran the
the file 2.xt. But here when I ran the cat hyphen with the s flag then there
cat hyphen with the s flag then there are all these multiple black things are
are all these multiple black things are squeezed into one. Okay. So that is uh
squeezed into one. Okay. So that is uh the option with the cat command. Okay.
the option with the cat command. Okay. So I think with that I think I've
So I think with that I think I've covered all the different option. Okay,
covered all the different option. Okay, there is one left. There is uh the minus
there is one left. There is uh the minus E option, right? So okay, now let me
E option, right? So okay, now let me show you what that does. So when we use
show you what that does. So when we use the capital E flag, okay, there is a
the capital E flag, okay, there is a dollar sign that is appended after every
dollar sign that is appended after every line. So uh the first line is total
line. So uh the first line is total eight or let's say the first line is
eight or let's say the first line is this one. So there's a dollar sign here
this one. So there's a dollar sign here and after this line, there's a dollar
and after this line, there's a dollar sign. After this, there's a dollar sign.
sign. After this, there's a dollar sign. And since these are blank lines, you'll
And since these are blank lines, you'll only find the dollar sign here. And
only find the dollar sign here. And again after this one you have a dollar
again after this one you have a dollar sign and uh you know blank lines have
sign and uh you know blank lines have dollar signs and yeah so that's how the
dollar signs and yeah so that's how the uh e flag works. Okay so every the end
uh e flag works. Okay so every the end of the line is uh appended with the
of the line is uh appended with the dollar symbol. Okay so with this I'm
dollar symbol. Okay so with this I'm done with all the uh cat commands. So
done with all the uh cat commands. So going back to my slides now let's go to
going back to my slides now let's go to the uh next command that is gp. Okay. So
the uh next command that is gp. Okay. So uh grip command working with grip
uh grip command working with grip command. So what does the grip command
command. So what does the grip command do? you guys have any idea? Okay. Well,
do? you guys have any idea? Okay. Well, I don't expect you people to but uh
I don't expect you people to but uh yeah. So, if people if any of you know
yeah. So, if people if any of you know if you have an introduction to Linux,
if you have an introduction to Linux, then you can answer it. But it's fine if
then you can answer it. But it's fine if you don't because I'm going to explain
you don't because I'm going to explain that. It's my duty. And the grip command
that. It's my duty. And the grip command is basically used to search for a
is basically used to search for a particular string or a word in a text
particular string or a word in a text file. Right? We have a file document
file. Right? We have a file document like the one which we created. Now, like
like the one which we created. Now, like we we have two documents like file 1.xt
we we have two documents like file 1.xt and file 2.xt. And what if you want to
and file 2.xt. And what if you want to search for a particular string, right?
search for a particular string, right? Or a particular uh word. So in this case
Or a particular uh word. So in this case it's pretty simple because you can
it's pretty simple because you can easily find them. But what if you want
easily find them. But what if you want to do it to uh you know a very big file
to do it to uh you know a very big file document which has like millions of
document which has like millions of lines right? So supposing you have any
lines right? So supposing you have any document then you'll have multiple lines
document then you'll have multiple lines right and if you want to find one
right and if you want to find one particular word or if you want to go to
particular word or if you want to go to one particular string then how will you
one particular string then how will you do it? So in Windows you have the
do it? So in Windows you have the control F option right but via a CLI you
control F option right but via a CLI you can't use it right? So via CLI you use
can't use it right? So via CLI you use the uh grip command okay and the format
the uh grip command okay and the format for executing the command is this. So
for executing the command is this. So you specify gp and then you specify the
you specify gp and then you specify the string that you want to search for. So
string that you want to search for. So options is the string that I have
options is the string that I have searched in this command and then the
searched in this command and then the file name. Okay. And this will return
file name. Okay. And this will return the result of the matching string
the result of the matching string options. So similarly if you use the i
options. So similarly if you use the i flag then it will uh return the results
flag then it will uh return the results for even case insensitive strings. So
for even case insensitive strings. So basically if you do not use the i flag
basically if you do not use the i flag then it is uh it's case sensitive right?
then it is uh it's case sensitive right? So it'll only search for options with
So it'll only search for options with these letters. But if there is a word
these letters. But if there is a word called options with a capital O where
called options with a capital O where the first letter is capitalized then uh
the first letter is capitalized then uh in that case only when you use I will
in that case only when you use I will even that particular result be uh shown.
even that particular result be uh shown. Okay. So that is the advantage with the
Okay. So that is the advantage with the I flag and then you have the N flag
I flag and then you have the N flag which is the GP hyphen N which will
which is the GP hyphen N which will again returns the matching strings along
again returns the matching strings along with their line number in which line was
with their line number in which line was that or that word found. So that's what
that or that word found. So that's what N does. And when you give minus v flag
N does. And when you give minus v flag then what happens is uh you will not be
then what happens is uh you will not be shown the list of lines where the
shown the list of lines where the results were present but instead you
results were present but instead you will be shown the list of lines where
will be shown the list of lines where the results were not found where there
the results were not found where there was no matching string right so those
was no matching string right so those lines will be printed with the help of v
lines will be printed with the help of v flag and then with the c flag it returns
flag and then with the c flag it returns the number of lines in which the uh
the number of lines in which the uh results matched the search string. So
results matched the search string. So supposing you have like four words.
supposing you have like four words. Okay, you have a big document and uh
Okay, you have a big document and uh your word your string matched four times
your word your string matched four times then uh if you use the minus C flag then
then uh if you use the minus C flag then it will display the number four instead
it will display the number four instead of displaying the search string. Okay.
of displaying the search string. Okay. So let me go to the uh VM let me go to
So let me go to the uh VM let me go to my uh CentOS and uh show you how to
my uh CentOS and uh show you how to execute these commands. Okay. So right
execute these commands. Okay. So right now we are in the documents folder. If I
now we are in the documents folder. If I want to execute that then we need to
want to execute that then we need to edit this in a different way. Okay.
edit this in a different way. Okay. Okay, we need to have a different text
Okay, we need to have a different text and this directory has uh these
and this directory has uh these documents, right? So, let me just
documents, right? So, let me just quickly go to the uh documents folder
quickly go to the uh documents folder and here if I do an ls, we have the two
and here if I do an ls, we have the two files which we created. We have file
files which we created. We have file 2.txt and file 1.txt.
2.txt and file 1.txt. So, what I'm going to do is uh I'm going
So, what I'm going to do is uh I'm going to see what's there in file 1.txt.
to see what's there in file 1.txt. Okay, so let me edit this file. Okay. Or
Okay, so let me edit this file. Okay. Or let's say let's just create a new file.
let's say let's just create a new file. What do you say? We can create a new
What do you say? We can create a new file by uh doing this, right? By uh
file by uh doing this, right? By uh giving the direction symbol followed by
giving the direction symbol followed by the uh name of the file. Let's say
the uh name of the file. Let's say automobiles. Automobiles.
automobiles. Automobiles. This is the name of my uh file
This is the name of my uh file automobiles.txt.
automobiles.txt. And I can start listing down the
And I can start listing down the automobiles that I want. So let's say
automobiles that I want. So let's say car or let's say
car or let's say motorbikes. Okay, we can say train.
motorbikes. Okay, we can say train. Well, train is technically not a
Well, train is technically not a automobile but uh still or let's uh go
automobile but uh still or let's uh go into details of the companies. Okay,
into details of the companies. Okay, let's say Marauti, let's say Ferrari,
let's say Marauti, let's say Ferrari, Lamborghini. These are some of the most
Lamborghini. These are some of the most famous uh companies, right?
famous uh companies, right? So, when it comes to bikes, you have
So, when it comes to bikes, you have Bamaha, then you have uh Honda, right?
Bamaha, then you have uh Honda, right? You have Suzuki,
You have Suzuki, you have
you have Arillia and uh to name a few more. We
Arillia and uh to name a few more. We can add some more companies like BMW, we
can add some more companies like BMW, we can add Audi, we can add
can add Audi, we can add Foxwen to this list. Okay. Now, if I do
Foxwen to this list. Okay. Now, if I do Ctrl D, then uh this will be the list of
Ctrl D, then uh this will be the list of content in my automobiles. TXT. Okay. I
content in my automobiles. TXT. Okay. I let me I'm going to clear the screen
let me I'm going to clear the screen now. And if I
now. And if I do cat command here, then it displays a
do cat command here, then it displays a list of contents here. Right? Okay. Now,
list of contents here. Right? Okay. Now, let's use the grip command to search the
let's use the grip command to search the content that is uh present in this uh
content that is uh present in this uh text. So u I'm going to do a grip and uh
text. So u I'm going to do a grip and uh the string that I want to search for is
the string that I want to search for is uh let's say y because in Lamborghini we
uh let's say y because in Lamborghini we have the search string y am and even in
have the search string y am and even in Yamaha we have uh the am right we are
Yamaha we have uh the am right we are supposed to get two results for this. So
supposed to get two results for this. So in this case so if I uh just say gp yam
in this case so if I uh just say gp yam and if I specify the file name
and if I specify the file name automobiles.txt txt and if I give enter
automobiles.txt txt and if I give enter then I get the two different words right
then I get the two different words right the two uh names where this was present
the two uh names where this was present where am was present okay now if I use
where am was present okay now if I use the same thing with the uh i flag
the same thing with the uh i flag then it will uh display the list of
then it will uh display the list of files in a case insensitive fashion but
files in a case insensitive fashion but in my file there's no uppercase file I'm
in my file there's no uppercase file I'm going to say see automobile txt I'm
going to say see automobile txt I'm going to append
going to append I'm going to append this word called
I'm going to append this word called amber. Okay. So, Amber is another uh
amber. Okay. So, Amber is another uh automobile company. And when I do this
automobile company. And when I do this and if I run the cat command now, okay,
and if I run the cat command now, okay, you will see that along with uh these
you will see that along with uh these names was there initially there is amber
names was there initially there is amber has been appended. Okay. And this time
has been appended. Okay. And this time when I search for y, right? So, it
when I search for y, right? So, it should not show me this because even
should not show me this because even though there is am here, uh the a is
though there is am here, uh the a is capital here, but I'm searching for
capital here, but I'm searching for small am. So, it should not show me this
small am. So, it should not show me this result. Okay? I should get the same
result. Okay? I should get the same result that I got previously. So if I uh
result that I got previously. So if I uh do a grip am like earlier I got the
do a grip am like earlier I got the Lamborghini and Yamma as the only
Lamborghini and Yamma as the only options. Okay. But now if I uh append
options. Okay. But now if I uh append this with minus I or the I flag. So what
this with minus I or the I flag. So what happens is I'll get the option of even
happens is I'll get the option of even amber along with this because it would
amber along with this because it would search for the string in a case
search for the string in a case insensitive fashion. Okay. So this time
insensitive fashion. Okay. So this time as you can see amber is uh added to this
as you can see amber is uh added to this list because uh it did not consider case
list because uh it did not consider case insensitive words letters. Okay. So that
insensitive words letters. Okay. So that is about the i flag and uh there is
is about the i flag and uh there is another n flag right. So let's see what
another n flag right. So let's see what the n flag does. So every time you use
the n flag does. So every time you use the uh minus n flag then it'll list down
the uh minus n flag then it'll list down the line in which the word was present.
the line in which the word was present. So that's what I mentioned earlier. So
So that's what I mentioned earlier. So over here in line number six and line
over here in line number six and line number seven we have Lamborghini and
number seven we have Lamborghini and yamaha. Right? So the line number is
yamaha. Right? So the line number is mentioned. Okay. Now u so that's what
mentioned. Okay. Now u so that's what the n flag does. Okay. So we have the v
the n flag does. Okay. So we have the v flag and the c flag left. So let's
flag and the c flag left. So let's execute them and uh see what happens. So
execute them and uh see what happens. So when I remove n and when I execute v as
when I remove n and when I execute v as you can see all the uh results except
you can see all the uh results except for yamaha and for lamoggony would be
for yamaha and for lamoggony would be present here. Okay. But if I give minus
present here. Okay. But if I give minus IV okay which indicates IV flag then
IV okay which indicates IV flag then even amber would not be present in the
even amber would not be present in the output I will get now okay when I give
output I will get now okay when I give enter as you can see amber is not
enter as you can see amber is not present because amber is part of the
present because amber is part of the case insensitive option right when we
case insensitive option right when we included I this should be chosen as the
included I this should be chosen as the search result and since it's considered
search result and since it's considered as a search result we will display only
as a search result we will display only the result uh the set of results which
the result uh the set of results which were not found so the other lines in
were not found so the other lines in which text was not found were these and
which text was not found were these and that's why we got these options okay Now
that's why we got these options okay Now we have one more flag which we need to
we have one more flag which we need to see and that is the C flag. And when you
see and that is the C flag. And when you enter the uh C flag then it displays the
enter the uh C flag then it displays the list of uh the number of times that
list of uh the number of times that string was found. So AM was found two
string was found. So AM was found two times in once in Lamborghini and once in
times in once in Lamborghini and once in Yamaha. So that's why we got the answer
Yamaha. So that's why we got the answer as two. Now if I use C with the
as two. Now if I use C with the combination of I all right I'm going to
combination of I all right I'm going to get three. That's because even amber
get three. That's because even amber will be considered in this case. Okay
will be considered in this case. Okay guys. So uh this is uh what is uh there
guys. So uh this is uh what is uh there with respect to the grip command. Okay.
with respect to the grip command. Okay. So uh guys uh do you all have any
So uh guys uh do you all have any doubts? Okay. And if you all do have any
doubts? Okay. And if you all do have any doubts please put them in the chat box
doubts please put them in the chat box cuz uh I'll be going to the next slide
cuz uh I'll be going to the next slide then. All right. And I don't think
then. All right. And I don't think you'll should be having any because I've
you'll should be having any because I've explained each and every outcome each
explained each and every outcome each and every uh flag that can be used with
and every uh flag that can be used with GP. Okay. So if you all do have any any
GP. Okay. So if you all do have any any other confusion please put them in the
other confusion please put them in the chat box. In the meanwhile let me get
chat box. In the meanwhile let me get back to my presentation and uh continue
back to my presentation and uh continue with my next slide. Okay, so I spoke
with my next slide. Okay, so I spoke about the uh grip command. Okay, and now
about the uh grip command. Okay, and now in the next slide, let me talk about the
in the next slide, let me talk about the sort command. Okay, and so we use a sort
sort command. Okay, and so we use a sort command to sort the results of a search
command to sort the results of a search either alphabetically or numerically.
either alphabetically or numerically. All right. And uh we can sort either
All right. And uh we can sort either files or file contents or directories.
files or file contents or directories. So what this means is whatever results
So what this means is whatever results you get, right? or uh I mean not just
you get, right? or uh I mean not just results or even if uh it's the list of
results or even if uh it's the list of items that is present in a particular
items that is present in a particular directory even when you run an ls
directory even when you run an ls command right you'll have a list of
command right you'll have a list of files and the list of folders that are
files and the list of folders that are there in that particular directory so we
there in that particular directory so we can sort even those things okay now that
can sort even those things okay now that result can be sorted and uh also we can
result can be sorted and uh also we can sort anything else we can sort the
sort anything else we can sort the contents of a file right we can sort the
contents of a file right we can sort the contents of the file or uh you know all
contents of the file or uh you know all these things so that's what this means
these things so that's what this means so without wasting much time let me just
so without wasting much time let me just uh show you how that is done. So you can
uh show you how that is done. So you can give sort and the file that you want to
give sort and the file that you want to search. Alternatively, you can also
search. Alternatively, you can also search two files at the same time by
search two files at the same time by giving file 1.txt and file 2.txt. Okay.
giving file 1.txt and file 2.txt. Okay. So and the and the syntax for that is uh
So and the and the syntax for that is uh sort and the file name. Okay. When you
sort and the file name. Okay. When you say sort on the file name, then the
say sort on the file name, then the contents of this file will be returned
contents of this file will be returned in the alphabetical order. Okay. If you
in the alphabetical order. Okay. If you want to sort two files at the same time,
want to sort two files at the same time, then you can uh in arguments you can
then you can uh in arguments you can just give both the file names and it
just give both the file names and it will sort the contents for both file
will sort the contents for both file one.txt and file 2.txt. Okay. And again
one.txt and file 2.txt. Okay. And again if you want to uh display them in the
if you want to uh display them in the reverse order, then you can specify the
reverse order, then you can specify the R flag. And uh for case insensitive
R flag. And uh for case insensitive sorting, you can do the hyphen F flag.
sorting, you can do the hyphen F flag. And then if you want to sort the results
And then if you want to sort the results based on the number in a numerical
based on the number in a numerical order, then you can use the N flag. Okay
order, then you can use the N flag. Okay guys, so uh let me first of all go to my
guys, so uh let me first of all go to my terminal and start executing them. Okay,
terminal and start executing them. Okay, so what I'm going to do is I'm going to
so what I'm going to do is I'm going to clear my screen and currently let me
clear my screen and currently let me just list down the contents of this
just list down the contents of this directory. So we have automobiles uh
directory. So we have automobiles uh file, we have file one and we have file
file, we have file one and we have file two. When I just give a sort and press
two. When I just give a sort and press enter, then I enter the interactive
enter, then I enter the interactive mode. Okay, so here I can uh type all
mode. Okay, so here I can uh type all this. I can type random words.
this. I can type random words. Okay, I can say um A B C D or I can say
Okay, I can say um A B C D or I can say B C D A or I can say E F E D FG all
B C D A or I can say E F E D FG all these things. Okay. And then when I
these things. Okay. And then when I press Ctrl D, it gets me out of the
press Ctrl D, it gets me out of the interactive mode. And when I exit the
interactive mode. And when I exit the interactive mode, the text that I typed
interactive mode, the text that I typed in, right, the input that has been
in, right, the input that has been sorted. So this up till this line was
sorted. So this up till this line was what I entered as input if you remember
what I entered as input if you remember and uh up till EDFG, right? So basically
and uh up till EDFG, right? So basically this text has been ordered as per
this text has been ordered as per alphabetical order and since a comes
alphabetical order and since a comes first in alphabetical chronology. This
first in alphabetical chronology. This is first the BCDA is second and then you
is first the BCDA is second and then you have the other lines okay uh these have
have the other lines okay uh these have been sorted in an alphabetical order.
been sorted in an alphabetical order. Now if I give sort with the file name
Now if I give sort with the file name okay that is uh automobiles.exe texe and
okay that is uh automobiles.exe texe and if I give enter then this particular uh
if I give enter then this particular uh file will be ordered in the alphabetical
file will be ordered in the alphabetical order. Okay, the contents will be uh
order. Okay, the contents will be uh listed down in an alphabetical order. Uh
listed down in an alphabetical order. Uh let me clear the screen and show that
let me clear the screen and show that again. So let me first just do a cat and
again. So let me first just do a cat and show you how the order is. Okay, now let
show you how the order is. Okay, now let me run the sort
me run the sort with the file name. Okay, so now if you
with the file name. Okay, so now if you see it was in this order initially,
see it was in this order initially, right? So car was the first option,
right? So car was the first option, motorbike was the second, train was the
motorbike was the second, train was the next, Maruti and then came Ferrari and
next, Maruti and then came Ferrari and Lamborghini. But if you look at the
Lamborghini. But if you look at the sorted uh result then it's in a sorted
sorted uh result then it's in a sorted manner right so first comes Amber then
manner right so first comes Amber then comes Aprilia then comes Audi and then
comes Aprilia then comes Audi and then the others so that's what sorting does
the others so that's what sorting does okay and the same thing can be done for
okay and the same thing can be done for two different files at the same time. So
two different files at the same time. So this was the automobiles.txt.
this was the automobiles.txt. Supposing I want to list down even my
Supposing I want to list down even my file 2 contents. Then I can just type
file 2 contents. Then I can just type file 2.txt here and the results of both
file 2.txt here and the results of both the files will be in my uh terminal.
the files will be in my uh terminal. Okay. But before that let me just uh
Okay. But before that let me just uh clear the screen so that it'll be easier
clear the screen so that it'll be easier for you to view the results. Okay. So
for you to view the results. Okay. So now that I've cleared the screen, let me
now that I've cleared the screen, let me uh sort these two files. Okay. So let's
uh sort these two files. Okay. So let's the command is sort and this is what I
the command is sort and this is what I had previously and let me add file two
had previously and let me add file two to it. Okay file 2.txt. Now what this
to it. Okay file 2.txt. Now what this would do is the results of both these
would do is the results of both these files right automobiles and file two the
files right automobiles and file two the results of those would be sorted in the
results of those would be sorted in the alphabetical manner. Okay. Now if I give
alphabetical manner. Okay. Now if I give an enter as you can see here first
an enter as you can see here first initially you have blank space. Okay.
initially you have blank space. Okay. Now that is because blanks are ahead of
Now that is because blanks are ahead of the capital A. Right. This is the
the capital A. Right. This is the alphabetical order. Correct. So first
alphabetical order. Correct. So first comes blank space then comes whites
comes blank space then comes whites space and then comes the characters. So
space and then comes the characters. So once we are done with those things then
once we are done with those things then we have amber Aprilia Audi. This was the
we have amber Aprilia Audi. This was the order in which the files were listed in
order in which the files were listed in the automobiles and right after C D
the automobiles and right after C D comes. Okay. Now this line is part of
comes. Okay. Now this line is part of the file one while these were part of
the file one while these were part of automobiles. This was part of file
automobiles. This was part of file 2.txt. So yeah these results were a part
2.txt. So yeah these results were a part of the automobiles.xt file. The blank
of the automobiles.xt file. The blank lines here these were part of the file
lines here these were part of the file 2.txt and u again these two lines right
2.txt and u again these two lines right these were part of file 2.txt txt. Okay.
these were part of file 2.txt txt. Okay. So this is what happens when you give
So this is what happens when you give two files as arguments. Now uh there are
two files as arguments. Now uh there are other options that I want to show you
other options that I want to show you though. So there were flags like R flag,
though. So there were flags like R flag, right? So R flag lists the uh results in
right? So R flag lists the uh results in the reverse order. Okay, I'm just going
the reverse order. Okay, I'm just going to clear the screen and yeah for
to clear the screen and yeah for clearing the screen the shortcut is Ctrl
clearing the screen the shortcut is Ctrl L. All right guys, so um let's say sort
L. All right guys, so um let's say sort automobiles.txt.
automobiles.txt. Okay, it's cat, right? I don't want to
Okay, it's cat, right? I don't want to do cat. I want to do sort automobiles.
do cat. I want to do sort automobiles. txt and I want to use the flag minus r.
txt and I want to use the flag minus r. So when you use minus r, it will display
So when you use minus r, it will display the result in the reverse order. So we
the result in the reverse order. So we have the reverse order in which yamaha
have the reverse order in which yamaha comes first and amber comes last. So
comes first and amber comes last. So that is the reverse order. And we have
that is the reverse order. And we have another flag here. The other flag is the
another flag here. The other flag is the f flag which will return the results in
f flag which will return the results in uh the case insensitive uh fashion.
uh the case insensitive uh fashion. Okay. So that is the uh minus f and then
Okay. So that is the uh minus f and then if you go back to the slides there is uh
if you go back to the slides there is uh n option right so n will return the
n option right so n will return the results in the numerical order. Now let
results in the numerical order. Now let me go to my uh terminal and let me use
me go to my uh terminal and let me use the n flag now but of course I don't
the n flag now but of course I don't think it will sort anything because
think it will sort anything because there are no numericals here. So what
there are no numericals here. So what I'm going to do is I'm going to uh use
I'm going to do is I'm going to uh use the file 2.txt here. Okay file 2.xt.
the file 2.txt here. Okay file 2.xt. Okay. So there are no numericals here
Okay. So there are no numericals here either. What I can do is I can edit
either. What I can do is I can edit these details. So let me go vi and uh
these details. So let me go vi and uh say file
say file 2.txt and I'm going to enter the insert
2.txt and I'm going to enter the insert mode. I'm going to remove all these
mode. I'm going to remove all these unwanted lines. Okay. So I've removed
unwanted lines. Okay. So I've removed all the blank lines. Now I'm going to
all the blank lines. Now I'm going to put one here. I'm going to put two here.
put one here. I'm going to put two here. I'm going to add three to this line. I'm
I'm going to add three to this line. I'm going to add four to this line.
going to add four to this line. Okay.
Okay. All right guys or let's say let's give
All right guys or let's say let's give the order of seven here. Okay. You have
the order of seven here. Okay. You have two here. Okay. So there are some kind
two here. Okay. So there are some kind of uh numericals ahead of uh you know
of uh numericals ahead of uh you know before every line starts. Right. So when
before every line starts. Right. So when we run the minus n command now the sort
we run the minus n command now the sort command with the n flag. Now then it
command with the n flag. Now then it would sort these lines with respect to
would sort these lines with respect to the lines with the numerical order.
the lines with the numerical order. Okay. So first this line would be uh
Okay. So first this line would be uh shown the blank line. Okay. Then you
shown the blank line. Okay. Then you would be shown the uh uh you know the
would be shown the uh uh you know the total line. Then you would be shown the
total line. Then you would be shown the third line and like that. So let me just
third line and like that. So let me just uh escape colon and save and quit. Okay.
uh escape colon and save and quit. Okay. Now let me uh run that same sort
Now let me uh run that same sort command. Sort-en file 2.txt.
command. Sort-en file 2.txt. So as you can see the uh alphabets are
So as you can see the uh alphabets are first sorted. Okay. So the lines where
first sorted. Okay. So the lines where there are text characters or
there are text characters or alphabetical letters. So those are
alphabetical letters. So those are displayed and after that the lines that
displayed and after that the lines that are formatted after that are in
are formatted after that are in numerological fashion. Okay. So if I
numerological fashion. Okay. So if I don't give the n it would be a different
don't give the n it would be a different uh fashion altogether. So earlier uh the
uh fashion altogether. So earlier uh the file was just displayed in the regular
file was just displayed in the regular numerological order. Okay. So where 1 2
numerological order. Okay. So where 1 2 3 4 5 the numbers came first and then
3 4 5 the numbers came first and then came the text. But since we ran the
came the text. But since we ran the hyphen the alphabetical letters or the
hyphen the alphabetical letters or the characters came first. Okay. After that
characters came first. Okay. After that it was sorted by numerical letters. So
it was sorted by numerical letters. So that's what the n flag does and and that
that's what the n flag does and and that brings us to the end of the sort
brings us to the end of the sort commands. Okay.
commands. Okay. So uh after the sort command, the next
So uh after the sort command, the next one that we have in line is that of pipe
one that we have in line is that of pipe command. Okay. So this is referred to as
command. Okay. So this is referred to as the pipe. So you'll find this in your uh
the pipe. So you'll find this in your uh in your keyboards right above the enter
in your keyboards right above the enter button. Okay. Uh where you have the
button. Okay. Uh where you have the backward slash. So in that button if you
backward slash. So in that button if you press shift and if you press that button
press shift and if you press that button you'll get this pipe command. And what
you'll get this pipe command. And what the pipe command helps you does is it uh
the pipe command helps you does is it uh lets you perform two operations in the
lets you perform two operations in the same command like it'll uh let me
same command like it'll uh let me search. Let's take the example that's
search. Let's take the example that's specified here. Okay, we using the gp to
specified here. Okay, we using the gp to search for a particular string from a
search for a particular string from a file and uh we are using that and then
file and uh we are using that and then we are sorting that result. Okay, now
we are sorting that result. Okay, now since there are two operations involved,
since there are two operations involved, okay, one is a sort and one is the uh
okay, one is a sort and one is the uh search. Since there are two operations
search. Since there are two operations involved in the same command, we
involved in the same command, we separate the two operations with the
separate the two operations with the help of the pipe command. So that's what
help of the pipe command. So that's what uh this is and uh as the definition says
uh this is and uh as the definition says the pipe command is used to output the
the pipe command is used to output the result of one command as input to
result of one command as input to another command. Okay, the same thing
another command. Okay, the same thing can be said over here also. So we'll
can be said over here also. So we'll first search the file for a particular
first search the file for a particular string and whatever result you get that
string and whatever result you get that will be given as input to the sort
will be given as input to the sort command over here. Right? So this uh
command over here. Right? So this uh saves us time in not having to mention
saves us time in not having to mention the uh file name after sort again. So
the uh file name after sort again. So we'll just be performing one GP search
we'll just be performing one GP search and then we'll just whatever result
and then we'll just whatever result comes that result will go to the
comes that result will go to the operation that's performed over here.
operation that's performed over here. Right? So um let me just go to the
Right? So um let me just go to the terminal and show you an example of
terminal and show you an example of this. I'm going to clear the screen and
this. I'm going to clear the screen and uh let's run the grip command to search
uh let's run the grip command to search for am from the automobiles.txt.
for am from the automobiles.txt. Okay. I'm going to use the pipe command
Okay. I'm going to use the pipe command and uh sort this. So these were the two
and uh sort this. So these were the two results, right? So when you do a cat
results, right? So when you do a cat command or when you do when you just run
command or when you do when you just run the gp command with am right so what
the gp command with am right so what would happen is you'll get these two
would happen is you'll get these two results because these two lines or these
results because these two lines or these two words have the am characters inside
two words have the am characters inside right now when you give the sort it
right now when you give the sort it would sort it alphabetically right and
would sort it alphabetically right and if I if I want to sort it in the other
if I if I want to sort it in the other way then I can just run the same command
way then I can just run the same command with the r flag so when I do r then this
with the r flag so when I do r then this result will be sorted in the reverse
result will be sorted in the reverse fashion so yamaha comes first and
fashion so yamaha comes first and lamoggony comes first so that's how the
lamoggony comes first so that's how the uh pipe command can be used to get the
uh pipe command can be used to get the output from one operation and feed that
output from one operation and feed that output as the input to the next
output as the input to the next operation. Right? So um this is
operation. Right? So um this is relatively smaller topic. Okay. And we
relatively smaller topic. Okay. And we quite often we'd be using uh the pipe
quite often we'd be using uh the pipe command when you want to use multiple uh
command when you want to use multiple uh operations in the same command. So
operations in the same command. So that's about the pipe command. Okay. So
that's about the pipe command. Okay. So let me just clear the screen and get
let me just clear the screen and get back to my presentation and see what's
back to my presentation and see what's my next slide all about. Okay. So now
my next slide all about. Okay. So now that I've shown you how to sort the
that I've shown you how to sort the contents of the file, let's go to the
contents of the file, let's go to the next uh slide. Right. So the next
next uh slide. Right. So the next section of uh this Linux tutorial is
section of uh this Linux tutorial is going to be about the copy, move, make
going to be about the copy, move, make directory, remove, remove directory, and
directory, remove, remove directory, and the user permissions. All right. So
the user permissions. All right. So let's get started with this section.
let's get started with this section. Okay. Uh CP stands for copy and that
Okay. Uh CP stands for copy and that will be the first slide uh that we're
will be the first slide uh that we're going to talk about. Okay. So as you
going to talk about. Okay. So as you know copy is basically used to copy
know copy is basically used to copy files or directories. Okay. The point to
files or directories. Okay. The point to notice files and directories. So in
notice files and directories. So in Windows you have the option of right
Windows you have the option of right clicking on any file or any folder and
clicking on any file or any folder and you know saying copy or copy paste or
you know saying copy or copy paste or cut paste right that's in Windows and
cut paste right that's in Windows and you can do that even through the GUI in
you can do that even through the GUI in Linux. But how will you do it through
Linux. But how will you do it through the CLI right through the terminal? You
the CLI right through the terminal? You specify this command. you specify CP and
specify this command. you specify CP and if you have any flag you enter the flag
if you have any flag you enter the flag and then you specify the source and the
and then you specify the source and the destination. Okay, so the source is
destination. Okay, so the source is basically this will be the path of the
basically this will be the path of the folder that you want to copy and this is
folder that you want to copy and this is the place where you want to copy it to.
the place where you want to copy it to. All right, so uh let's uh get back to
All right, so uh let's uh get back to executing and showing you a
executing and showing you a demonstration of this. So I'm going to
demonstration of this. So I'm going to go back to my terminal. So uh first of
go back to my terminal. So uh first of all uh we are in the documents directory
all uh we are in the documents directory and let's see what is there in this
and let's see what is there in this directory. Okay, there are the three
directory. Okay, there are the three files that we created, right? There is
files that we created, right? There is automobiles.txt. There is file 1.txt and
automobiles.txt. There is file 1.txt and file 2.txt.
file 2.txt. Now what I'm going to do is I'm going to
Now what I'm going to do is I'm going to copy the automobiles.txt and uh paste it
copy the automobiles.txt and uh paste it in my uh desktop. Okay. So let me just
in my uh desktop. Okay. So let me just minimize this. So this is my desktop.
minimize this. So this is my desktop. Right. So right now I don't have the
Right. So right now I don't have the automobiles. But through the terminal
automobiles. But through the terminal I'm going to run a command which will
I'm going to run a command which will copy the uh automobiles.txt to this
copy the uh automobiles.txt to this folder. Okay. So I'm just going to
folder. Okay. So I'm just going to minimize the terminal now to show you
minimize the terminal now to show you that it happens. Okay, real time. So
that it happens. Okay, real time. So what I'm going to do is u ls and I'm
what I'm going to do is u ls and I'm going to say copy automobiles.txt.
going to say copy automobiles.txt. This is the source and the destination
This is the source and the destination is uh root home edurea and uh in edureka
is uh root home edurea and uh in edureka it's the desktop folder right when I hit
it's the desktop folder right when I hit enter there will be a new
enter there will be a new automobiles.txt file that'll be created
automobiles.txt file that'll be created over here. So as you can see the new
over here. So as you can see the new file got created over here and uh yeah
file got created over here and uh yeah so it's it's a very simple command that
so it's it's a very simple command that you can uh execute. So you can do the
you can uh execute. So you can do the same thing to even uh directories and uh
same thing to even uh directories and uh files. All right. Uh so what I'm going
files. All right. Uh so what I'm going to do is uh I'll go to the home
to do is uh I'll go to the home directory and from the home directory
directory and from the home directory I'm going to go to the desktop directory
I'm going to go to the desktop directory and copy the LMS folder. Right? So the
and copy the LMS folder. Right? So the LMS folder is again uh you know it's
LMS folder is again uh you know it's it's a folder this time. It's not a
it's a folder this time. It's not a file. So last time we copied a file.
file. So last time we copied a file. This time I'm going to show you how to
This time I'm going to show you how to copy the folder itself. Okay, I'm going
copy the folder itself. Okay, I'm going to copy this folder and paste it
to copy this folder and paste it somewhere else.
somewhere else. So let me go to the terminal CD and I'm
So let me go to the terminal CD and I'm going to go to the desktop here.
going to go to the desktop here. All right. So we have uh LMS here. So
All right. So we have uh LMS here. So I'm going to say copy LMS. All right. So
I'm going to say copy LMS. All right. So I'm going to remove the slash from here
I'm going to remove the slash from here because I'm going to copy this uh folder
because I'm going to copy this uh folder now. And uh this would make it the
now. And uh this would make it the source that would make lms the source
source that would make lms the source and the destination is we have to put
and the destination is we have to put the absolute path here right so we got
the absolute path here right so we got to start from the root directory and go
to start from the root directory and go to home edurea and let's say I want to
to home edurea and let's say I want to put it in the uh documents directory
put it in the uh documents directory okay so something that is present uh in
okay so something that is present uh in the desktop directory that is uh being
the desktop directory that is uh being copied and pasted inside the documents
copied and pasted inside the documents directory okay so when we give enter so
directory okay so when we give enter so guys uh we're getting an error here
guys uh we're getting an error here right so it says Copy CP omitting
right so it says Copy CP omitting directory LMS. Can you all guess why
directory LMS. Can you all guess why that is the case? Can you all like
that is the case? Can you all like understand the meaning of this error?
understand the meaning of this error? Omitting directory. Don't break your
Omitting directory. Don't break your sweat too much because u the meaning is
sweat too much because u the meaning is simple here. It just it has just omitted
simple here. It just it has just omitted a directory. Okay. Now the reason is so
a directory. Okay. Now the reason is so that is because uh the cp command it by
that is because uh the cp command it by default it copies only files. Okay. If
default it copies only files. Okay. If you want to copy directories also then
you want to copy directories also then you got to uh add another flag called R
you got to uh add another flag called R flag. So let me just quickly go to the
flag. So let me just quickly go to the slides and show you uh the functionality
slides and show you uh the functionality there. Okay, as you can see here uh we
there. Okay, as you can see here uh we have the R flag right. So CP minus R it
have the R flag right. So CP minus R it is for recursive copy and that is for
is for recursive copy and that is for copying directories also. Okay, and it
copying directories also. Okay, and it copies also hidden files. If there are
copies also hidden files. If there are any hidden files or if you have
any hidden files or if you have directories which you want to copy
directories which you want to copy inside that directory then it will uh it
inside that directory then it will uh it will copy that that itself. So that is
will copy that that itself. So that is the thing because you cannot copy uh
the thing because you cannot copy uh directories without the R flag. You can
directories without the R flag. You can only copy files. So that is the uh
only copy files. So that is the uh meaning here and uh we have another flag
meaning here and uh we have another flag here called the V flag and that is
here called the V flag and that is verbos. Well, what verbose means is it
verbos. Well, what verbose means is it prints informative messages. Supposing
prints informative messages. Supposing you're executing a command. Okay. And
you're executing a command. Okay. And supposing the command is going to take
supposing the command is going to take time like it's going to take a good 5 10
time like it's going to take a good 5 10 seconds. Then during that time it would
seconds. Then during that time it would print the status of the system like
print the status of the system like supposing it has completed like step one
supposing it has completed like step one to step three. Okay. And it's stuck at
to step three. Okay. And it's stuck at step four. Then it would print that
step four. Then it would print that message. And as an event step four is
message. And as an event step four is completed, you will get a message uh
completed, you will get a message uh saying that's completed. And yeah,
saying that's completed. And yeah, similarly it's like progress wise. It
similarly it's like progress wise. It tells you what is the progress and what
tells you what is the progress and what are the uh action that the system is
are the uh action that the system is taking and what step it's performing. So
taking and what step it's performing. So it just prints such informative messages
it just prints such informative messages minus V. Okay. Okay. Let's first start
minus V. Okay. Okay. Let's first start off with the I flag. Okay. So we have
off with the I flag. Okay. So we have something called as a CP flag I. Okay.
something called as a CP flag I. Okay. So when you give the I flag, it enters
So when you give the I flag, it enters the interactive mode. So when you say
the interactive mode. So when you say interactive mode it is because um at
interactive mode it is because um at times you might have files which will
times you might have files which will all be already be present in in a
all be already be present in in a particular directory. Okay. Uh you saw
particular directory. Okay. Uh you saw me copy automobiles.txt once from
me copy automobiles.txt once from documents to desktop. Okay. Now if I do
documents to desktop. Okay. Now if I do the same operation again if I run the
the same operation again if I run the same command again at that time it'll
same command again at that time it'll automatically overwrite the file right
automatically overwrite the file right because uh the file name is the same.
because uh the file name is the same. The automobiles or txt was the one that
The automobiles or txt was the one that is there in my documents folder. And
is there in my documents folder. And again even over here on my desktop it is
again even over here on my desktop it is documents uh sorry it's automobiles when
documents uh sorry it's automobiles when I copy them what would happen is that
I copy them what would happen is that file would be replaced okay now uh in
file would be replaced okay now uh in that kind of a situation uh when you're
that kind of a situation uh when you're copying multiple files you might want to
copying multiple files you might want to be notified before something happens
be notified before something happens right so if you specify something like
right so if you specify something like the I flag then you will get an
the I flag then you will get an interactive mode so the system will not
interactive mode so the system will not take a decision on its own but instead
take a decision on its own but instead it will not use any defaults okay that's
it will not use any defaults okay that's what we mean by uh on its own okay so it
what we mean by uh on its own okay so it would uh you know ask you it would
would uh you know ask you it would prompt you for an answer it will tell
prompt you for an answer it will tell you that okay this file already exists
you that okay this file already exists in this directory and do you want to
in this directory and do you want to replace it and then it'll give you an
replace it and then it'll give you an option Y or N. Y stands for S, N stands
option Y or N. Y stands for S, N stands for no. So that's what the CP and I flag
for no. So that's what the CP and I flag does. And when you give the N flag, it
does. And when you give the N flag, it will not override the file. Okay,
will not override the file. Okay, because by default it overrides the file
because by default it overrides the file and if you specify the N flag, it will
and if you specify the N flag, it will not overwrite the file. But the whole
not overwrite the file. But the whole concept here is it is based on the file
concept here is it is based on the file name. What if the file name is the same
name. What if the file name is the same and the file contents are different?
and the file contents are different? Okay, at that situation, you might want
Okay, at that situation, you might want something like the flag U. Okay. Now
something like the flag U. Okay. Now what the flag U does is it will update
what the flag U does is it will update the destination file only when the
the destination file only when the source file is different from the
source file is different from the destination file. So by using the N flag
destination file. So by using the N flag you will make sure that the file is not
you will make sure that the file is not overwritten. Okay. But then if you use
overwritten. Okay. But then if you use the U flag you will have another
the U flag you will have another benefit. Okay. What will happen when you
benefit. Okay. What will happen when you use the U flag is so first it would
use the U flag is so first it would check the file name. If the file names
check the file name. If the file names are different then it would create a new
are different then it would create a new file. If in caseh there is another file
file. If in caseh there is another file by the same name then it would check the
by the same name then it would check the contents of that file. if the contents
contents of that file. if the contents of that file and the file that's being
of that file and the file that's being copied if they are the same then it
copied if they are the same then it would not get copied and it would only
would not get copied and it would only get copied when the content is
get copied when the content is different. So at that time you'll have
different. So at that time you'll have two different files with the same name.
two different files with the same name. So that's the advantage with the uh CP
So that's the advantage with the uh CP and U flag. Okay. So let's try executing
and U flag. Okay. So let's try executing uh these options. All right. So I'm just
uh these options. All right. So I'm just going to go back to my terminal here. So
going to go back to my terminal here. So first and foremost let's execute the uh
first and foremost let's execute the uh R flag. Okay. It's capital R. So do note
R flag. Okay. It's capital R. So do note that and uh when you say enter so the
that and uh when you say enter so the item is copied. So if you go back to
item is copied. So if you go back to your uh documents folder you can see
your uh documents folder you can see that there's a new folder called
that there's a new folder called elements that's been created. So this
elements that's been created. So this was initially not present and it's uh
was initially not present and it's uh present now. Okay. Now what we'll do is
present now. Okay. Now what we'll do is I'll delete this. Okay. I'm going to
I'll delete this. Okay. I'm going to minimize this. Execute the same command
minimize this. Execute the same command along with the verbose flag. All right.
along with the verbose flag. All right. So as you can see the uh status of the
So as you can see the uh status of the system was also displayed in the
system was also displayed in the meanwhile even though I entered my uh
meanwhile even though I entered my uh text somewhere here. Yep, it's right
text somewhere here. Yep, it's right here. Correct. So this was the earlier
here. Correct. So this was the earlier uh command that I executed without the
uh command that I executed without the verbos. Okay, here it just straight away
verbos. Okay, here it just straight away copied the file. Okay, the LMS sorry the
copied the file. Okay, the LMS sorry the LMS folder to my uh documents folder.
LMS folder to my uh documents folder. But when I gave V, the informative
But when I gave V, the informative message also came right. So it uh the
message also came right. So it uh the step-by-step process of what all is
step-by-step process of what all is being copied came. So first uh this was
being copied came. So first uh this was the first folder being copied. This was
the first folder being copied. This was the first subfolder being copied and
the first subfolder being copied and after that all the other files that are
after that all the other files that are being copied each and every document
being copied each and every document step by step it is all listed down and u
step by step it is all listed down and u you'll get all those details here if you
you'll get all those details here if you give minus v in your command. So that's
give minus v in your command. So that's what the minus v does. Okay so I'm left
what the minus v does. Okay so I'm left to show you the i n and u flags right so
to show you the i n and u flags right so what I'm going to do is um let's say I
what I'm going to do is um let's say I just want to clear the screen now. Okay,
just want to clear the screen now. Okay, I'm going to remove this command here
I'm going to remove this command here and go back to the documents folder and
and go back to the documents folder and show you that the LMS has been copied.
show you that the LMS has been copied. Okay, with the verbos when I created
Okay, with the verbos when I created this folder. Okay, now what I wanted to
this folder. Okay, now what I wanted to show you is I want to show you copy with
show you is I want to show you copy with the interactive mode. So earlier if you
the interactive mode. So earlier if you see the uh desktop there's already an
see the uh desktop there's already an automobiles.txt, right? So what I'm
automobiles.txt, right? So what I'm going to do is I'm going to copy
going to do is I'm going to copy automobiles.txt.
automobiles.txt. I'm going to copy this one again to the
I'm going to copy this one again to the desktop. But this time it should uh you
desktop. But this time it should uh you know I'm going to use an I flag and it
know I'm going to use an I flag and it will not overwrite the existing flag. So
will not overwrite the existing flag. So I'm going to say cp automobiles.txt.
I'm going to say cp automobiles.txt. The destination is uh
The destination is uh home/ora
home/ora / all right. Uh I think I'm in the wrong
/ all right. Uh I think I'm in the wrong directory right now. Okay. So I need to
directory right now. Okay. So I need to go one path back. Switch to documents.
go one path back. Switch to documents. All right. Now here I need to copy the
All right. Now here I need to copy the automobiles from here right and put it
automobiles from here right and put it in the desktop. So
in the desktop. So home/ora/
desktop. Okay. So I'm going to copy the automobiles.txt over here. So when I
automobiles.txt over here. So when I give enter the automobiles.txt has been
give enter the automobiles.txt has been copied here again. So let me just go
copied here again. So let me just go back to my desktop and see that even
back to my desktop and see that even though I've run run this command two
though I've run run this command two times one now and uh one earlier and one
times one now and uh one earlier and one uh now just a couple of seconds back
uh now just a couple of seconds back there has been no duplicate that's been
there has been no duplicate that's been created. That's because this file has
created. That's because this file has been overwritten. Okay, the one with the
been overwritten. Okay, the one with the name automobiles has been overwritten
name automobiles has been overwritten with the latest command. So what I'm
with the latest command. So what I'm going to show you now is I'm going to
going to show you now is I'm going to use an I flag here. Like I told you flag
use an I flag here. Like I told you flag is what gets you into interactive mode.
is what gets you into interactive mode. So you will start interacting with the
So you will start interacting with the uh Linux kernel or the Linux shell over
uh Linux kernel or the Linux shell over here. So as it says the home eda desktop
here. So as it says the home eda desktop automobile.txt
automobile.txt it says overwrite. Do you want to
it says overwrite. Do you want to overwrite this particular uh file
overwrite this particular uh file because it's already present. If you
because it's already present. If you want to overwrite if you say y and if
want to overwrite if you say y and if you enter then the file would be
you enter then the file would be overwritten. Okay. But if you uh give n
overwritten. Okay. But if you uh give n and enter then that file would not be
and enter then that file would not be overwritten. So if I say no and if I
overwritten. So if I say no and if I enter then uh that copy would have
enter then uh that copy would have failed. Okay. But if I do the same thing
failed. Okay. But if I do the same thing again and if I press Y, it would have
again and if I press Y, it would have overwritten the file would have been
overwritten the file would have been overwritten. So that is uh what the I
overwritten. So that is uh what the I flag is. And then you have another
flag is. And then you have another option okay of the N flag. So the N flag
option okay of the N flag. So the N flag what it does is it does not overwrite
what it does is it does not overwrite the file by default. So for that option
the file by default. So for that option I told you that uh by default it
I told you that uh by default it overwrites, right? So I also showed you
overwrites, right? So I also showed you earlier that uh no duplicate was created
earlier that uh no duplicate was created and the existing file was overwritten.
and the existing file was overwritten. Supposing you don't want to do that then
Supposing you don't want to do that then you can just use the n flag which would
you can just use the n flag which would automatically indicate and tell the uh
automatically indicate and tell the uh Linux runtime engine that uh not to
Linux runtime engine that uh not to overwrite this particular file. Okay. So
overwrite this particular file. Okay. So you can have any number of files there.
you can have any number of files there. So even if the contents are different
So even if the contents are different here okay so even in caseh the new file
here okay so even in caseh the new file that's being copied has a different
that's being copied has a different content okay but it has the same name
content okay but it has the same name then even in that case by specifying the
then even in that case by specifying the end file it will not be overwritten
end file it will not be overwritten because there's a good chance that you
because there's a good chance that you might have made changes to the latest
might have made changes to the latest file and by copying another file with
file and by copying another file with the same name to that same directory
the same name to that same directory then there's a good chance that you'll
then there's a good chance that you'll be losing out on the changes that you
be losing out on the changes that you made right so at that time you can uh
made right so at that time you can uh use the n flag so in fact let me show
use the n flag so in fact let me show you that with an example uh what I'm
you that with an example uh what I'm going to do is uh right Now we are in
going to do is uh right Now we are in the documents directory. So I'm going to
the documents directory. So I'm going to do a cat and automobiles. Okay. So these
do a cat and automobiles. Okay. So these are the contents here. And let me update
are the contents here. And let me update this. Okay. What I'm going to add is I'm
this. Okay. What I'm going to add is I'm going to add another uh company of
going to add another uh company of another bike. Okay. Uh let's say we are
another bike. Okay. Uh let's say we are adding KTM to that list. Okay. So when I
adding KTM to that list. Okay. So when I do Ctrl D and exit the interactive mode
do Ctrl D and exit the interactive mode and if I do cat automobiles txt, then
and if I do cat automobiles txt, then KTM would be added over here. Okay. Now
KTM would be added over here. Okay. Now this uh automobiles file in the
this uh automobiles file in the documents right now this is the updated
documents right now this is the updated one. Okay. But in the desktop the
one. Okay. But in the desktop the updated file is not present. Okay. In
updated file is not present. Okay. In the desktop the file with only uh this
the desktop the file with only uh this much of content is there. Now I'm going
much of content is there. Now I'm going to execute the command with the n flag.
to execute the command with the n flag. Okay. So with the n flag it's basically
Okay. So with the n flag it's basically indicating that you're not supposed to
indicating that you're not supposed to override the file. Okay. So when it says
override the file. Okay. So when it says that when it finds out that
that when it finds out that automobiles.xe txt is present over there
automobiles.xe txt is present over there also in the desktop also it would not
also in the desktop also it would not copy the file at all okay so when I give
copy the file at all okay so when I give enter and of course so there's nothing
enter and of course so there's nothing here now if I go to the uh desktop okay
here now if I go to the uh desktop okay if I click on automobiles.txt txt here
if I click on automobiles.txt txt here you can see that uh KTM is not present.
you can see that uh KTM is not present. All right. But however when I close it
All right. But however when I close it and if I uh remove the N flag, right? If
and if I uh remove the N flag, right? If I remove this flag and execute it and if
I remove this flag and execute it and if I go back to the automobiles.txt, you'll
I go back to the automobiles.txt, you'll find that KTM is updated. Awesome.
find that KTM is updated. Awesome. Right? So that's the power of this N
Right? So that's the power of this N flag. Okay. So that is uh the end of u
flag. Okay. So that is uh the end of u all the different flags that I was about
all the different flags that I was about to show you from my PPT. Okay. So
to show you from my PPT. Okay. So additionally there is one other uh thing
additionally there is one other uh thing that I want to show you. Okay. You know
that I want to show you. Okay. You know I showed you how to copy from source to
I showed you how to copy from source to destination. Okay. And now you know what
destination. Okay. And now you know what if you know the path of something and
if you know the path of something and you want to copy it to your present
you want to copy it to your present directory to where you are currently. So
directory to where you are currently. So this is basically I'm just teaching you
this is basically I'm just teaching you this option to you know save some time.
this option to you know save some time. Uh you know at times you might want some
Uh you know at times you might want some shortcuts or some hacks right you don't
shortcuts or some hacks right you don't want to provide the complete path
want to provide the complete path everywhere. So at that situations at
everywhere. So at that situations at that scenarios you can uh use this uh
that scenarios you can uh use this uh hack. And let me explain that before I
hack. And let me explain that before I uh execute it in my uh terminal. So what
uh execute it in my uh terminal. So what I'm saying is uh right now I'm in my
I'm saying is uh right now I'm in my desktop and I have only my automobiles
desktop and I have only my automobiles and my readme text files. Okay. Now but
and my readme text files. Okay. Now but in my documents folder I have three
in my documents folder I have three other text. I have file 1.xt and file
other text. I have file 1.xt and file 2.txt. Okay. Let's say I just want to
2.txt. Okay. Let's say I just want to copy the file 2.xt. What will I do if I
copy the file 2.xt. What will I do if I want to copy my file 2.txt into my
want to copy my file 2.txt into my desktop? I'll have to go to my uh
desktop? I'll have to go to my uh documents folder then put the cp command
documents folder then put the cp command and then enter the file name and then
and then enter the file name and then copy it to this folder. Right? I have to
copy it to this folder. Right? I have to specify the path of this desktop. So
specify the path of this desktop. So instead of that there is another hack
instead of that there is another hack over there. Okay. Now instead of doing
over there. Okay. Now instead of doing that what I can do is I can just go to
that what I can do is I can just go to my terminal. I need to first go to the
my terminal. I need to first go to the desktop folder button. Okay. So I'm
desktop folder button. Okay. So I'm going to go one step back. I'm going to
going to go one step back. I'm going to say change to desktop. And here yes
say change to desktop. And here yes there is only automobiles.txt and there
there is only automobiles.txt and there is uh readme.txt. Now what I'm going to
is uh readme.txt. Now what I'm going to do is I'm going to run the cp command
do is I'm going to run the cp command such that I copy file from this
such that I copy file from this particular directory to the current
particular directory to the current directory. Okay. So the file 2.txt if
directory. Okay. So the file 2.txt if you remember that is present in my
you remember that is present in my documents directory. Right? So I'm going
documents directory. Right? So I'm going to specify the path to the documents
to specify the path to the documents directory. And the path to documents
directory. And the path to documents directory is / home edurea and
directory is / home edurea and documents. Okay. And the file name is uh
documents. Okay. And the file name is uh file 2.txt. Okay. I'm going to copy this
file 2.txt. Okay. I'm going to copy this file which is under this path to my
file which is under this path to my current directory. Okay. Instead of
current directory. Okay. Instead of having to specify my complete current
having to specify my complete current directory, I can just give one dot. So
directory, I can just give one dot. So this one dot represents the current
this one dot represents the current working directory. Okay, I'm currently
working directory. Okay, I'm currently in my desktop and what this command
in my desktop and what this command would do is it would copy this file into
would do is it would copy this file into this uh current directory. Okay, now
this uh current directory. Okay, now when I give enter and if I go back to my
when I give enter and if I go back to my uh desktop, you'll see that the file
uh desktop, you'll see that the file 2.txt has been created. Okay, that's
2.txt has been created. Okay, that's because it went to this path, picked up
because it went to this path, picked up this file and pasted it in my uh current
this file and pasted it in my uh current directory. Okay, so that's what this is
directory. Okay, so that's what this is about. All right, so this is what I
about. All right, so this is what I wanted to show you guys. This was
wanted to show you guys. This was something additional which was not there
something additional which was not there on the slides. So I'm uh done with that.
on the slides. So I'm uh done with that. So moving on to the next slide. Okay. So
So moving on to the next slide. Okay. So uh next up we have uh is the move
uh next up we have uh is the move command. Okay. So the MV like CP stands
command. Okay. So the MV like CP stands for copy. The MV here stands for move.
for copy. The MV here stands for move. Okay. And this is uh used at times when
Okay. And this is uh used at times when you want to cut paste something. Okay.
you want to cut paste something. Okay. Uh this would when we used copy then the
Uh this would when we used copy then the original copy of that file was also
original copy of that file was also present in the existing directory and it
present in the existing directory and it was created in another directory. Right?
was created in another directory. Right? But if you use the mv command then it's
But if you use the mv command then it's going to basically work like cut paste
going to basically work like cut paste where it'll remove the content from the
where it'll remove the content from the uh source directory and the only copy
uh source directory and the only copy would be present in the destination
would be present in the destination directory. All right. So u let me
directory. All right. So u let me straight away get started. It's not too
straight away get started. It's not too much of an explanation needed over here
much of an explanation needed over here because uh it's self-explanatory. If you
because uh it's self-explanatory. If you use the i flag, it basically enters into
use the i flag, it basically enters into interactive mode again like before. So
interactive mode again like before. So the u flag is again the same as what it
the u flag is again the same as what it was in the copy command. It updates the
was in the copy command. It updates the destination file only when the source
destination file only when the source file is different from the destination
file is different from the destination file. And uh the MV minus V again it
file. And uh the MV minus V again it would uh you know uh move it would print
would uh you know uh move it would print the system state okay prints the source
the system state okay prints the source and the destination files uh gets into
and the destination files uh gets into the interactive mode where the okay not
the interactive mode where the okay not interactive mode it basically means u
interactive mode it basically means u the system status will be displayed over
the system status will be displayed over here okay that's what the verbos is all
here okay that's what the verbos is all about uh so let me go back to my
about uh so let me go back to my terminal and uh show you how this copy
terminal and uh show you how this copy is done all right so let me clear the
is done all right so let me clear the screen and currently I'm in my uh
screen and currently I'm in my uh desktop folder okay And here I have uh
desktop folder okay And here I have uh these files. I have automobiles.txt and
these files. I have automobiles.txt and readme and file 2. Okay. Now what I'm
readme and file 2. Okay. Now what I'm going to do is u I'm going to use the
going to do is u I'm going to use the move command to move file 2.txt to
move command to move file 2.txt to another uh destination. I'm going to
another uh destination. I'm going to move it to the LMS. Right? So when I
move it to the LMS. Right? So when I give uh LMS okay this means that this
give uh LMS okay this means that this move command will work such that this
move command will work such that this file will be moved to LMS folder. Okay.
file will be moved to LMS folder. Okay. Let me give enter and go back to my
Let me give enter and go back to my desktop and find that it's not it's
desktop and find that it's not it's missing. That's because I ran a command
missing. That's because I ran a command over there. If I go to LMS, however,
over there. If I go to LMS, however, I'll find the file 2.txt over here. All
I'll find the file 2.txt over here. All right. Awesome. Right. So that's what uh
right. Awesome. Right. So that's what uh the MV file does. And uh supposing I
the MV file does. And uh supposing I want to uh you know similar to copy you
want to uh you know similar to copy you can move multiple uh files at the same
can move multiple uh files at the same time. All right. So I can uh move you
time. All right. So I can uh move you know supposing uh I go back to my
know supposing uh I go back to my desktop. Okay. and I'll find that there
desktop. Okay. and I'll find that there is automobiles and readme. Suppose I
is automobiles and readme. Suppose I want to move both of these to the uh
want to move both of these to the uh elements directory. Then I can do that
elements directory. Then I can do that also. I can just uh simply give move I
also. I can just uh simply give move I can give automobiles.txt and readme.txt
can give automobiles.txt and readme.txt and specify the destination. I can move
and specify the destination. I can move to any other folder or I can move to LMS
to any other folder or I can move to LMS folder. If I'm moving it to LMS folder
folder. If I'm moving it to LMS folder then I just need to give LMS. Okay. But
then I just need to give LMS. Okay. But however if I'm moving uh to another uh
however if I'm moving uh to another uh folder then I got to start from the root
folder then I got to start from the root say home edurea and from here let's say
say home edurea and from here let's say I want to go to downloads okay so
I want to go to downloads okay so downloads if I want to go I'll give this
downloads if I want to go I'll give this path I'll give enter and if you notice
path I'll give enter and if you notice both are missing from my uh desktop and
both are missing from my uh desktop and if I go to my eda and if I go to
if I go to my eda and if I go to downloads I can find the two files over
downloads I can find the two files over here. So that's how simple it is guys.
here. So that's how simple it is guys. So that's the uh move command and if you
So that's the uh move command and if you want to see the system status then you
want to see the system status then you can use the V flag like we use for CP.
can use the V flag like we use for CP. So a similar log will be generated and
So a similar log will be generated and shown. If you want to enter interactive
shown. If you want to enter interactive mode then you can use the I flag. All
mode then you can use the I flag. All right. If you're moving like two files
right. If you're moving like two files right at that time you might need the
right at that time you might need the interactive uh interactive file. So
interactive uh interactive file. So similar to copy where if you're moving
similar to copy where if you're moving to the destinations folder where there's
to the destinations folder where there's already another file with the same name
already another file with the same name then at that time you might want to use
then at that time you might want to use the flag. it would ask you whether you
the flag. it would ask you whether you want to override it or not. If you don't
want to override it or not. If you don't want to override it at all, then you can
want to override it at all, then you can just give the N flag. But there again,
just give the N flag. But there again, if you don't want to use the N flag
if you don't want to use the N flag either, then you can uh use the minus u
either, then you can uh use the minus u flag, which would update the destination
flag, which would update the destination file only when the source and the
file only when the source and the destination files are different. Okay,
destination files are different. Okay, so these are the uh different flags that
so these are the uh different flags that can be used with MB. So the basically
can be used with MB. So the basically the flags that can be used here are the
the flags that can be used here are the same as the flags that can be used with
same as the flags that can be used with the copy command. So guys, uh that's it
the copy command. So guys, uh that's it with the uh move command and we can go
with the uh move command and we can go to the next slide. Okay, we can go to
to the next slide. Okay, we can go to the next topic. But before that, there
the next topic. But before that, there is one more functionality that I want to
is one more functionality that I want to show you with respect to both copy and
show you with respect to both copy and move. I uh actually forgot to show you
move. I uh actually forgot to show you this aspect. Okay, now uh for this let
this aspect. Okay, now uh for this let me first show you the GUI aspect. Okay.
me first show you the GUI aspect. Okay. All right. I go to my edera and if you
All right. I go to my edera and if you go to my documents, you'll find all
go to my documents, you'll find all these uh three text files and also my
these uh three text files and also my LMS folder. Right now, whether be it
LMS folder. Right now, whether be it copy or whether be it move commands,
copy or whether be it move commands, I've showed you how to copy like one
I've showed you how to copy like one file or two files or three files. Okay,
file or two files or three files. Okay, but what if you have like 25 files,
but what if you have like 25 files, right? So what you have like I mean just
right? So what you have like I mean just think about this. What if you're a
think about this. What if you're a proper uh Linux user and you and you
proper uh Linux user and you and you want to just transfer all your uh files
want to just transfer all your uh files of some particular format, right? You
of some particular format, right? You want to just transfer it to another
want to just transfer it to another folder. You want to take a backup or
folder. You want to take a backup or something like that. What would you do
something like that. What would you do instead of you know you can do a control
instead of you know you can do a control A over here and choose all the files.
A over here and choose all the files. Okay? Or you can choose one after the
Okay? Or you can choose one after the other like this. But to the CLI, how do
other like this. But to the CLI, how do you do it? Correct? So you have such
you do it? Correct? So you have such problems, right? So for that you know we
problems, right? So for that you know we have options also for CLI and uh those
have options also for CLI and uh those work with both CP and the move commands.
work with both CP and the move commands. So what I'm going to do is I'm going to
So what I'm going to do is I'm going to show you how that is done. Uh so for
show you how that is done. Uh so for that purpose I'm going to first go to my
that purpose I'm going to first go to my documents directory. I'm going to make
documents directory. I'm going to make that my uh pwd. So I'll just go on back
that my uh pwd. So I'll just go on back and here I am.
and here I am. Go to documents. Okay now I'm here. So
Go to documents. Okay now I'm here. So what I'm going to do is uh I'm just
what I'm going to do is uh I'm just going to clear the screen. So of course
going to clear the screen. So of course for clearing the screen the shortcut is
for clearing the screen the shortcut is Ctrl L. Okay, if you guys have forgotten
Ctrl L. Okay, if you guys have forgotten that and uh I also mentioned that
that and uh I also mentioned that earlier. So Ctrl L is the shortcut for
earlier. So Ctrl L is the shortcut for that. Uh so yeah we have automobile.txt
that. Uh so yeah we have automobile.txt file one and file two and LMS. So we
file one and file two and LMS. So we have these four files and one folder
have these four files and one folder there. Okay. Now if I want to move this
there. Okay. Now if I want to move this one on the directory then there's
one on the directory then there's another option. So what I can do is I
another option. So what I can do is I can use something called as regular
can use something called as regular expressions. Okay. Uh regular
expressions. Okay. Uh regular expressions is one topic which I'm going
expressions is one topic which I'm going to cover in detail later during the
to cover in detail later during the session. But just because we're in the
session. But just because we're in the CP or in the move commands stage of this
CP or in the move commands stage of this uh demonstration, I want to continue and
uh demonstration, I want to continue and I want to show you this also. Okay, I
I want to show you this also. Okay, I want to just get finished with this
want to just get finished with this part. So you'll get an idea of what I'm
part. So you'll get an idea of what I'm saying when you see me do this. Uh so
saying when you see me do this. Uh so here we have these four files. So first
here we have these four files. So first let's use the copy command. So if I want
let's use the copy command. So if I want to copy all the files which are in the
to copy all the files which are in the form of a file. Okay. So they are all in
form of a file. Okay. So they are all in the .txt format, right? So what I can do
the .txt format, right? So what I can do is I can uh just do a cb I can uh click
is I can uh just do a cb I can uh click on dot or rather asterric dot txt. Okay.
on dot or rather asterric dot txt. Okay. Now what this essentially does is
Now what this essentially does is instead of uh searching for the text
instead of uh searching for the text file by its name when you specify an
file by its name when you specify an asterric it searches for all the files
asterric it searches for all the files with the uh txt okay which is ending
with the uh txt okay which is ending with a txt. So that's what this would
with a txt. So that's what this would do. And when we say cp followed by
do. And when we say cp followed by asterric.txt, it means copy all the
asterric.txt, it means copy all the files that are ending with txt. So in
files that are ending with txt. So in our case we have automobiles.txt,
our case we have automobiles.txt, file 1.txt and uh file 2.txt. Right? So
file 1.txt and uh file 2.txt. Right? So what this command would do is it would
what this command would do is it would copy these things and put it in the path
copy these things and put it in the path where I suggest here. So let's say I
where I suggest here. So let's say I want to put it in another folder. Okay.
want to put it in another folder. Okay. Let me start off from the root home
Let me start off from the root home edera. Then here I think we have you
edera. Then here I think we have you know we have these options, right? Okay.
know we have these options, right? Okay. This is the documents. So in the EDA we
This is the documents. So in the EDA we have okay we have the music folder. We
have okay we have the music folder. We have downloads pictures. Okay downloads
have downloads pictures. Okay downloads of course I've already copied something
of course I've already copied something in there. So what I'll do is I'll move
in there. So what I'll do is I'll move that to the music folder. Okay. So the
that to the music folder. Okay. So the music directory. So I'm going to say
music directory. So I'm going to say this and give enter. So your copying has
this and give enter. So your copying has been successful. So if you go back to
been successful. So if you go back to the uh music directory you'll see that
the uh music directory you'll see that there are three new files. One is
there are three new files. One is automobiles, the other one is file one
automobiles, the other one is file one and the other one is file two. Okay. Now
and the other one is file two. Okay. Now uh the same thing can be done for even
uh the same thing can be done for even move right. Uh the same way we executed
move right. Uh the same way we executed a copy, we can also execute the move
a copy, we can also execute the move command. Move is going to completely
command. Move is going to completely move it. It's more like cut pasting.
move it. It's more like cut pasting. Okay, similar to how you remember from
Okay, similar to how you remember from Windows. Let's move it to pictures.
Windows. Let's move it to pictures. Okay, so currently in pictures is
Okay, so currently in pictures is nothing. And in uh music, we have these
nothing. And in uh music, we have these three. So when I execute the move
three. So when I execute the move command, this folder should become empty
command, this folder should become empty and they should all go to the pictures
and they should all go to the pictures uh folder. All right, so move. Okay, but
uh folder. All right, so move. Okay, but we have a problem for that. What we need
we have a problem for that. What we need to do is we got to move to our uh music
to do is we got to move to our uh music folder, right? So it would this would
folder, right? So it would this would probably show an error. So I'm going to
probably show an error. So I'm going to first uh go back or rather go to music
first uh go back or rather go to music folder. Okay, we are in documents,
folder. Okay, we are in documents, right? So what we're going to do is uh
right? So what we're going to do is uh cd music. All right. And I have my
cd music. All right. And I have my commands here. Right. So here I'll
commands here. Right. So here I'll execute that move command. So it was
execute that move command. So it was this one. I'm just going to replace cp
this one. I'm just going to replace cp with mv. Okay. So from my uh music
with mv. Okay. So from my uh music directory, it's going to move all the
directory, it's going to move all the folders or files which will have the
folders or files which will have the .txt format. Okay? All the files, not
.txt format. Okay? All the files, not folders. It will move all the files with
folders. It will move all the files with the .txt format. And it will move it to
the .txt format. And it will move it to home/ora/
home/ora/ let's move it to pictures. What do you
let's move it to pictures. What do you say? Okay. So when I give enter, that
say? Okay. So when I give enter, that would have moved. So let's go back to
would have moved. So let's go back to our folders. Music. There's nothing
our folders. Music. There's nothing here. This has been cut pasted to the
here. This has been cut pasted to the pictures directory. All right. So this
pictures directory. All right. So this is what I wanted to show you. Okay. This
is what I wanted to show you. Okay. This is what I missed showing you earlier
is what I missed showing you earlier while executing the CP command. But
while executing the CP command. But yeah, here we are. I've done this. And
yeah, here we are. I've done this. And similarly, if you want to go also uh you
similarly, if you want to go also uh you know if you're from the music directory
know if you're from the music directory and if you want to move something to the
and if you want to move something to the uh present working directory even that
uh present working directory even that is possible. Okay. So another
is possible. Okay. So another possibility which I would like to show
possibility which I would like to show you is that of going back going to
you is that of going back going to pictures and then we have all this here.
pictures and then we have all this here. I'm going to clear the screen. LS again.
I'm going to clear the screen. LS again. We have automobiles file 1.txt and file
We have automobiles file 1.txt and file 2.txt.
2.txt. Right? So uh we can do a move command
Right? So uh we can do a move command and uh
so right now we are in the uh so let me clear the screen again.
clear the screen again. So I'm going to do a cd I'm going to
So I'm going to do a cd I'm going to clear the screen and uh currently I'm
clear the screen and uh currently I'm going to do an ls. So some of our items
going to do an ls. So some of our items are present in pictures. So what I'm
are present in pictures. So what I'm going to do is I'm going to uh move back
going to do is I'm going to uh move back to music. If I do an ls, there's nothing
to music. If I do an ls, there's nothing over here. So what I'll do is I'll say
over here. So what I'll do is I'll say move
move slashhome/reka
/ pictures dot okay asterric first dot txt
pictures dot okay asterric first dot txt and I want to move it to the current
and I want to move it to the current directory. So when I do this again from
directory. So when I do this again from the pictures everything would have moved
the pictures everything would have moved back to music. All right. So that is the
back to music. All right. So that is the other uh thing that I want to show you.
other uh thing that I want to show you. Okay. So similarly it works for even the
Okay. So similarly it works for even the copy command. I'm pretty sure you'll
copy command. I'm pretty sure you'll understand how it works. So I'm not
understand how it works. So I'm not going to waste too much time on that.
going to waste too much time on that. Okay. I've cleared my screen and now
Okay. I've cleared my screen and now let's uh start with the next topic.
let's uh start with the next topic. Okay. I'm going to go back to my slides
Okay. I'm going to go back to my slides and yeah, the next topic is uh make
and yeah, the next topic is uh make directory commands. Okay, so the next
directory commands. Okay, so the next topic is uh make directory. Okay, that's
topic is uh make directory. Okay, that's what mkdir stands for make directory.
what mkdir stands for make directory. All right, so it's simple again if it's
All right, so it's simple again if it's all about creating a new directory or
all about creating a new directory or creating a new folder. Okay, so uh to
creating a new folder. Okay, so uh to create a new directory, you just specify
create a new directory, you just specify mkdir and uh the path. Okay, the
mkdir and uh the path. Okay, the directory path. Okay, that would create
directory path. Okay, that would create a new subdirectory in that path. Okay
a new subdirectory in that path. Okay guys, so currently we are in the uh
guys, so currently we are in the uh documents, right? So I'm going to do an
documents, right? So I'm going to do an ls. I have these many uh things. So I'm
ls. I have these many uh things. So I'm going to do a mkdir and create a new
going to do a mkdir and create a new folder over here. So that folder name is
folder over here. So that folder name is going to be uh let's say
going to be uh let's say folder one. Okay, when I do this, a new
folder one. Okay, when I do this, a new folder is created. So when I do the ls
folder is created. So when I do the ls command again, so you can see that the
command again, so you can see that the folder one is extra. Okay, it was not
folder one is extra. Okay, it was not there the previous time that we executed
there the previous time that we executed the ls command. Okay, so that's how you
the ls command. Okay, so that's how you create a new folder. So it's pretty
create a new folder. So it's pretty simple. Now comes the other question.
simple. Now comes the other question. Okay, I can go into uh the folder one.
Okay, I can go into uh the folder one. Okay, of course there'll be nothing
Okay, of course there'll be nothing inside. Now what if I want to create
inside. Now what if I want to create multiple folders? Okay, and uh parent
multiple folders? Okay, and uh parent directories. Let's say something like I
directories. Let's say something like I want to create folder one inside which I
want to create folder one inside which I want to create a folder two and create a
want to create a folder two and create a folder three. Is that possible? Okay.
folder three. Is that possible? Okay. So, I'm going to try doing that and show
So, I'm going to try doing that and show you if it's possible or not. Okay. So,
you if it's possible or not. Okay. So, I'm going to say make directory folder
I'm going to say make directory folder one slash
one slash folder 2. Okay. This would be folder two
folder 2. Okay. This would be folder two because I'm already inside folder one.
because I'm already inside folder one. This would be folder three and
This would be folder three and folder 4. Okay. So, this basically will
folder 4. Okay. So, this basically will run the make directory command inside
run the make directory command inside folder one and it will make a directory
folder one and it will make a directory 2, 3 and four. Now, when I give enter,
2, 3 and four. Now, when I give enter, these folders should be created. Ideally
these folders should be created. Ideally they should be created. Okay, ideally
they should be created. Okay, ideally speaking. So let me just verify
speaking. So let me just verify everything once and show it to you. So
everything once and show it to you. So it was documents. This was a new folder
it was documents. This was a new folder I created. Folder one. There is nothing
I created. Folder one. There is nothing inside. Okay. Now uh from the terminal
inside. Okay. Now uh from the terminal if I click enter it says make directory
if I click enter it says make directory cannot create directory folder 2 3 and
cannot create directory folder 2 3 and four. Okay. Because there's no such file
four. Okay. Because there's no such file or directory. Okay. Do you know why that
or directory. Okay. Do you know why that is? I as you specifically can we do it?
is? I as you specifically can we do it? That is because when we try to enter one
That is because when we try to enter one directory it's possible okay when like
directory it's possible okay when like in this case we specified just one one
in this case we specified just one one directory right just folder one so it
directory right just folder one so it created the directory once but in this
created the directory once but in this case there are too many directories that
case there are too many directories that we need to create okay it's like 2 three
we need to create okay it's like 2 three and four how can make directory create
and four how can make directory create so many folders because this is going to
so many folders because this is going to be in the form of a parent child or a
be in the form of a parent child or a subdirectory right we are creating
subdirectory right we are creating folder two inside which there's a folder
folder two inside which there's a folder three inside which there's a folder four
three inside which there's a folder four so in this case mkdir is not enough so
so in this case mkdir is not enough so this is when we need to use another flag
this is when we need to use another flag called the hyphen P flag that stands for
called the hyphen P flag that stands for parent. Okay, let me go to my slides and
parent. Okay, let me go to my slides and just cover that aspect once. So as you
just cover that aspect once. So as you can see here there's a flag called
can see here there's a flag called hyphen P. Okay. And what it does is it
hyphen P. Okay. And what it does is it creates both a new parent directory and
creates both a new parent directory and a subdirectory and it's essentially used
a subdirectory and it's essentially used only when you're creating like two three
only when you're creating like two three directories and I mean you're creating
directories and I mean you're creating one directory and a couple of
one directory and a couple of subdirectories under that directory.
subdirectories under that directory. Okay. So that's when you use this. Uh
Okay. So that's when you use this. Uh alternatively you can also use this
alternatively you can also use this hyphen parents. All right. And uh if you
hyphen parents. All right. And uh if you want to create one parent directory and
want to create one parent directory and multiple subdirectories inside that
multiple subdirectories inside that directory, then you can use these flower
directory, then you can use these flower brackets. Okay, inside the flower
brackets. Okay, inside the flower brackets you can have the different
brackets you can have the different folder names. Okay, so let me just
folder names. Okay, so let me just quickly go to the terminal and show you
quickly go to the terminal and show you that aspect. So make directory these
that aspect. So make directory these were there. And now I'm going to give
were there. And now I'm going to give minus p. And when I execute this,
minus p. And when I execute this, everything would have been created. So
everything would have been created. So let me do a cd folder 2. Now do an ls.
let me do a cd folder 2. Now do an ls. There's a folder 3. Now let me do this
There's a folder 3. Now let me do this and enter and let me do an ls again.
and enter and let me do an ls again. There's a folder four. Of course here
There's a folder four. Of course here there would be nothing right. So let me
there would be nothing right. So let me uh enter this folder four and here there
uh enter this folder four and here there would be nothing folder four. So that's
would be nothing folder four. So that's what I was talking about. Okay. Uh let
what I was talking about. Okay. Uh let me also verify that once from the
me also verify that once from the terminal folder one we created a folder
terminal folder one we created a folder two inside which there's a folder three
two inside which there's a folder three and there's a folder four. Okay guys so
and there's a folder four. Okay guys so this is what we just created. So, what
this is what we just created. So, what I'm going to do is uh I'm going to just
I'm going to do is uh I'm going to just go back to my folder one here. Okay. In
go back to my folder one here. Okay. In fact, yeah. Okay. Folder one should be
fact, yeah. Okay. Folder one should be good. Now, I want to show you executing
good. Now, I want to show you executing the same command with the flower
the same command with the flower bracket. Right? I told you that creating
bracket. Right? I told you that creating a flower bracket will let you create
a flower bracket will let you create multiple directories inside that
multiple directories inside that directory. So, if I'm going to say make
directory. So, if I'm going to say make directory
directory folder uh because it's inside folder
folder uh because it's inside folder one, I can create one here. Folder two.
one, I can create one here. Folder two. I can say comma folder 3 comma folder 4.
I can say comma folder 3 comma folder 4. Okay. And if I close this flower bracket
Okay. And if I close this flower bracket then these three sub directories or
then these three sub directories or folders would be created inside my
folders would be created inside my folder one. All right. So I've given
folder one. All right. So I've given enter here. If I go back to my GUI so I
enter here. If I go back to my GUI so I go inside folder one. So initially there
go inside folder one. So initially there was one folder two. Okay. That was the
was one folder two. Okay. That was the folder two which I created earlier.
folder two which I created earlier. Okay. And now I created folder two all
Okay. And now I created folder two all in small small f small f and small f
in small small f small f and small f here. So folder two, folder three,
here. So folder two, folder three, folder four was created. Now folder this
folder four was created. Now folder this one was created earlier. Okay guys, so
one was created earlier. Okay guys, so that's how uh you know you make
that's how uh you know you make directories. In fact you can even append
directories. In fact you can even append this with a parent. Say you're
this with a parent. Say you're supposeding you're now in folder uh one
supposeding you're now in folder uh one right you can say make directory you can
right you can say make directory you can say f2 put a slash and then inside this
say f2 put a slash and then inside this f2 folder these subdirectories will be
f2 folder these subdirectories will be created okay now if I give enter I know
created okay now if I give enter I know what the problem here is uh it says
what the problem here is uh it says because f2 is not created right now
because f2 is not created right now correct this is the time when you got to
correct this is the time when you got to use the uh hyphen p command parents
use the uh hyphen p command parents command right so which I showed you
command right so which I showed you earlier so now that views the minus P.
earlier so now that views the minus P. So the parent is created and the uh
So the parent is created and the uh children are also created. So if I go
children are also created. So if I go back to folder one, this was F2 is what
back to folder one, this was F2 is what I created recently. All right. So inside
I created recently. All right. So inside F2, there should be folder 2, folder 3,
F2, there should be folder 2, folder 3, folder 4. All right. So this is uh what
folder 4. All right. So this is uh what we can do with respect to make directory
we can do with respect to make directory commands. All right. So let me close
commands. All right. So let me close this and go back to my slides. Okay. And
this and go back to my slides. Okay. And uh go to the next topic. Okay. So uh
uh go to the next topic. Okay. So uh next up is the uh rmdir and the rm
next up is the uh rmdir and the rm commands. Okay. So this is the remove
commands. Okay. So this is the remove and this stands for remove directory.
and this stands for remove directory. Now there's a subtle difference between
Now there's a subtle difference between the two. Okay. Now uh when you say okay
the two. Okay. Now uh when you say okay the basic difference between the two is
the basic difference between the two is that when you say remove directory it'll
that when you say remove directory it'll only remove that particular directory.
only remove that particular directory. But when you say remove it can also
But when you say remove it can also remove the subdirectories or the child
remove the subdirectories or the child directories inside that one. So let me
directories inside that one. So let me just go to my terminal and show you how
just go to my terminal and show you how these are executed. Okay. I'm going to
these are executed. Okay. I'm going to go to my terminal. So currently I am in
go to my terminal. So currently I am in my folder one right. So let's go to
my folder one right. So let's go to folder two and then do an ls cd folder 3
folder two and then do an ls cd folder 3 ls cd folder
ls cd folder folder 4. Okay. Of course there's
folder 4. Okay. Of course there's nothing here. So what I can do is I'm in
nothing here. So what I can do is I'm in folder three now. Okay. LS again. Yes
folder three now. Okay. LS again. Yes I'm in folder three. And I if I want to
I'm in folder three. And I if I want to remove this folder then I can do uh
remove this folder then I can do uh remove directory
remove directory folder four. All right. So when I do
folder four. All right. So when I do this this particular uh folder would
this this particular uh folder would have been deleted. Now from folder two I
have been deleted. Now from folder two I can uh again remove folder 3. Okay.
can uh again remove folder 3. Okay. Similar to how I removed folder four.
Similar to how I removed folder four. But how about I go one more path back.
But how about I go one more path back. Okay. So right now I'm in ls. Okay. So
Okay. So right now I'm in ls. Okay. So if I do a pwd you'll find that I'm in
if I do a pwd you'll find that I'm in folder one. Okay. And when I do an ls I
folder one. Okay. And when I do an ls I have f2 folder 2. I have a capital
have f2 folder 2. I have a capital folder two. This is where my folder
folder two. This is where my folder three and folder four is present. Okay.
three and folder four is present. Okay. So I have that and then I have folder
So I have that and then I have folder three and I have four and four. Now
three and I have four and four. Now however if I try doing a remove
however if I try doing a remove directory and if I try to remove folder
directory and if I try to remove folder two right it will not work. It failed
two right it will not work. It failed because the folder two which we are
because the folder two which we are trying to delete right from inside
trying to delete right from inside folder one we are trying to delete the
folder one we are trying to delete the folder two. This is that folder two and
folder two. This is that folder two and inside this folder two there's another
inside this folder two there's another folder that is folder three let me just
folder that is folder three let me just uh show it to you once so that I can
uh show it to you once so that I can remove your confusion. So inside this uh
remove your confusion. So inside this uh folder two I have folder three. Okay.
folder two I have folder three. Okay. And because I'm trying to delete this uh
And because I'm trying to delete this uh folder two it's not able to delete
folder two it's not able to delete because there is already a folder three
because there is already a folder three inside this folder. That is a problem
inside this folder. That is a problem with remove directory. So guys I just
with remove directory. So guys I just cleared the screen and let me just do an
cleared the screen and let me just do an ls again. So now I'm going to show you
ls again. So now I'm going to show you how to remove these folders. I showed
how to remove these folders. I showed you removing folder four. Okay. So
you removing folder four. Okay. So inside this folder three, I went and I
inside this folder three, I went and I removed folder four. Okay. Now I'm going
removed folder four. Okay. Now I'm going to show you how to remove multiple
to show you how to remove multiple folders. Okay. At the same time. Now
folders. Okay. At the same time. Now let's say I'm running the same remove
let's say I'm running the same remove directory again. So I'm going to say
directory again. So I'm going to say remove folder 2. And u when I give
remove folder 2. And u when I give enter, it says failed to remove folder 2
enter, it says failed to remove folder 2 because the directory is not empty.
because the directory is not empty. Okay. Uh do you know what the problem
Okay. Uh do you know what the problem is? it's uh telling right because the
is? it's uh telling right because the directory is not empty it's not able to
directory is not empty it's not able to delete. So because folder 3 is contained
delete. So because folder 3 is contained inside folder two it's not able to
inside folder two it's not able to delete this folder. So if I want to
delete this folder. So if I want to delete folder two also then what I got
delete folder two also then what I got to do is you know I got to first delete
to do is you know I got to first delete the folder three and then delete the
the folder three and then delete the folder four. So I have to provide the
folder four. So I have to provide the absolute path of the child directory.
absolute path of the child directory. Okay. So I'm going to say remove
Okay. So I'm going to say remove directory. Okay. Same like before I'm
directory. Okay. Same like before I'm going to say folder 2/ folder 3. when I
going to say folder 2/ folder 3. when I run this command then my folder three
run this command then my folder three will get deleted okay the child will get
will get deleted okay the child will get deleted but the parent will still be uh
deleted but the parent will still be uh active folder two will be active okay
active folder two will be active okay because uh when I use the rmdir with
because uh when I use the rmdir with folder two and folder three only folder
folder two and folder three only folder three will get deleted let me show you
three will get deleted let me show you uh why that's the case when I give enter
uh why that's the case when I give enter when I do an ls folder two should be
when I do an ls folder two should be available see folder two is available
available see folder two is available but when I do a folder uh two there's
but when I do a folder uh two there's nothing in here okay there's nothing in
nothing in here okay there's nothing in here So if you want to do that, if you
here So if you want to do that, if you want to delete both the parent and the
want to delete both the parent and the child at the same time, you got to use a
child at the same time, you got to use a minus p flag. So let me show you to uh
minus p flag. So let me show you to uh use a minus p flag. Okay. So I'm just
use a minus p flag. Okay. So I'm just going to make the folder three now. And
going to make the folder three now. And I'm going to show you how to use a p
I'm going to show you how to use a p flag. So similar to how we use while
flag. So similar to how we use while creating a folder, we got to use the
creating a folder, we got to use the same remove directory. Okay. Rmdir with
same remove directory. Okay. Rmdir with the uh hyphen p and folder 2 and folder
the uh hyphen p and folder 2 and folder 3. Folder 2/folder 3. So in this case
3. Folder 2/folder 3. So in this case both the folder two and the parent and
both the folder two and the parent and the child would get deleted. Okay.
the child would get deleted. Okay. Enter. When I do an ls I don't have a
Enter. When I do an ls I don't have a folder two here. Okay. This one is also
folder two here. Okay. This one is also deleted. So that's what a minus p flag
deleted. So that's what a minus p flag does. Now let me just create make a new
does. Now let me just create make a new directory. And uh what I want to show
directory. And uh what I want to show you is the verbos. Okay. So I'm going to
you is the verbos. Okay. So I'm going to make directory. So again the the ones
make directory. So again the the ones which I deleted have come back again
which I deleted have come back again would have been created again. So I want
would have been created again. So I want to show you the usage of the verbose
to show you the usage of the verbose directory. when I add a V here as for
directory. when I add a V here as for the slides it said right verbose. So
the slides it said right verbose. So when I add a v here and when I hit
when I add a v here and when I hit enter, okay, I've done the make
enter, okay, I've done the make directory again. So I have to actually
directory again. So I have to actually remove the directory now. Okay. Now when
remove the directory now. Okay. Now when I say remove directory and when I uh try
I say remove directory and when I uh try to print the uh verbosph
to print the uh verbosph so it says first it's deleted the folder
so it says first it's deleted the folder 3. Okay, which is inside folder two.
3. Okay, which is inside folder two. After deleting that, it has come and
After deleting that, it has come and deleted folder 2. Okay, so that's what
deleted folder 2. Okay, so that's what this is all about. This is what uh you
this is all about. This is what uh you know you need to know about the remove
know you need to know about the remove directory commands. Now uh let me just
directory commands. Now uh let me just clear the screen.
clear the screen. So guys uh now let's uh see how the rm
So guys uh now let's uh see how the rm command works. Okay. Now uh the rm
command works. Okay. Now uh the rm command here as it says from the slides
command here as it says from the slides it can be used to remove even non- empty
it can be used to remove even non- empty directories. Okay. If we use the rm with
directories. Okay. If we use the rm with the r flag and if we use uh the r and p
the r flag and if we use uh the r and p flags together then it removes the
flags together then it removes the non-mpt directories including the parent
non-mpt directories including the parent and the uh sub directories.
and the uh sub directories. Okay. So the one limitation that we had
Okay. So the one limitation that we had with rmdir command was that we could not
with rmdir command was that we could not remove uh non- empty directories. we had
remove uh non- empty directories. we had to first empty them and then only delete
to first empty them and then only delete them. Okay, otherwise we had to specify
them. Okay, otherwise we had to specify the entire path and then uh you know use
the entire path and then uh you know use the p flag to remove all the parents and
the p flag to remove all the parents and all the child subdirectories in that
all the child subdirectories in that path right that was the limitation that
path right that was the limitation that we had with remove directory but in rm
we had with remove directory but in rm we don't have that problem because uh
we don't have that problem because uh let's see okay in ls we have so many
let's see okay in ls we have so many folders okay so if I try going to f2
folders okay so if I try going to f2 okay and I do an ls here then I have
okay and I do an ls here then I have three different folders folder two
three different folders folder two folder three folder four okay now if
folder three folder four okay now if it's an rmdir command it cannot
it's an rmdir command it cannot technically delete this folder called
technically delete this folder called F_sub_2. F_sub_2 is basically a non-MP
F_sub_2. F_sub_2 is basically a non-MP directory. Inside F_sub_2, there are
directory. Inside F_sub_2, there are other directories like folder 2, 3 and
other directories like folder 2, 3 and four. So let me just uh show to you
four. So let me just uh show to you once. So inside F2, we have three
once. So inside F2, we have three folders. Folder 2, folder 3 and folder
folders. Folder 2, folder 3 and folder four. So with the uh rmd di command, we
four. So with the uh rmd di command, we cannot definitely remove. But with
cannot definitely remove. But with f_sub_2, we have a chance of removing
f_sub_2, we have a chance of removing it. Okay, that's because uh we can make
it. Okay, that's because uh we can make use of the r flag here. Okay, but
use of the r flag here. Okay, but however, this will also it will delete
however, this will also it will delete f2 and its subfolders. Okay. So, let me
f2 and its subfolders. Okay. So, let me do an ls. And uh if you can see here,
do an ls. And uh if you can see here, initially under folder one, we had
initially under folder one, we had f_sub_2 and these three. Okay. But now
f_sub_2 and these three. Okay. But now we don't have that under f2 because that
we don't have that under f2 because that whole f2 folder is missing. If I go back
whole f2 folder is missing. If I go back to my folder one here, you'll see that
to my folder one here, you'll see that the f_sub_2 is uh missing over here too.
the f_sub_2 is uh missing over here too. That's because under right, it uh
That's because under right, it uh removed the whole F2 folder in spite of
removed the whole F2 folder in spite of it containing some folders. Okay. And
it containing some folders. Okay. And that's what the R flag does. That's the
that's what the R flag does. That's the advantage of using the R flag. Okay. So
advantage of using the R flag. Okay. So if the same thing if we uh use the R
if the same thing if we uh use the R flag with the V flag then it'll print
flag with the V flag then it'll print the uh status also. It's like the
the uh status also. It's like the verbose right? It'll print it'll tell
verbose right? It'll print it'll tell you what all has been deleted and how it
you what all has been deleted and how it has been deleted. So that's the
has been deleted. So that's the advantage with using RM over uh RMDR.
advantage with using RM over uh RMDR. Okay. At times this is more beneficial.
Okay. At times this is more beneficial. So I'm just going to clear the screen
So I'm just going to clear the screen and uh getting back to my presentation.
and uh getting back to my presentation. I'm done with all the concepts in this
I'm done with all the concepts in this slide. So let me go on to the next
slide. So let me go on to the next topic. Okay. So the next topic is going
topic. Okay. So the next topic is going to be that of uh working with user
to be that of uh working with user permissions. Okay, it's very important
permissions. Okay, it's very important for a Linux administrator to know what
for a Linux administrator to know what these user permissions are. Okay,
these user permissions are. Okay, because uh the different files will be
because uh the different files will be there, different directories will be
there, different directories will be there and he has to determine what kind
there and he has to determine what kind of access will be available for which
of access will be available for which user, right? So that's what is control
user, right? So that's what is control here. So uh the different permissions
here. So uh the different permissions are basically read, write and execute.
are basically read, write and execute. Okay, R stands for read, W stands for
Okay, R stands for read, W stands for write and uh execute is X. Okay, so uh
write and uh execute is X. Okay, so uh initially you'll get this kind of an
initially you'll get this kind of an output. Okay, you know what? Let me go
output. Okay, you know what? Let me go to my terminal and show you what happens
to my terminal and show you what happens when you run an ls n ls minus l command
when you run an ls n ls minus l command because user permissions is something
because user permissions is something which will appear and which you can
which will appear and which you can control via the ls-l command, right?
control via the ls-l command, right? Because when you do that all the
Because when you do that all the different file contents whether it's a
different file contents whether it's a directory or whether it's another file
directory or whether it's another file all those things along with their uh
all those things along with their uh permissions will be visible in long
permissions will be visible in long format right so let me go to my terminal
format right so let me go to my terminal first and uh go to cd all right now when
first and uh go to cd all right now when I do an ls I have a list of all these uh
I do an ls I have a list of all these uh documents okay but however when I do an
documents okay but however when I do an ls-l
ls-l I get it in long format okay so I get it
I get it in long format okay so I get it something like this so for each folder I
something like this so for each folder I have the permission set so for desktop I
have the permission set so for desktop I have the permission sets and then I have
have the permission sets and then I have the other components. Okay, I'm going to
the other components. Okay, I'm going to explain what this entire component what
explain what this entire component what the entire row means. So to not let you
the entire row means. So to not let you get too complicated, first I'm going to
get too complicated, first I'm going to explain only this part. Okay, the first
explain only this part. Okay, the first 10 characters. If you see here, the
10 characters. If you see here, the first 10 characters are these and I will
first 10 characters are these and I will explain this part first and then I'll
explain this part first and then I'll explain this set these three blocks and
explain this set these three blocks and then I'll explain the remaining blocks.
then I'll explain the remaining blocks. Okay. So getting back to this uh first
Okay. So getting back to this uh first block in my slides you can see that the
block in my slides you can see that the first block it determines what is the
first block it determines what is the file type okay it's either the file or
file type okay it's either the file or directory type in fact if that is a
directory type in fact if that is a directory then it would be represented
directory then it would be represented by d okay if you have a d as the first
by d okay if you have a d as the first character over here then that's a
character over here then that's a directory okay as it says but it can
directory okay as it says but it can also be any other thing if it's a hyphen
also be any other thing if it's a hyphen like this then it means that it's a
like this then it means that it's a normal file okay but in the first letter
normal file okay but in the first letter if it's a c then it means it's a
if it's a c then it means it's a character special file and uh if there
character special file and uh if there this B over here in this part of the
this B over here in this part of the first letter and then it's a binary
first letter and then it's a binary special file. So basically there can be
special file. So basically there can be four different letters over here. It can
four different letters over here. It can be either a hyphen or D, B or C
be either a hyphen or D, B or C representing four different aspects.
representing four different aspects. Okay. So uh that is the first
Okay. So uh that is the first information that you have about that
information that you have about that particular file and then you have three
particular file and then you have three different blocks. Okay. So the next nine
different blocks. Okay. So the next nine letters are going to determine the user
letters are going to determine the user permissions. Okay. And those nine are
permissions. Okay. And those nine are divided into three three. Okay. So the
divided into three three. Okay. So the first three represent the user
first three represent the user permissions. Okay. The second block
permissions. Okay. The second block having three RWX representatives are
having three RWX representatives are those of group permissions and the final
those of group permissions and the final block represents other permissions.
block represents other permissions. Okay, this means other users. Now this
Okay, this means other users. Now this user is the actual user who is logged
user is the actual user who is logged into the system. Okay, that particular
into the system. Okay, that particular user. So this is the user permissions.
user. So this is the user permissions. This is the group permissions which the
This is the group permissions which the user belong to and what the other group
user belong to and what the other group can view and this is with respect to the
can view and this is with respect to the other users. Okay, that's what is meant
other users. Okay, that's what is meant by this others. So if we have uh and the
by this others. So if we have uh and the order always goes by RWX and RWX and
order always goes by RWX and RWX and here also it'll be RW and X. Okay. So
here also it'll be RW and X. Okay. So that is the order read, write and
that is the order read, write and execute. So if the first three blocks
execute. So if the first three blocks are all R, W and X then it means that
are all R, W and X then it means that the user has all the three permissions
the user has all the three permissions or the owner of the file or the user has
or the owner of the file or the user has uh the read, write and the execute
uh the read, write and the execute permissions. Okay. And in this place if
permissions. Okay. And in this place if there are three characters right RW W
there are three characters right RW W and X in this order it means that the
and X in this order it means that the owner or the user has the permissions to
owner or the user has the permissions to read write and execute that particular
read write and execute that particular file. Okay. And if there is RW and X in
file. Okay. And if there is RW and X in the next block then it means that the
the next block then it means that the group has the read write and execute
group has the read write and execute permissions on that particular file. So
permissions on that particular file. So every file that's created right it will
every file that's created right it will have a user and it will also have a
have a user and it will also have a default group that it will be assigned
default group that it will be assigned to. So all the users a part of uh that
to. So all the users a part of uh that group will have the read, write and
group will have the read, write and execute permissions. Okay. But whereas
execute permissions. Okay. But whereas the last three here it stands for other
the last three here it stands for other users permission. So there can be
users permission. So there can be multiple users, right? The same system
multiple users, right? The same system can have multiple users. One of course
can have multiple users. One of course would be the root user. The other would
would be the root user. The other would be the owner or you and besides you
be the owner or you and besides you there can be any number of users. It can
there can be any number of users. It can be your friends, your colleagues or uh
be your friends, your colleagues or uh you know other people. So this others
you know other people. So this others represents that. And uh if you have a
represents that. And uh if you have a blank in any place okay so in this case
blank in any place okay so in this case there's a blank over here in place of W
there's a blank over here in place of W there's a blank it means that this
there's a blank it means that this others they don't have the right access
others they don't have the right access they only have the read access and the
they only have the read access and the execute access all right and similarly
execute access all right and similarly if you go back to the terminal okay and
if you go back to the terminal okay and if you see here uh take the example of
if you see here uh take the example of this particular file desktop okay
this particular file desktop okay desktop folder is where we were
desktop folder is where we were executing a lot of commands right it is
executing a lot of commands right it is under the era folder so yeah this was
under the era folder so yeah this was the folder that we are talking the
the folder that we are talking the desktop right now it's a directory
desktop right now it's a directory basically okay that you all agree with
basically okay that you all agree with then these three characters represent
then these three characters represent that the person who's using it okay
that the person who's using it okay right now the person who's using it uh
right now the person who's using it uh because I'm logged in right now and I've
because I'm logged in right now and I've logged in with this username right sorry
logged in with this username right sorry for that guys yeah and I've logged in
for that guys yeah and I've logged in with this username right Eda so uh me
with this username right Eda so uh me being the owner and me being the user I
being the owner and me being the user I have the read write and execute
have the read write and execute permissions okay but the group that I
permissions okay but the group that I belong group. Okay, that group does not
belong group. Okay, that group does not have the read, write and execute
have the read, write and execute permissions and the group that this file
permissions and the group that this file belongs to. Now, because uh this file is
belongs to. Now, because uh this file is either owned or used by me, okay, now
either owned or used by me, okay, now because I'm the user, I have this access
because I'm the user, I have this access and then this file will also belong to a
and then this file will also belong to a group, right? So, whenever you create
group, right? So, whenever you create this file, it'll be assigned to that
this file, it'll be assigned to that particular user creating it and it'll be
particular user creating it and it'll be assigned to a default group. So, we're
assigned to a default group. So, we're talking about that group here, okay? And
talking about that group here, okay? And that particular group does not have all
that particular group does not have all three rights. It has only the read
three rights. It has only the read permission and the execute permission.
permission and the execute permission. It doesn't have the right permission.
It doesn't have the right permission. Okay. And the same thing can be said for
Okay. And the same thing can be said for uh even the other users. So the other
uh even the other users. So the other users in that system who'll be using
users in that system who'll be using that system, they'll only have the read
that system, they'll only have the read and execute access on the uh desktop.
and execute access on the uh desktop. Okay. But whereas if you take the
Okay. But whereas if you take the example of this file one.txt, right,
example of this file one.txt, right, which I created sometime back uh during
which I created sometime back uh during this session, this one if you see the
this session, this one if you see the permissions are such that the first one
permissions are such that the first one is a hyphen. Okay, what hyphen
is a hyphen. Okay, what hyphen technically means is it's a normal file.
technically means is it's a normal file. Okay, I explained that hyphen is normal.
Okay, I explained that hyphen is normal. B stands for binary special file and C
B stands for binary special file and C stands for character special file. So of
stands for character special file. So of course we don't have uh those options
course we don't have uh those options here. We don't have the B and C options.
here. We don't have the B and C options. But what you got to understand is uh is
But what you got to understand is uh is that this is a normal file and this is a
that this is a normal file and this is a directory. Okay, wherever there is D. So
directory. Okay, wherever there is D. So since this is a file and the access for
since this is a file and the access for the user is such that I have the read
the user is such that I have the read and write access. Okay, but I can't
and write access. Okay, but I can't execute it. The user can't execute it.
execute it. The user can't execute it. And when it comes to the group even the
And when it comes to the group even the group has the read and write access but
group has the read and write access but it cannot execute it. The other users
it cannot execute it. The other users however they have only the read access
however they have only the read access and they cannot execute this particular
and they cannot execute this particular file. Right? So they cannot execute or
file. Right? So they cannot execute or they cannot write this particular file.
they cannot write this particular file. So that's what these group permissions
So that's what these group permissions mean. And if you go forward from group
mean. And if you go forward from group permissions there are more other blocks
permissions there are more other blocks right. So let's go back to the slides
right. So let's go back to the slides and see what they stand for. So in this
and see what they stand for. So in this slide let's talk about the next three
slide let's talk about the next three blocks. Okay. So the next block is that
blocks. Okay. So the next block is that of a number. Okay, you have a number
of a number. Okay, you have a number over here and that represents the
over here and that represents the symbolic links. All right, the block
symbolic links. All right, the block after that is uh the one that represents
after that is uh the one that represents the owner name and the one followed by
the owner name and the one followed by that represents the group name. Okay, so
that represents the group name. Okay, so that is with respect to these three
that is with respect to these three blocks. All right, and then after that
blocks. All right, and then after that comes the file size of the particular
comes the file size of the particular file and then you have the time stamp
file and then you have the time stamp the time when the file was created, the
the time when the file was created, the file or the folder was created. This is
file or the folder was created. This is the actual file size of the block. Okay,
the actual file size of the block. Okay, now that's what the user permissions
now that's what the user permissions here represent. So if I quickly go back
here represent. So if I quickly go back to the uh terminal and show you this is
to the uh terminal and show you this is basically the symbolic link. This is the
basically the symbolic link. This is the uh owner name. This is the group name of
uh owner name. This is the group name of the file. This is the uh block size.
the file. This is the uh block size. Okay. And this is all in kilobytes.
Okay. And this is all in kilobytes. Okay. And uh this is the time stamp and
Okay. And uh this is the time stamp and this is of course the name of the file.
this is of course the name of the file. Right? So we have the name of the file
Right? So we have the name of the file and that file will have first be the
and that file will have first be the file type then user permissions then
file type then user permissions then symbolic links then the owner name then
symbolic links then the owner name then group name then the file size then comes
group name then the file size then comes the time stamp at the end. So that's
the time stamp at the end. So that's what the different file permissions are.
what the different file permissions are. The read, write, and execute. And if you
The read, write, and execute. And if you want to modify any of these file
want to modify any of these file permissions, then it's also possible.
permissions, then it's also possible. Okay. Now, let me go to my slides and
Okay. Now, let me go to my slides and show you how that's possible. Let me
show you how that's possible. Let me show you some theory first. Okay. So,
show you some theory first. Okay. So, first of all, if you want to change the
first of all, if you want to change the permissions, then you can use the chod
permissions, then you can use the chod command. Okay. You can use the chod
command. Okay. You can use the chod command as shown over here. And uh you
command as shown over here. And uh you can use it to change the access
can use it to change the access permission of both the files and the
permission of both the files and the directories. If you want to change the
directories. If you want to change the owner of the particular file, okay,
owner of the particular file, okay, change the owner of that particular file
change the owner of that particular file or directory, then you can use the ch
or directory, then you can use the ch own command. And then if you want to
own command. And then if you want to change the group ownership of that file,
change the group ownership of that file, then you can use a chrp. Okay, so when
then you can use a chrp. Okay, so when you use the chod command, you got to
you use the chod command, you got to specify whom are you referring to? Are
specify whom are you referring to? Are you referring to the uh the user? Are
you referring to the uh the user? Are you referring to the group or are you
you referring to the group or are you referring to the other people? Okay, the
referring to the other people? Okay, the other users. You got to say that. And
other users. You got to say that. And then you got to use either a plus symbol
then you got to use either a plus symbol or a minus symbol. Okay, when you use
or a minus symbol. Okay, when you use plus, it means that you're adding these
plus, it means that you're adding these two rights. Uh so in this case when
two rights. Uh so in this case when you're saying G plus WX so G stands for
you're saying G plus WX so G stands for group right so as you can see from uh
group right so as you can see from uh this particular slide G stands for group
this particular slide G stands for group U stands for users and others stands for
U stands for users and others stands for O okay and all stands for A okay so as
O okay and all stands for A okay so as for this if you're using G over here
for this if you're using G over here then it means that you're talking about
then it means that you're talking about the group and you're adding the W that
the group and you're adding the W that is a write and the execute permissions
is a write and the execute permissions you know that means you're giving them
you know that means you're giving them the W and the right and the execute
the W and the right and the execute permissions okay and after you got to
permissions okay and after you got to specify the file name. So this means it
specify the file name. So this means it will modify the permissions to this for
will modify the permissions to this for this particular file and similarly you
this particular file and similarly you can use the equal to symbol and also the
can use the equal to symbol and also the minus symbol. So when you use the equal
minus symbol. So when you use the equal to symbol then whatever rights you have
to symbol then whatever rights you have initially that will be overwritten. So
initially that will be overwritten. So when you say chod u is equal to rwx and
when you say chod u is equal to rwx and then uh it doesn't matter what the
then uh it doesn't matter what the previous set of permissions were then
previous set of permissions were then the the previous set of permissions will
the the previous set of permissions will be replaced by whatever you specify
be replaced by whatever you specify here. So you'll be setting that
here. So you'll be setting that particular user to have the read write
particular user to have the read write and execute access for that file. Okay.
and execute access for that file. Okay. And then um you can in fact specify uh
And then um you can in fact specify uh you know uh you can set access control
you know uh you can set access control for multiple people. You can set it for
for multiple people. You can set it for uh groups users all at the same time. So
uh groups users all at the same time. So in this place this command we've set it
in this place this command we've set it for the users. Here we are setting it
for the users. Here we are setting it read, write and execute for users. And
read, write and execute for users. And then after that we are setting it for
then after that we are setting it for the other people. Okay for the other
the other people. Okay for the other users we are removing the write and the
users we are removing the write and the execute access. Okay the execute
execute access. Okay the execute permissions. So let me just quickly go
permissions. So let me just quickly go to my uh terminal and show you that. So
to my uh terminal and show you that. So currently uh let's take the example of
currently uh let's take the example of this pictures okay let's take an example
this pictures okay let's take an example of this particular folder the user that
of this particular folder the user that is me I have the read write and execute
is me I have the read write and execute permissions the group has read and
permissions the group has read and execute only okay and uh they of course
execute only okay and uh they of course the other users they also have only the
the other users they also have only the read and execute now what I'm going to
read and execute now what I'm going to do is I'm going to say chmod uh I don't
do is I'm going to say chmod uh I don't want to change my permissions okay so I
want to change my permissions okay so I would rather uh change the permissions
would rather uh change the permissions that my group has so I would say G is
that my group has so I would say G is equal to read and W. Okay. So if you see
equal to read and W. Okay. So if you see here right now the group has read and
here right now the group has read and execute. Okay. I don't want to give them
execute. Okay. I don't want to give them execute. So if I want to remove execute
execute. So if I want to remove execute I have to do G minus R and then I have
I have to do G minus R and then I have to give comma G + W. Okay. But uh those
to give comma G + W. Okay. But uh those are two different arguments right? So
are two different arguments right? So instead of using two different arguments
instead of using two different arguments I can just give an equal to which would
I can just give an equal to which would replace this entire list with the uh
replace this entire list with the uh current arguments. So instead of having
current arguments. So instead of having R and X I will replace that with R and
R and X I will replace that with R and W. read and write. Okay, I'll give a
W. read and write. Okay, I'll give a command and then we have others here.
command and then we have others here. The other users they have read and
The other users they have read and execute again. So what I'll do is I'll
execute again. So what I'll do is I'll uh say O minus execute because I want to
uh say O minus execute because I want to give others only the read access. Okay,
give others only the read access. Okay, so in this case when I do this the X
so in this case when I do this the X over here that will become hyphen and
over here that will become hyphen and the hyphen here will become W. Okay,
the hyphen here will become W. Okay, I'll be enabling the W for them and
I'll be enabling the W for them and removing the execute and for these
removing the execute and for these people I'll be removing the execute. And
people I'll be removing the execute. And now that I've specified what are the
now that I've specified what are the permissions and who are the recipients,
permissions and who are the recipients, I'm going to give the file name. So
I'm going to give the file name. So let's say pictures. Okay. So I'm going
let's say pictures. Okay. So I'm going to give the ls minusl command again. And
to give the ls minusl command again. And now you can see that if you go to
now you can see that if you go to pictures, it's been reset. So the others
pictures, it's been reset. So the others have only the read access. The others
have only the read access. The others are blank. Okay. And the uh group have
are blank. Okay. And the uh group have the read and write access and this
the read and write access and this execute has been taken away from them.
execute has been taken away from them. So that is with respect to the read,
So that is with respect to the read, write and execute permissions that users
write and execute permissions that users can have. All right. So I'm just going
can have. All right. So I'm just going to clear the screen and go back to my
to clear the screen and go back to my slides. So similarly you can change even
slides. So similarly you can change even the ownership of certain files and uh
the ownership of certain files and uh certain groups. Okay. So u if you use a
certain groups. Okay. So u if you use a ch own, okay, change ownership with
ch own, okay, change ownership with that's what it stands for. And when I
that's what it stands for. And when I follow that with the username and the
follow that with the username and the file name then this particular file will
file name then this particular file will have a new user or will have a new owner
have a new user or will have a new owner and uh this will be the username. Okay.
and uh this will be the username. Okay. And similarly even the group command
And similarly even the group command works in the same fashion. So uh this is
works in the same fashion. So uh this is something that you can always uh work on
something that you can always uh work on and you can figure it out. All right
and you can figure it out. All right guys, so that brings us to the end of
guys, so that brings us to the end of the third part of our demonstration.
the third part of our demonstration. Okay. So we still have a couple of more
Okay. So we still have a couple of more topics left but unfortunately I don't
topics left but unfortunately I don't think we'll be able to cover it today
think we'll be able to cover it today because we've already exceeded the time
because we've already exceeded the time limit. So what we'll do is we'll
limit. So what we'll do is we'll continue the remaining topics in
continue the remaining topics in tomorrow's session. Okay. So in
tomorrow's session. Okay. So in tomorrow's session we'll talk about uh
tomorrow's session we'll talk about uh Linux repositories uh tar files
Linux repositories uh tar files environment variables regular
environment variables regular expressions processes adding users and
expressions processes adding users and networking. Okay. When I say networking
networking. Okay. When I say networking it's about SSH. So these will be the
it's about SSH. So these will be the topics that I will be covering in
topics that I will be covering in tomorrow's session. Okay. So guys on
tomorrow's session. Okay. So guys on that note let me conclude today's
that note let me conclude today's session. All right. And uh I'll meet you
session. All right. And uh I'll meet you all tomorrow same time. All right guys.
all tomorrow same time. All right guys. Okay. Great. I'll see you tomorrow.
Okay. Great. I'll see you tomorrow. Okay, good night folks. See you all.
Okay, good night folks. See you all. I hope you enjoyed listening to this
I hope you enjoyed listening to this video. Please be kind enough to like it
video. Please be kind enough to like it and you can comment any of your doubts
and you can comment any of your doubts and queries and we will reply to them at
and queries and we will reply to them at the earliest. Do look out for more
the earliest. Do look out for more videos in our playlist and subscribe to
videos in our playlist and subscribe to our channel to learn more. Happy
our channel to learn more. Happy learning.
Click on any text or timestamp to jump to that moment in the video
Share:
Most transcripts ready in under 5 seconds
One-Click Copy125+ LanguagesSearch ContentJump to Timestamps
Paste YouTube URL
Enter any YouTube video link to get the full transcript
Transcript Extraction Form
Most transcripts ready in under 5 seconds
Get Our Chrome Extension
Get transcripts instantly without leaving YouTube. Install our Chrome extension for one-click access to any video's transcript directly on the watch page.