All language subtitles for Linux Full Course - 10 Hours [2025] Linux Tutorial For Beginners Linux Training Edureka Live [English (auto-generated)] [DownloadYoutubeSubtitles.com]

af Afrikaans
ak Akan
sq Albanian
am Amharic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranรฎ)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu

Original subtitles

Hello everyone and welcome to the Linux

full course. In this course, you will

start with the fundamentals of Linux

exploring the different shells and

learning how to set up Linux using

virtual box. We will then move into

hands-on commands on Ubuntu and

understand how Linux is used in DevOps

workflows. We will cover the Linux file

system, package management, and even

dive into administration tasks like

configuring a DNS server. You will also

learn shell scripting and discover tools

like shell GPT to enhance productivity.

So before wrapping up, we will cover

Linux interview question and answers to

help you prepare for real world

opportunities. So before we begin,

please like, share and subscribe to

Edureka's YouTube channel and hit the

bell icon to stay updated on the latest

content from Edureka. Also do check out

Edureka's DevOps certification training

course with Genai designed to equip

learners with the skills to master AI

integrated DevOps across the entire

software delivery life cycle. And

through hands-on learning, you will gain

expertise in building intelligent,

automated, and secure CI/CD pipelines.

This comprehensive course covers

essential tools like Git, Genkins,

Terraform, Enible, Docker, Kubernetes

and monitoring frameworks while also

integrating AIdriven solutions for code

generation, testing and analytics. So do

check out the course link given in the

description box below. And now let us

get started with our first topic that is

fundamentals of Linux.

>> 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 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 uh 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 uh it was their effort which

contributed to the growth of Unix but

however they are not getting any

benefits of you know Unix because AD&T

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 you know Unix

from AT&T and uh you know having two

different versions of Unix. One was a

free BSD 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 POSX 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 Solaris'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 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 Lenn Star Tarz who was still back

in college at that time he put the Linux

kernel source code online so he was

trying to use the postix 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 Fedora 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, OpenS 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 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 Linux Mint is the other

distribution which can be used for

playing movies and listening to music

because this gives you more of a windows

like interface. So that's what Linux

Mint is. So we have various

distributions like this. 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 uh the RE 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 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 Linux

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.

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. 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. 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,

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 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

favorite tool, right? Linux. So that's

because Linux is 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 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 700s 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 Federra 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.

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 in Windows if you people 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 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

cents. 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've instantiated my uh

Linux virtual machine. Okay. So my Linux

distribution here is 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 wait for some time.

Okay. So let me just enter the password

for the user.

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 want

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 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 uh 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 slasher. 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 edurea 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 on 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

softwares 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 L provides a CLA 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 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 CLA 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/reka.

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 dsk

t o p. 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. 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 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 right

dot. So if you have 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

uh 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 the cd

command is you can give cd to move to

any directory okay so I have a question

here from uh shashiant 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. Okay. Now if I

click on desktop and if I click on LMS

and then you have another folder here.

Okay. You have hedge base. 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 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

hedgebas 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

reduce 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 and if I click on

tab then uh it kind of autofills the

directory. Okay. But in case let's take

the example of h 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 autofill length. 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 uh

directory, I'm just going to say HB.

Okay. Now inside HBase, I wanted to go

to one of the directories in here. So

let's say we go to advanced Hedgebase

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

CD. 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 uh I showed you the

clear. Okay. So, the echo and the pseudo

commands are 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 uh 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 CLI. So in your

terminal whatever output you get so

you'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

vdan. 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 uh 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 you were 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 u 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 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 will 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 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 use super user

permissions can be used to execute

commands all right and then you have su

username 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 If you guys remember then

I logged into CentOS with the Edka user

right so that is uh 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 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

uh 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 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. 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 uh

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 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 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

executed 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 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 uh 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 uh 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 pseudo 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 pwd 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 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'll 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 uh 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 was 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

reduce 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 uh 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

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 uh

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 so 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 isa

here and what isa 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

list down all the contents in that

directory along with its owner. Correct?

So let's try executing lsy

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 u if 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- l then

it was in a different order. But uh

since I ran ls - 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

ls- 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/ edurea

directory. Okay, I'm going to uh

basically run the same l. So basically

the 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.

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

name needs to be specified over here.

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 lists 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 - las 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 file and we

stored this file in the home/ora

directory. Okay. 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 uh command okay then a new

file will be created with uh the name

file 1.xe 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 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

pseudo 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 a 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 subdirectories. So that's

what they are. So this will change you

to the root directory and then you have

the uh cd-en 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'll 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

document which has a space in the

middle. So in that kind of situation you

can use a single quotation mark or

double quotation mark. Okay. So it's uh

you know you also have the comfort to

switch to double quotation mark. So I'll

execute all these things and show you.

Okay. So first I'll show you the uh the

CD till day then with the forward slash

then with the dot mark this of course I

showed you earlier also and then I'll

show you how to switch to another folder

with you know which is having two

different names with a space in the

middle. So going back to my uh root. So

um right now we are inside the uh home

directory itself. So if I give uh cd -

desktop okay now in here we have my

other directories and if I do cd and lms

I'm inside the lms directory okay now

from here if I give cd and if I give use

the till day option right then it will

switch me to the uh root directory uh so

see this was the till day symbol earlier

okay so this till day symbol represents

root and since I uh said change

directory to t symbol this which implies

root it basically uh decodes it as

change directory to the root directory.

So when I did that I have automatically

switched to root directory while earlier

it was lms. So uh similarly if you're in

the uh lms directory and if you also

just press cd right if you just give

this command even this will switch you

to the root directory. So basically uh

cd and cd space till day they are uh

both the same. But uh however if you

give cd with forward slash then it will

uh switch you to the root directory. So

when I give enter as you can see I'm in

the root directory. So if I give ls over

here I have a list of other directories

which I showed you earlier. So in in

your file system right? So yeah so

inside your file system if you open this

folder then you have the root directory.

So inside this directory you have home

and network and this is where desktop

and documents are all present as a

subdirectory of this parent directory.

Okay. So this is the root directory

where everything is stored. So any

document or any folder in your Linux

operating system they can be referred or

they can be accessed from this root

directory. Okay. Now going back to the

terminal let me show you an example of

that. I've already moved to the uh root

directory. Now let me say cd bin and uh

okay we have this. So now when I uh gave

cd space bin then it moved me to the bin

folder inside my root directory. So uh I

ran the root directory added an ls which

listed down the list of uh folders

inside my root directory. These were the

options uh bin boot dev. These are all

the different folders. And when I said

change directory to bin, it uh shifted

me or it moved me to this particular

folder. Okay, inside the uh root

directory. So right now I am in the bin

directory. And inside the bin directory,

I ran the ls command which basically uh

means listing down all the uh contents

whether it's documents or whether it's

uh folders or directories all those will

be listed down. Okay, so these are the

list of all those uh contents in the uh

bin directory. Okay, now that we are in

bin, let me go back to my root directory

by giving double dot. Okay, so from bin

it again I go back to my uh uh root

directory. Okay, so this uh for/

represents root directory like I told

you earlier and if I do ls then I'm back

to this directory where we have bin boot

dev and etc home and all these things.

So now what I'm going to do is uh so now

that I'm in the root directory now let

me say change directory to home and

inside home there is EDA I want to go to

EDA inside Eureka let's go to desktop

and then there is LMS okay and uh in

here if I do ls then these are the list

of uh folders here okay now I'm going to

change directory to hbase and if I do an

ls over here then you can see that there

is one particular folder called advanced

hbase practicals module 9. Okay, if I

now just say cd and if I put adv space

hb then I will not be able to autofill

the option. Okay, that's because uh the

terminal or the CLI is not able to

recognize this particular uh command

because there's a space over here. Okay,

so it treats ADV as a separate folder.

But since it's not able to find any

folder here as ADV, that is the uh

problem. Okay, let me show you via the

GUI what it looks like. So we are in the

desktop and inside LMS we have

hedgebase. Inside HedgeBase we have

advanced hedgebased practical. So this

was what I was talking about this

particular folder. Correct. So let me

minimize this for you. Okay. Now this is

a classic situation of when you need to

use double quotation mark or single

quotation mark. Okay. Now if I just uh

put the same name uh like say ADV and uh

HB then it kind of autofills

automatically right.

So even the quotation mark ends over

here. So that indicates that this is

another folder that's present. So if I

uh you know just put enter then it will

change my directory to this particular

folder. So that is what the uh quotation

mark does. So when I do enter then I'm

inside this folder. When I do ls I have

the list of folders and directories

inside this advanced hbase practicals

folder. All right, guys. So, I'm just

going to do a CD to my home directory.

And I'm here. And that was about the

different uh CD commands that are

available which I wanted to show you.

Okay. So, let me just go back to my

slides now and go to the next slide. I

showed you all the uh different commands

here. Okay. So, the next set of commands

that I'm going to talk about are those

of cat, GP, sort, and pipe commands.

Okay. So uh let's first go to the next

slide and start off with cat command.

Okay. So when would we use the cat

command guys? So it's pretty obvious

right from what it's written here. It

says when you're working with files that

time you can use the cat command. So uh

the cat command it is basically used to

display the content of the text files

and concatenate several files into one.

So uh what this means is if I have a

particular uh you know I have a text

file. So earlier we created one text

file having all the file permissions

right. So if I have that kind of text

file and if I want to uh display the

content of that text file then I can use

the cat command. I can say cat and if I

give the file name then that content

will be displayed. So when I use only

the cat command with one file name it's

very similar to how the vi command works

or how the nano command works. Right? So

it will display the content in the

terminal itself.

Correct. But the difference with cat

command is that with cat I can list down

the contents of multiple files. So it's

not just one. Okay. I can have I can

even display I can specify three

different file names. And if I put enter

then the content of all the three files

will be displayed in my terminal. The

same thing won't happen with vi. So if I

say vi then only that particular files

content will be displayed. So same thing

with nano right. So uh let me just go to

the terminal and show you an example of

the cat command. So right now we are in

the cd directory. Let me just maximize

this. Okay want to clear the screen.

Present working directory is uh the

home/rea directory. This is the uh home

directory. And from here let me go to uh

documents. Okay. If I do an ls there is

this file one.xe which I created

earlier. Correct. So this was where the

different file permissions were present.

Right. So if I do cat-y file name and if

I give enter then I get the list of the

contents of that particular file. So in

that file there are only these three

rows because this was the latest updated

permissions that I specified in the file

1.xt. Okay. So guys I earlier told you

that you can enter uh details to a file

by using the direction command. Right?

So that was the greater than symbol. So

I'm going to use that kind of a symbol

over here and I'll create a new file by

adding details by using that command.

Okay. So, initially it was I used the ls

minus l. But this time I'll use the cat

command itself and uh say I'm going to

give the direction symbol here and when

I'm done with that let me give the name

of the new file. Let's say file 2.txt.

Now when I hit enter the command is not

executed completely. Okay. So I'm inside

this place where I can enter the text.

So it's basically going to create a new

file. Okay. Now whatever text I enter

here that will be stored inside this

file. So uh let's say hi

my name is uh Vardan and if I give enter

I can go to the next line and uh here

let's say

welcome to

Linux

tutorial by

Edurea.

Okay now if I want to uh you know just

add these two lines to this particular

uh file called filecore.txt txt then I

can press Ctrl D now. Okay, by pressing

Ctrl D I come back to my uh command

line. So what this command basically

does is this CAT command would have uh

created a new file file.xt and the uh

text that we entered below it right uh

this will be entered inside this text.

So if I do cat file 2 txt then whatever

I typed earlier that got saved in this

file. Now similarly if you see the uh

file 1.txt

the contents are these. Okay. So this is

the contents of this one and this is the

content of uh this file. Now I told you

that with the help of cat command you

can uh display the content of two

different files. So let me show you that

option. Okay. I'm going to say file 1.xt

and then I'm going to say file 2.xt. So

in this way I'm going to basically

display two files cat. I want to display

file one and file two. When I go enter,

first the file two contents will be

displayed and then the file two contents

or the lines in file 2.txt will be

displayed. Right? So first these were

the permissions that were there in the

first file and then uh this was what was

there in the second file. All right

guys, now uh this brings us to another

important concept of how to append

files. So cat basically stands for

concatenate, right? So that's the most

important option. So if you want to

concatenate a particular file with you

know some kind of lines then I showed

you how that is done by creating a new

file what I did was I I created a new

file file 2.xt and I concatenated these

lines into this particular file. So if I

just give cat and uh if I give file one

dot txt and if I give uh double marks

okay so double direction marks which is

uh nothing but the greater than symbol

okay we also call it direction marks. So

if you uh give file 1.txt and followed

by this if you give file 2.txt

then what's going to happen is whatever

contents are there in file one those

will get appended or concatenated to

this file 2.txt.

Okay. So in my file 2.txt we have these

two lines. Okay. Hi my name is Van and

welcome to Linux by Eda. And file one

has uh these three lines. So basically

when I uh enter now there will be uh a

file two in which there will be extra

lines. Okay. So let me uh do a cat file

2.txt. So as you can see initially when

I ran my uh cat file2 txt over here I

had only these two lines right but now

after using the birectional uh symbol

okay the direction symbol what has

happened is I have three extra lines. So

it says hi my name is van welcome to

Linux tutorial bya. After that I have

the permissions which was present in the

previous uh file. Okay. So uh that's

what happens here. Okay. In fact it's

actually four other lines. Thanks for

pointing that out. So Hmon you know

who's another person in our session. He

said that there are four lines in the

fire. Actually he's correct. So total

eight. So this is the first line and

these are the other three lines. So you

can also see that from uh here. Okay. So

the first time when I ran cat file

one.txe, txt right I first got total 8

this was the first line and after that I

got the permissions okay so this is the

first line and then you have the list of

the other contents so when we ran the ls

minus l the total number of entries were

right so that was what uh the total

eight stands for so these are the four

lines that got appended to my file 2 txt

okay but however there wouldn't be any

changes to my file 1 txt because I

didn't make any changes there so let me

anyway show you that also uh if you see

here again the contents here are the

same it's only that the file 2 has got

these four lines extra. So that is what

the direction symbol does. So these are

the uh advantages with the uh cat

command. All right. So u what I'm going

to do now is uh let me go back to my

slides and show you some more options.

Okay. So we have flags like we have the

B flag, the N flag, S flag and E flag.

Let's see what each of those stand for.

Okay. So when we use the B flag, it's

going to add line numbers to the

non-blank lines. Okay. So whichever line

there is some text. So those lines are

going to be numbered. Okay? And when you

say minus n then it is used to add line

numbers to all lines. It doesn't matter

if it's blank lines or non-blank lines.

It's just going to add numbers

everywhere line numbers. Okay. And when

you give the s flag, it is basically to

squeeze all the blank lines. Supposing

you have three blank lines one after the

other then it will squeeze all those

blank lines and it will reduce it. Okay.

So that's what the S does. And then the

e flag is going to uh show you a dollar

at the end of each line. So let me go

back to my terminal and show you this uh

option. So first of all let's see the

cat file 2.xt and uh let me use the uh

flag minus n. So this will list the

number of lines right. So there are

basically four lines from file one and

these were the two lines that were ear

present. So these are the six lines in

total we have in this file 2.txt. Okay.

Let me just clear the screen because uh

it's a little uh tough to see

everything, right? So yeah, so when I

ran the minus n command, the file 2.txt,

the lines in there were numbered. Okay,

1 to six. Uh and then we have another uh

flag called minus b flag, right? Minus b

flag will add numbers to also the uh

non-blank lines. So but for that we need

to first have blank lines over here. So

what we'll do is uh I'm going to do a

cat and u do this and file 2.txt. So

when I do this, I'll be adding uh lines

to this file 2.xt. Okay, I'll be

appending lines over here. So let me

just give one blank line. Enter some

random text and then enter, you know,

blank line and then random text. Okay,

so this is what I'm going to just enter

or append to my file totxt. Okay, you

press Ctrl D to exit this. And now these

would have been saved to my file 22.

TXT. So let me just run the same command

again. Oh, sorry. I should have ran this

cat file 2.txt. Okay, when I do this, as

you can see, uh it starts from here and

these were the other lines that were

appended. Okay, and now if I use the cat

hyphen B flag, okay, see what happens.

Only the non-blank lines are uh

numbered, right? So these lines are not

numbered. But if I use the minus N which

I used earlier, what it would do is it

will number each and every line. So

that's the difference between minusb and

the minus n flag. Okay. So n numbers all

the lines irrespective of it being empty

or not. But whereas minusb numbers only

lines which are non-blank. Okay. So that

is uh this one. And there is another

flag which is the uh hyphen s flag.

Okay. So it's not capital s it is small

s. Right. So when I say minus s then you

get the list of the documents. So as you

can see here all the u spaces are

squeezed into one. Uh seems like there

were no multiple spaces right no

multiple blank lines. So what we'll do

is let's edit the file 2.txt again. Okay

or in fact let me open it via the uh

editor vi editor. Okay. So when I do

this these are the uh existing ones.

So when you uh press insert or when you

press I button or insert button, you can

start entering text details inside this

file. Okay. Now u right now I'm here.

Let me add multiple blank lines here.

Okay.

So as you can see there are around three

blank lines here. 1 2 3 4. There are

four blank lines. And here there are

three blank lines. Okay. Now uh let me

press escape. Okay. Now if I give

escape. Okay. So now we are in insert

mode. So what I do is uh I'm going to

press escape and then followed by that

if you give colon and wq this would uh

save this file. Okay. So I've made

changes right? I've added lines here. So

it would save that changes and it would

quit the vi editor mode. So if I give

enter so I'm outside that file. So now

if you see the uh cat file 2.xt

then it has additional lines right? So

uh now I'm going to run the command that

I ran earlier. Cat hyphen flag s and

then file name. So when I do this all

the u multiple blank lines are squeezed

into one. So as you can see here there

there have been multiple lines here when

I ran the file 2.xt. But here when I ran

the cat hyphen with the yes flag then

there are all these multiple black

things are squeezed into one. Okay. So

that is uh the option with the cat

command. Okay. So I think with that I

think I've covered all the different

option. Okay, there is one left. There

is uh the minus E option right. So okay

now let me show you what that does. So

when we use the capital E flag okay

there is a dollar sign that is appended

after every line. So uh the first line

is total eight or let's say the first

line is this one. So there's a dollar

sign here and after this line there's a

dollar sign. After this there's a dollar

sign. And since these are blank lines

you'll only find the dollar sign here.

And again after this one you have a

dollar sign and uh you know blank lines

have dollar signs and yeah so that's how

the uh e flag works. Okay. So every the

end of the line is uh appended with the

dollar symbol. Okay. So with this I'm

done with all the uh cat commands. So

going back to my slides now. Let's go to

the uh next command that is grip. Okay.

So uh grip command working with grip

command. So what does the grip command

do? you guys have any idea? Okay. Well,

I don't expect you people to but uh

yeah. So, if people if any of you know

if you have an introduction to Linux,

then you can answer it. But it's fine if

you don't because I'm going to explain

that. It's my duty. And the grip command

is basically used to search for a

particular string or a word in a text

file. Right? We have a file document

like the one which we created. Now, like

we we have two documents like file 1.xt

and file 2.xt. And what if you want to

search for a particular string, right?

Or a particular uh word. So in this case

it's pretty simple because you can

easily find them. But what if you want

to do it to uh you know a very big pile

document which has like millions of

lines right? So supposing you have any

document then you'll have multiple lines

right and if you want to find one

particular word or if you want to go to

one particular string then how will you

do it? So in Windows you have the

control F option right but via a CLI you

can't use it right so via CLI you use

the uh grip command okay and the format

for executing the command is this so you

specify gp and then you specify the

string that you want to search for so

options is the string that I have

searched in this command and then the

file name okay and it will return the

result of the matching string options so

similarly if you use the i flag then it

will uh return the results for even case

insensitive strings So basically if you

do not use the I flag then it is uh it's

case sensitive right so it'll only

search for options with these letters

but if there is a word called options

with a capital O where the first letter

is capitalized then uh in that case only

when you use I will even that particular

result be uh shown okay so that is the

advantage with the I flag and then you

have the N flag which is the GP hyphen N

which will again returns the matching

strings along with their line number in

which line was that or that word found.

So that's what n does and when you give

minus v flag then what happens is uh you

will not be shown the list of lines

where the results were present but

instead you will be shown the list of

lines where the results were not found

where there was no matching string right

so those lines will be printed with the

help of v flag and then with the c flag

it returns the number of lines in which

the uh results matched the search string

so supposing you have like four words

okay you have a big document and uh your

word your string matched four times then

uh if you use the minus C flag then it

will display the number four instead of

displaying the search string. Okay, so

let me go to the uh VM let me go to my

CentOS and uh show you how to execute

these commands. Okay, so right now we

are in the documents folder. If I want

to execute uh that then we need to edit

this in a different way. Okay, we need

to have a different text and this

directory has uh these documents right?

So let me just quickly go to the uh

documents folder and here if I do an ls

we have the two files which we created.

We have file 2.txt and file 1.xt.

So what I'm going to do is uh I'm going

to see what's there in file 1.xt.

Okay. So let me edit this file. Okay. Or

let's say let's just create a new file.

What do you say? We can create a new

file by uh doing this right by uh giving

the direction symbol followed by the uh

name of the file. Let's say automobiles.

Automobiles.

This is the name of my uh file

automobiles.txt.

And I can start listing down the

automobiles that I want. So let's say

car or let's say

motorbikes. Okay, we can say train.

Well, train is technically not a

automobile but uh still or let's uh go

into details of the companies. Okay,

let's say Maruti, let's say Ferrari,

Lamborghini. These are some of the most

famous uh companies, right?

So, when it comes to bikes, you have

Bamaha, then you have uh Honda, right?

You have Suzuki,

you have

Acillia and uh to name a few more. We

can add some more companies like BMW, we

can add Audi, we can add

Foxwen to this list. Okay. Now, if I do

control D, then uh this will be the list

of content in my automobiles.xt. Okay.

Let me I'm going to clear the screen

now. And if I

do cat command here, then it displays a

list of contents here. Right? Okay. Now,

let's use the grip command to search the

content that is uh present in this uh

text. So u I'm going to do a grip and uh

the string that I want to search for is

uh let's say y because in Lamborghini we

have the search string y am and even in

yamaha we have uh the am right we are

supposed to get two results for this. So

in this case so if I uh just say gp yam

and if I specify the file name

automobiles.txt txt and if I give enter

then I get the two different words right

the two uh names where this was present

where am was present okay now if I use

the same thing with the uh i flag

then it will display the list of files

in a case insensitive fashion but in my

file there's no uppercase file I'm going

to say see automobile txt I'm going to

append

I'm going to append this word called

amber. Okay. So, Amber is another uh

automobile company. And when I do this

and if I run the cat command now, okay,

you will see that along with uh these

names which were there initially, there

is amber has been appended. Okay. And

this time when I search for y, right?

So, it should not show me this because

even though there is am here, uh the a

is capital here, but I'm searching for

small am. So, it should not show me this

result. Okay? I should get the same

result that I got previously. So if I uh

do a grip am like earlier I got the

Lamborghini and Yamaha as the only

options. Okay. But now if I uh append

this with minus I or the I flag. So what

happens is I'll get the option of even

amber along with this because it would

search for the string in a case

insensitive fashion. Okay. So this time

as you can see amber is uh added to this

list because uh it did not consider case

insensitive words letters. Okay. So that

is about the i flag and uh there is

another n flag right. So let's see what

the n flag does. So every time you use

the uh minus n flag then it'll list down

the line in which the word was present.

So that's what I mentioned earlier. So

over here in line number six and line

number seven we have lamborghini and

yamaha. Right? So the line number is

mentioned. Okay. Now u so that's what

the n flag does. Okay. So we have the v

flag and the c flag left. So let's

execute them and uh see what happens. So

when I remove n and when I execute v as

you can see all the uh results except

for yamaha and for lamborghini would be

present here. Okay. But if I give minus

IV okay which indicates IV flag then

even amber would not be present in the

output I will get now okay when I give

enter as you can see amber is not

present because uh amber is part of the

case insensitive option right when we

included I this should be chosen as the

search result and since it's considered

as a search result we will display only

the result uh the set of results which

were not found so the other lines which

text was not found were these and that's

why we got these options okay Now we

have one more flag which we need to see

and that is the C flag. And when you

enter the uh C flag then it displays the

list of uh the number of times that

string was found. So AM was found two

times in once in Lamogi and once in

Yamaha. So that's why we got the answer

as two. Now if I use C with the

combination of I all right I'm going to

get three. That's because even amber

will be considered in this case. Okay

guys. So uh this is uh what is uh there

with respect to the grip command. I

spoke about the uh grip command. Okay.

And now in the next slide let me talk

about the sort command. Okay. And so we

use a sort command to sort the results

of a search either alphabetically or

numerically. All right. And uh we can

sort either files or file contents or

directories. So what this means is

whatever results you get right or uh I

mean not just results or even if uh it's

the list of items that is present in a

particular directory even when you run

an ls command right you'll have a list

of files and the list of folders that

are there in that particular directory

so we can sort even those things okay

now that result can be sorted and uh

also we can sort anything else we can

sort the contents of a file right we can

sort the contents of the file or uh you

know all these things so that's what

this means So without wasting much time,

let me just uh show you how that is

done. So you can give sort and the file

that you want to uh search.

Alternatively, you can also search two

files at the same time by giving uh file

1.txt and file 2.txt. Okay. So and the

and the syntax for that is uh sort and

the file name. Okay. When you say sort

on the file name, then the contents of

this file will be returned in the

alphabetical order. Okay. If you want to

sort two files at the same time, then

you can uh in arguments you can just

give both the file names and it will

sort the contents for both file one.txt

and file 2.txt. Okay. And again if you

want to uh display them in the reverse

order, then you can specify the R flag.

And uh for case insensitive sorting, you

can do the hyphen F flag. And then if

you want to sort the results based on

the number in a numerical order, then

you can use the N flag. Okay guys, so uh

let me first of all go to my terminal

and start executing them. Okay, so what

I'm going to do is I'm going to clear my

screen and currently let me just list on

the contents of this directory. So we

have automobiles uh file, we have file

one and we have file two when I just

give a sort and press enter. Then I

enter the interactive mode. Okay, so

here I can uh type all this. I can type

random words.

Okay, I can say U A B C D or I can say B

C D A or I can say E F E D FG all these

things. Okay. And then when I press Ctrl

D, it gets me out of the interactive

mode. And when I exit the interactive

mode, the text that I typed in, right,

the input that has been sorted. So this

up till this line was what I entered as

input if you remember and uh up till

EDFG, right? So basically this text has

been ordered as per alphabetical order

and since a comes first in alphabetical

chronology this is first the BCDA is

second and then you have the other lines

okay uh these have been sorted in an

alphabetical order now if I give sort

with the file name okay that is uh

automobiles.exe exe and if I give enter

then this particular uh file will be

ordered in the alphabetical order. Okay,

the contents will be uh listed down in

an alphabetical order. Uh let me clear

the screen and show that again. So let

me first just do a cat and show you how

the order is. Okay, now let me run the

sort

with the file name. Okay, so now if you

see it was in this order initially,

right? So car was the first option,

motorbike was the second, train was the

next, Maruti and then came Ferrari and

Lamborghini. But if you look at the

sorted uh result then it's in a sorted

manner right so first comes Amber then

comes Aprilia then comes Audi and then

the others so that's what sorting does

okay and the same thing can be done for

two different files at the same time. So

this was the automobiles .txt. Supposing

I want to list down even my file 2

contents. Then I can just type file

2.txt here and the results of both the

files will be in my uh terminal. Okay.

But before that let me just uh clear the

screen so that it'll be easier for you

to view the results. Okay. So now that

I've cleared the screen, let me uh sort

these two files. Okay. So let's the

command is sort and this is what I had

previously and let me add file two to

it. Okay, file 2.txt. Now what this

would do is the results of both these

files right automobiles and file two the

results of those would be sorted in the

alphabetical manner. Okay, now if I give

an enter as you can see here first

initially you have blank space. Okay,

now that is because blanks are ahead of

the capital A, right? This is the

alphabetical order. Correct. So first

comes blank space then comes u white

space and then comes the characters. So

once we are done with those things then

we have amber Aprilia Audi this was the

order in which the files were listed in

the automobiles and right after C D

comes okay now this line is part of the

file one while these were part of

automobiles. This was part of file

2.txt. So yeah these results were a part

of the automobiles txt file. The blank

lines here these were part of the file

2.txt and u again these two lines right

these were part of file 2.txt txt. Okay,

so this is what happens when you give

two files as arguments. Now, uh there

are other options that I want to show

you though. So there were flags like R

flag, right? So R flag lists the uh

results in the reverse order. Okay, I'm

just going to clear the screen and yeah,

for clearing the screen, the shortcut is

Ctrl L. All right, guys. So um let's say

sort automobiles.txt.

Okay, it's cat, right? Right? I don't

want to do cat. I want to do sort

automobiles. txt and I want to use the

flag minus r. So when you use minus r,

it will display the result in the

reverse order. So we have the reverse

order in which yamaha comes first and

amber comes last. So that is the reverse

order. And we have another flag here.

The other flag is the f flag which will

return the results in uh the case

insensitive uh fashion. Okay. So that is

the uh minus f and then if you go back

to the slides there is uh n option right

so n will return the results in the

numerical order. Now let me go to my uh

terminal and let me use the n flag now.

But of course I don't think it will sort

anything because there are no numericals

here. So what I'm going to do is I'm

going to u use the file 2.txt here.

Okay. File2.txt.

Okay. So there are no numericals here

either. What I can do is I can edit

these details. So let me go vi and uh

say file

2.xt and I'm going to enter the insert

mode. I'm going to remove all these

unwanted lines. Okay. So I've removed

all the blank lines. Now I'm going to

put one here. I'm going to put two here.

I'm going to add three to this line. I'm

going to add four to this line. Okay.

All right guys. Or let's say let's give

the order seven here. Okay. You have two

here. Okay. So there are some kind of uh

numericals ahead of uh you know before

every line starts. Right. So when we run

the minus n command now the sort command

with the n flag now then it would sort

these lines with respect to the lines

with the numerical order. Okay. So first

this line would be uh shown the blank

line. Okay. Then you would be shown the

uh uh you know the total line. Then you

would be shown the third line and like

that. So let me just uh escape colon and

save and quit. Okay. Now let me uh run

that same sort command. Sort-en file

2.txt.

So as you can see the uh alphabets are

first sorted. Okay. So the lines where

there are text characters or

alphabetical letters so those are

displayed and after that the lines that

are formatted after that are in

numerological fashion. Okay. So if I

don't give the n it would be a different

fashion altogether. So earlier the file

was just displayed in the regular

numerological order. Okay. So where 1 2

3 4 5 the numbers came first and then

came the text. But since we ran the

hyphen n the alphabetical letters or the

characters came first. Okay, after that

it was sorted by uh numerical letters.

So that's what the n flag does and and

that brings us to the end of the sort

commands. Okay,

so uh after the sort command, the next

one that we have in line is that of pipe

command. Okay, so this is referred to as

the pipe. So you'll find this in your uh

in your keyboards right above the enter

button. Okay, uh where you have the

backward slash. So in that button if you

press uh shift and if you press that

button you'll get this pipe command and

what the pipe command helps you does is

it uh lets you perform two operations in

the same command like it'll uh let me

search let's take the example that's

specified here okay we using the gp to

search for a particular string from a

file and uh we are using that and then

we are sorting that result okay now

since there are two operations involved

okay one is the sort and one is the uh

search since there are two operations

involved in the same command we separate

the two operations with the help of the

pipe command. So that's what uh this is

and uh as the definition says the pipe

command is used to output the result of

one command as input to another command.

Okay, the same thing can be said over

here also. So we'll first search the

file for a particular string and

whatever result you get that will be

given as input to the sort command over

here. Right? So this uh saves us time in

not having to mention the uh file name

after sort again. So we'll just be

performing one GP search and then we'll

just whatever result comes that result

will go to the operation that's

performed over here. Right? So um let me

just go to the terminal and show you an

example of this. I'm going to clear the

screen and uh let's run the grip command

to search for am from the

automobiles.txt.

Okay, I'm going to use the pipe command

and uh sort this. So these were the two

results, right? So when you do a cat

command or when you do when you just run

the gp command with am right so what

would happen is you'll get these two

results because these two lines or these

two words have the am characters inside

right now when you give the sort it

would sort it alphabetically right and

if I if I want to sort it in the other

way then I can just run the same command

with the r flag so when I do r then this

result will be sorted in the reverse

fashion so yamaha comes first and

lamoggony comes first so that's how the

pipe command can be used to get the

output from one operation and feed that

output as the input to the next

operation. Right? So um this is

relatively smaller topic. Okay. And we

quite often we'd be using uh the pipe

command when you want to use multiple uh

operations in the same command. So

that's about the pipe command. Okay. So

let me just clear the screen and get

back to my presentation and see what's

my next slide all about. Okay. So now

that I've shown you how to sort the

contents of the file, let's go to the

next uh slide. Right. So the next

section of uh this Linux tutorial is

going to be about the copy, move, make

directory, remove, remove directory, and

the user permissions. All right. So

let's get started with this section.

Okay. Uh CP stands for copy and that

will be the first slide uh that we're

going to talk about. Okay. So as you

know copy is basically used to copy

files or directories. Okay. The point to

notice files and directories. So in

Windows you have the option of right

clicking on any file or any folder and

you know saying copy or copy paste or

cut paste right that's in Windows and

you can do that even through the GUI in

Linux. But how will you do it through

the CLI right through the terminal? You

specify this command. you specify CP and

if you have any flag you enter the flag

and then you specify the source and the

destination. Okay, so the source is

basically this will be the path of the

folder that you want to copy and this is

the place where you want to copy it to.

All right, so uh let's uh get back to

executing and showing you a

demonstration of this. So I'm going to

go back to my terminal. So uh first of

all uh we are in the documents directory

and let's see what is there in this

directory. Okay, there are the three

files that we created, right? There is

automobiles.txt. There is file 1.xt and

file 2.txt.

Now what I'm going to do is I'm going to

copy the automobiles.txt and uh paste it

in my uh desktop. Okay. So let me just

minimize this. So this is my desktop,

right? So right now I don't have the

automobiles. But through the terminal

I'm going to run a command which will

copy the uh automobiles.txt to this

folder. Okay. So I'm just going to

minimize the terminal now to show you

that it happens. Okay, real time. So

what I'm going to do is u ls and I'm

going to say copy automobiles.txt.

This is the source and the destination

is uh root home edurea and uh in edureka

it's the desktop folder right when I hit

enter there will be a new

automobiles.txt file that'll be created

over here. So as you can see the new

file got created over here and uh yeah

so it's it's a very simple command that

you can uh execute. So you can do the

same thing to even uh directories and uh

files. All right. Uh so what I'm going

to do is uh I'll go to the home

directory and from the home directory

I'm going to go to the desktop directory

and copy the LMS folder. Right? So the

LMS folder is again uh you know it's

it's a folder this time. It's not a

file. So last time we copied a file.

This time I'm going to show you how to

copy the folder itself. Okay, I'm going

to copy this folder and paste it

somewhere else.

So let me go to the terminal cd and I'm

going to go to the desktop here.

All right. So we have uh LMS here. So

I'm going to say copy LMS. All right. So

I'm going to remove the slash from here

because I'm going to copy this uh folder

now. And uh this would make it the

source that would make LMS the source.

And the destination is we have to put

the absolute path here. Right? So we got

to start from the root directory and go

to home edurea. And let's say I want to

put it in the uh documents directory.

Okay. So something that is present uh in

the desktop directory that is uh being

copied and pasted inside the documents

directory. Okay. So when we give enter.

So guys uh we're getting an error here,

right? So it says copy cp omitting

directory lms. Can you all guess why

that is the case? Can you all like

understand the meaning of this error?

Omitting directory. Don't break your

sweat too much because u the meaning is

simple here. It just it has just omitted

a directory. Okay. Now the reason is so

that is because uh the cp command it by

default it copies only files. Okay. If

you want to copy directories also then

you got to add another flag called r

flag. So let me just quickly go to the

slides and show you uh the functionality

there. Okay, as you can see here uh we

have the R flag right. So CP minus R it

is for recursive copy and that is for

copying directories also. Okay, and it

copies also hidden files. If there are

any hidden files or if you have

directories which you want to copy

inside that directory then it will uh it

will copy that that itself. So that is

the thing because you cannot copy uh

directories without the R flag. You can

only copy files. So that is the uh

meaning here and uh we have another flag

here called the V flag and that is

verbose. Well, what verbose means is it

prints informative messages. Supposing

you're executing a command okay and

supposing the command is going to take

time like it's going to take a good 5 10

seconds then during that time it would

print the status of the system like

supposing it has completed like step one

to step three okay and it's stuck at

step four then it would print that

message and as an event when step four

is completed you will get a message uh

saying that's completed and yeah

similarly it's like progress wise it

tells you what is the progress and what

are the action that the system is taking

and what step it's performing so it just

prints such informative messages just

minus V. Okay. Okay. Let's first start

off with the I flag. Okay. So we have

something called as a CP flag I. Okay.

So when you give the I flag, it enters

the interactive mode. So when you say

interactive mode, it is because u at

times you might have files which will

all be already be present in in a

particular directory. Okay. Uh you saw

me copy automobiles.txt once from

documents to desktop. Okay. Now if I do

the same operation again if I run the

same command again at that time it'll

automatically overwrite the file right

because uh the file name is the same the

automobiles or txt is was the one that

is there in my documents folder and

again even over here on my desktop it is

documents uh sorry it's automobiles when

I copy them what would happen is that

file would be replaced okay now uh in

that kind of a situation when you're

copying multiple files you might want to

be notified before something happens

right so if you specify something like

the i flag then you will get an

interactive mode so the system will not

take a decision on its own but instead

it will not use any defaults okay that's

what we mean by uh on its own okay so it

would uh you know ask you it prompt you

for an answer. It will tell you that

okay this file already exists in this

directory and do you want to replace it

and then it'll give you an option Y or

N. Y stands for S, N stands for no. So

that's what the CP and I flag does and

when you give the N flag it will not

override the file. Okay, because by

default it overrides the file and if you

specify the N flag it will not override

the file. But the whole concept here is

it is based on the file name. What if

the file name is the same and the file

contents are different? Okay, at that

situation you might want something like

the flag u. Okay, now what the flag U

does is it will update the destination

file only when the source file is

different from the destination file. So

by using the N flag, you will make sure

that the file is not overwritten. Okay,

but then if you use the U flag, you will

have another benefit. Okay, what will

happen when you use the U flag is so

first it would check the file name. If

the file names are different, then it

would create a new file. If in case

there is another file by the same name

then it would check the contents of that

file. If the contents of that file and

the file that's being copied if they are

the same then it would not get copied

and it would only get copied when the

content is different. So at that time

you'll have two different files with the

same name. So that's the advantage with

the uh CP and U flag. Okay. So let's try

executing uh these options. All right.

So I'm just going to go back to my

terminal here. So first and foremost

let's execute the uh R flag. Okay, it's

capital R. So do note that. And uh when

you say enter, so the item is copied. So

if you go back to your documents folder,

you can see that there's a new folder

called elements that's been created. So

this was initially not present and it's

uh present now. Okay. Now what we'll do

is I'll delete this. Okay. I'm going to

minimize this. Execute the same command

along with the verbose flag. All right.

So, as you can see, the uh status of the

system was also displayed in the

meanwhile even though I entered my uh

text somewhere here. Yep, it's right

here. Correct. So, this was the earlier

uh command that I executed without the

verbos. Okay, here it just straightway

copied the file. Okay, the LMS sorry,

the LMS folder to my uh documents

folder. But when I gave V, the

informative message also came, right? So

it uh the step-by-step process of what

all is being copied came. So first uh

this was the first folder being copied.

This was the first subfolder being

copied and after that all the other

files that are being copied each and

every document step by step it is all

listed down and u you'll get all those

details here if you give minus v in your

command. So that's what the minus v

does. Okay. So I'm left to show you the

i, n and u flags, right? So what I'm

going to do is um let's say I just want

to clear the screen now. Okay. I'm going

to remove this command here and go back

to the documents folder and show you

that the LMS has been copied okay with

the verbos when I created this folder.

Okay. Now what I wanted to show you is I

want to show you copy with the

interactive mode. So earlier if you see

the uh desktop and there's already an

automobiles txt right so what I'm going

to do is I'm going to copy

automobiles.txt txt I'm going to copy

this one again to the desktop but this

time it should uh you know I'm going to

use an I flag and it will not overwrite

the existing flag. So I'm going to say

cp automobiles txt to destination is uh

home/ora

slash All right. Uh I think I'm in the

wrong directory right now. Okay. So I

need to go one uh path back. Switch to

documents. All right. Now here I need to

copy the automobiles from here right and

put it in the desktop. So

home/ora/

desktop. Okay. So I'm going to copy the

automobiles.txt over here. So when I

give enter the automobiles.xt has been

copied here again. So let me just go

back to my desktop and see that even

though I've run run this command two

times one now and uh one earlier and one

uh now just a couple of seconds back

there has been no duplicate that's been

created. That's because this file has

been overwritten. Okay, the one with the

name automobiles has been overwritten

with the latest command. So what I'm

going to show you now is I'm going to

use an I flag here. Like I told you flag

is what gets you into interactive mode.

So you will start interacting with the

uh Linux uh kernel or the Linux shell

over here. So as it says the uh home eda

desktop automobile.txt

it says overwrite. Do you want to

overwrite this particular uh file

because it's already present. If you

want to override if you say y and if you

enter then the file would be

overwritten. Okay. But if you uh give n

and enter then that file would not be

overwritten. So if I say no and if I

enter then uh that copy would have

failed. Okay. But if I do the same thing

again and if I press Y, it would have

overwritten the file would have been

overwritten. So that is uh what the I

flag is. And then you have another

option okay of the N flag. So the N flag

what it does is it does not overwrite

the file by default. So for that option

I told you that uh by default it

overrides right. So I also showed you

earlier that uh no duplicate was created

and the existing file was overwritten.

Supposing you don't want to do that then

you can just use the n flag which would

automatically indicate and tell the uh

Linux runtime engine that uh not to

overwrite this particular file. Okay. So

you can have any number of files there.

So even if the contents are different

here okay so even in caseh the new file

that's being copied has a different

content okay but it has the same name

then even in that case by specifying the

end file it will not be overwritten

because there's a good chance that you

might have made changes to the latest

file and by copying another file with

the same name to that same directory

then there's a good chance that you'll

be losing out on the changes that you

made right so at that time you can uh

use the n flag so in fact let me show

you that with an example uh what I'm

going to do is uh Right now we are in

the documents directory. So I'm going to

do a cat and automobiles. Okay. So these

are the contents here. And let me update

this. Okay. What I'm going to add is I'm

going to add another uh company of

another bike. Okay. Uh let's say we are

adding KTM to that list. Okay. So when I

do Ctrl D and exit the interactive mode

and if I do cat automobiles txt then KTM

would be added over here. Okay. Now this

uh automobiles file in the documents

right now this is the updated one. Okay.

But in the desktop the updated file is

not present. Okay. In the desktop the

file with only uh this much of content

is there. Now I'm going to execute the

command with the n flag. Okay. So with

the n flag it's basically indicating

that you're not supposed to override the

file. Okay. So when it says that when it

finds out that automobiles.xe txt is

present over there also in the desktop

also it would not copy the file at all

okay so when I go enter and of course so

there's nothing here now if I go to the

uh desktop okay if I click on

automobiles txt here you can see that uh

ktm is not present all right but however

when I close it and if I uh remove the n

flag right if I remove this flag and

execute it and if I go back to the

automobiles txt you'll find that km is

updated awesome right so that's the

power of this N flag. Okay, so that is

uh the end of uh all the different flags

that I was about to show you from my

PPT. Okay, so additionally there is one

other thing that I want to show you.

Okay, now I showed you how to copy from

source to destination. Okay, and now you

know what if you know the path of

something and you want to copy it to

your present directory to where you are

currently. So this is basically I'm just

teaching you this option to you know

save some time. Uh you know at times you

might want some shortcuts or some hacks,

right? you don't want to provide the

complete path everywhere. So at that

situations at that scenarios you can uh

use this uh hack and let me explain that

before I uh execute it in my uh

terminal. So what I'm saying is uh right

now I'm in my desktop and I have only my

automobiles and my readme text files.

Okay. Now but in my documents folder I

have three other text. I have file 1.xt

and file 2.xt. Okay. Let's say I just

want to copy the file 2.xt. What will I

do if I want to copy my file 2.txt txt

into my desktop. I'll have to go to my

uh documents folder then put the cp

command and then enter the file name and

then copy it to this folder. Right. I

have to specify the path of this

desktop. So instead of that there is

another hack over there. Okay. Now

instead of doing that what I can do is I

can just go to my terminal. I need to

first go to the desktop folder button.

Okay. So I'm going to go one step back.

I'm going to say change to desktop. And

here yes there is only automobiles.txt

and there is uh readme.txt. Now what I'm

going to do is I'm going to run the cp

command such that I copy file from this

particular directory to the current

directory. Okay. So the file 2.txt if

you remember that is present in my

documents directory. Right? So I'm going

to specify the path to the documents

directory and the path to documents

directory is / home edora and documents.

Okay. and the file name is uh file

2.txt. Okay, I'm going to copy this file

which is under this path to my current

directory. Okay, instead of uh having to

specify my complete current directory, I

can just give one dot. So this one dot

represents the current working

directory. Okay, I'm currently in my

desktop and what this command would do

is it would copy this file into this uh

current directory. Okay. Now when I give

enter and if I go back to my uh desktop,

you'll see that the file 2.txt has been

created. Okay. That's because it it went

to this path, picked up this file and

pasted it in my uh current direct. Okay.

So that's what this is about. All right.

So this is what I wanted to show you

guys. This was something additional

which was not there on the slides. So

I'm uh done with that. So moving on to

the next slide. Okay. So uh next up we

have uh is the move command. Okay. So

the MV like CP stands for copy. The MV

here stands for move. Okay. And this is

uh used at times when you want to cut

paste something. Okay. Uh this would

when we used copy then the original copy

of that file was also present in the

existing directory and it was created in

another directory. Right. But if you use

the MV command then it's going to

basically work like cut paste where

it'll remove the content from the uh

source directory and the only copy would

be present in the destination directory.

All right. So uh let me straight away

get started. It's not too much of an

explanation needed over here because uh

it's self-explanatory. If you use the I

flag, it basically enters into

interactive mode again like before. So

the U flag is again the same as what it

was in the copy command. It updates the

destination file only when the source

file is different from the destination

file. And uh the MV minus V again it

would uh you know uh move it would print

the system state. Okay, prints the

source and the destination files. Uh

gets into the interactive mode where the

okay, not interactive mode. It basically

means uh the system status will be

displayed over here. Okay, that's what

the verbose is all about. Uh so let me

go back to my terminal and uh show you

how this copy is done. All right, so let

me clear the screen and currently I'm in

my uh desktop folder. Okay, and here I

have these files. I have automobiles.txt

and readme and file 2. Okay. Now, what

I'm going to do is uh I'm going to use

the move command to move file 2.txt to

another uh destination. I'm going to

move it to the LMS. Right? So, when I

give uh LMS, okay, this means that this

move command will work such that this

file will be moved to LMS folder. Okay,

let me give enter and go back to my

desktop and find that it's not it's

missing. That's because I ran a command

over there. If I go to LMS, however,

I'll find the file 2.txt over here. All

right. Awesome. Right. So, that's what

the MV file does. And supposing I want

to uh you know, similar to copy, you can

move multiple uh files at the same time.

All right. So, I can uh move, you know,

supposing uh I go back to my desktop.

Okay. And I'll find that there is

automobiles and readme. Suppose I want

to move both of these to the uh LMS

directory, then I can do that also. I

can just uh simply give move. I can give

automobiles.txt and readme.txt and

specify the destination. I can move to

any other folder or I can move to LMS

folder. If I'm moving to LMS folder,

then I just need to give LMS. Okay. But

however, if I'm moving uh to another uh

folder, then I got to start from the

root say home eda and from here let's

say I want to go to downloads. Okay. So

downloads if I want to go I'll give this

path. I'll give enter. And if you notice

both are missing from my uh desktop. And

if I go to my eda and if I go to

downloads I can find the two files over

here. So that's how simple it is guys.

So that's the uh move command. And if

you want to see the system status then

you can use the V flag like we use for

CP. So a similar log will be generated

and shown. If you want to enter

interactive mode then you can use the I

flag. All right. If you're moving like

two files right at that time you might

need the interactive uh interactive

file. So similar to copy where if you're

moving to the destinations folder where

there's already another file with the

same name then at that time you might

want to use the i flag. It would ask you

whether you want to override it or not.

If you don't want to override it at all

then you can just give the n flag. But

there again if you don't want to use the

n flag either then you can uh use the

minus u flag which would update the

destination file only when the source

and the destination files are different.

Okay. So these are the uh different

flags that can be used with MB. So the

basically the flags that can be used

here are the same as the flags that can

be used with the copy command. So guys

uh that's it with the uh move command

and we can go to the next slide. Okay.

We can go to the next topic. But before

that there is one more functionality

that I want to show you with respect to

both copy and move. I uh actually forgot

to show you this aspect. Okay. Now uh

for this let me first show you the GUI

aspect. Okay. All right. I go to my

ederka and if you go to my documents

you'll find all these uh three text

files and also my LMS folder right now

whether be it copy or whether be it move

commands I've showed you how to copy

like one file or two files or three

files okay but what if you have like 25

files right so what you have like I mean

just think about this what if you're a

proper uh Linux user and you and you

want to just transfer all your files of

some particular format right you want to

just transfer it to another folder you

want to take a backup or something like

that what would you do instead you know

you can do a control A over here and

choose all the files okay or you can

choose one after the other like this but

through the CLI how do you do it correct

so you have such problems right so for

that you know we have options also for

CLI and uh those work with both CP and

the move commands so what I'm going to

do is I'm going to show you how that is

done uh so for that purpose I'm going to

first go to my documents directory I'm

going to make that my uh pwd so I'll

just go on back and here I um

go to documents. Okay, now I'm here. So,

what I'm going to do is uh I'm just

going to clear the screen. So, of

course, for clearing the screen, the

shortcut is uh Ctrl L. Okay, if you guys

have forgotten that and uh I also

mentioned that earlier. So, Ctrl L is

the shortcut for that. Uh so, yeah, we

have automobile.txt, file 1 and file 2

and LMS. So, we have these four files

and one folder there. Okay. Now if I

want to move this one of the directory

then there's another option. So what I

can do is I can use something called as

regular expressions. Okay. Uh regular

expressions is one topic which I'm going

to cover in detail later during the

session. But just because we're in the

CP or in the move commands uh stage of

this uh demonstration. I want to

continue and I want to show you this

also. Okay. I want to just get finished

with this part. So you will get an idea

of what I'm saying when you see me do

this. Uh so here we have these four

files. So first let's use the copy

command. So if I want to copy all the

files which are in the form of a file.

Okay. So they are all in the txt format.

Right. So what I can do is I can uh just

do a cb I can uh click on dot or rather

asterric dot txt. Okay. Now what this

essentially does is instead of uh

searching for the text file by its name

and you specify an asterric it searches

for all the files with the uh txt. Okay

which is ending with a txt. So that's

what this would do. And when we say cp

followed by asterric txt, it means copy

all the files that are ending with txt.

So in our case we have automobiles.txt,

file 1.txt and file 2.txt. Right? So

what this command would do is it would

copy these things and put it in the path

where I suggest here. So let's say I

want to put it in another folder. Okay.

Let me start off from the root home eda.

Then here I think we have you know we

have these options right? Okay this is

the documents. So in the edrica we have

okay we have the music folder we have

downloads pictures. Okay downloads of

course I've already copied something in

there. So what I'll do is I'll move that

to the music folder. Okay. So the music

directory. So I'm going to say this and

give enter. So your copying has been

successful. So if you go back to the uh

music directory you'll see that there

are three new files. One is automobiles,

the other one is file one and the other

one is file two. Okay. Now, uh the same

thing can be done for even move, right?

Uh the same way we executed a copy, we

can also execute the move command. Move

is going to completely move it. It's

more like cut pasting. Okay? Similar to

how you remember from Windows. Let's

move it to pictures. Okay. So, currently

in pictures, there's nothing. And in uh

music, we have these three. So, when I

execute the move command, this folder

should become empty. And they should all

go to the pictures uh folder. All right.

So, move. Okay. But we have a problem

for that. What we need to do is we got

to move to our uh music folder, right?

So it would this would probably show an

error. So I'm going to first uh go back

or rather go to music folder. Okay, we

are in documents, right? So what we're

going to do is uh cd music. All right.

And I have my commands here. Right. So

here I'll execute that move command. So

it was this one. And I'm just going to

replace CP with MV. Okay. So from my uh

music directory, it's going to move all

the folders or files which will have the

.txt format. Okay. All the files, not

folders. It will move all the files with

the .txt format. And it will move it to

home/ora/

let's move it to pictures. What do you

say? Okay. So when I give enter, that

would have moved. So let's go back to

our folders. Music. There's nothing

here. This has been cut pasted to the

pictures directory. All right. So this

is what I want to show you. Okay. This

is what I missed showing you earlier

while executing the cp command. But

yeah, here we are. I've done this. And

similarly, if you want to go also uh you

know, if you're from the music directory

and if you want to move something to the

uh present working directory, even that

is possible. Okay. So another

possibility which I would like to show

you is that uh of going back going to

pictures and then we have all this here

right I'm going to clear the screen ls

again we have automobiles file one txt

and file 2 txt right so uh we can do a

move command and u

so right now we are in the u so let me

clear the screen

So I'm going to do a CD. I'm going to

clear the screen. And uh currently I'm

going to do an ls. So some of our items

are present in pictures. So what I'm

going to do is I'm going to uh move back

to music. If I do an ls, there's nothing

over here. So what I'll do is I'll say

move

slashhome/reka

slash

pictures dot okay asterric first dot txt

and I want to move it to the current

directory. So when I do this again from

the pictures everything would have moved

back to music. All right. So that is the

other uh thing that I want to show you.

Okay. So similarly it works for even the

copy command. I'm pretty sure you'll

understand how it works. So I'm not

going to waste too much time on that.

Okay, I've cleared my screen and now

let's uh start with the next topic.

Okay, I'm going to go back to my slides

and yeah, the next topic is uh make

directory commands. Okay, so the next

topic is uh make directory. Okay, that's

what mkdir stands for make directory.

All right. So it's simple again if it's

all about creating a new directory or

creating a new folder. Okay. So uh to

create a new directory you just specify

mkdir and uh the path. Okay the

directory path. Okay. That would create

a new subdirectory in that path. Okay

guys so currently we are in the uh

documents right. So I'm going to do an

ls. I have these many uh things. So I'm

going to do a mkdir and create a new

folder over here. So that folder name is

going to be uh let's say

folder one. Okay. When I do this a new

folder is created. So when I do the ls

command again so you can see that the

folder one is extra. Okay. It was not

there the previous time that we executed

the ls command. Okay. So that's how you

create a new folder. So it's pretty

simple. Now comes the other question.

Okay. I can go into uh the folder one.

Okay, of course there'll be nothing

inside. Now what if I want to create

multiple folders okay and uh parent

directories. Let's say something like I

want to create folder one inside which I

want to create a folder two and create a

folder three. Is that possible? Okay. So

I'm going to try doing that and show you

if it's possible or not. Okay. So I'm

going to say make directory folder one/

folder two. Okay. This would be folder

two because I'm already inside folder

one. This would be folder three and

folder four. Okay. So this basically

will run the make directory command

inside folder one and it will make a

directory 2 3 and four. Now when I give

enter these folders should be created.

Ideally they should be created. Okay.

Ideally speaking. So let me just verify

everything once and show it to you. So

it was documents. This was a new folder

I created. Folder one. There is nothing

inside. Okay. Now uh from the terminal

if I click enter it says make directory

cannot create directory folder 2 3 and

four okay because there's no such file

or directory okay do you know why that

is I as you specifically can we do it

that is because when we try to enter one

directory it's possible okay when like

in this case we specified just one one

directory right just folder one so it

created the directory once but in this

case there are too many directories that

we need to create okay it's like two

three and four. How can make directory

create so many folders? Because this is

going to be in the form of a parent,

child or a subdirectory, right? We are

creating folder two inside which there's

a folder three inside which there's a

folder four. So in this case, MKD is not

enough. So this is when we need to use

another flag called the hyphen P flag

that stands for parent. Okay, let me go

to my slides and just cover that aspect

once. So as you can see here, there's a

flag called hyphen P. Okay, and what it

does is it creates both a new parent

directory and a subdirectory. And it's

essentially used only when you're

creating like two three directories and

I mean you're creating one directory and

a couple of subdirectories under that

directory. Okay. So that's when you use

this. Uh alternatively you can also use

this hyphen parents. All right. And uh

if you want to create one parent

directory and multiple subdirectories

inside that directory then you can use

these flower brackets. Okay. Inside the

flower brackets you can have the

different folder names. Okay. So let me

just quickly go to the terminal and show

you that aspect. So make directory these

were there and now I'm going to give

minus p and when I execute this

everything would have been created. So

let me do a cd folder 2. Now do an ls

there's a folder three. Now let me do

this and enter and let me do an ls

again. There's a folder four. Of course

here there would be nothing. Right? So

let me uh enter this folder four and

here there would be nothing. Folder

four. So that's what I was talking

about. Okay. Uh let me also verify that

once from the terminal folder one we

created a folder two inside which

there's a folder three and there's a

folder four. Okay guys so this is what

we just created. So what I'm going to do

is uh I'm going to just go back to my

folder one here. Okay. In fact yeah okay

folder one should be good. Now I want to

show you executing the same command with

the flower bracket. Right. Right? I told

you that creating a flower bracket will

let you create multiple directories

inside that directory. So if I'm going

to say make directory

folder uh because it's inside folder

one, I can create one here. Folder two,

I can say comma folder 3,

folder 4. Okay. And if I close this

flower bracket, then these three sub

directories or folders would be created

inside my folder one. All right. So I've

given enter here. If I go back to my

GUI. So I go inside folder one. So

initially there was one folder two.

Okay. That was the folder two which I

created earlier. Okay. And now I created

folder two. All in small small F, small

F and small F here. So folder two,

folder three, folder four was created.

Now folder this one was created earlier.

Okay guys. So that's how uh you know you

make directories. In fact, you can even

append this with a parent. Say you're

supposeding you're now in folder uh one,

right? You can say make directory. You

can say f_sub_2 put a slash and then

inside this f2 folder, these

subdirectories will be created. Okay.

Now, if I give enter, I know what the

problem here is. Uh it says because f2

is not created right now. Correct. This

is the time when you got to use the uh

hyphen p command, parents command,

right? So which I showed you earlier. So

now that I've used the minus P. So the

parent is created and the uh children

are also created. So if I go back to

folder one, this was F2 is what I

created recently. All right. So inside

F2, there should be folder 2, folder 3,

folder 4. All right. So this is uh what

we can do with respect to make directory

commands. All right. So let me close

this and go back to my slides. Okay. And

uh go to the next topic. Okay. So uh

next up is the uh rmdir and the rm

commands. Okay. So this is the remove

and this stands for remove directory.

Now there's a subtle difference between

the two. Okay. Now uh when you say okay

the basic difference between the two is

that when you say remove directory it'll

only remove that particular directory.

But when you say remove it can also

remove the subdirectories or the child

directories inside that one. So let me

just go to my terminal and show you how

these are executed. Okay. I'm going to

go to my terminal. So currently I am in

my folder one right. So let's go to

folder two and then do an ls cd folder 3

ls cd folder

folder 4. Okay. Of course there's

nothing here. So what I can do is I'm in

folder three now. Okay. LS again. Yes

I'm in folder three. And I if I want to

remove this folder then I can do uh

remove directory

folder 4. All right. So when I do this

this particular folder would have been

deleted. Now from folder two I can uh

again remove folder three. Okay. Similar

to how I removed folder four. But how

about I go one more path back. Okay. So

right now I'm in ls. Okay. So if I do a

pwd you'll find that I'm in folder one.

Okay. And when I do an ls I have f2

folder 2. I have a capital folder two.

This is where my folder three and folder

four is present. Okay. So I have that

and then I have folder three and I have

four and four. Now however if I try

doing a remove directory and if I try to

remove folder two right it will not

work. It failed because the folder two

which we are trying to delete right from

inside folder one we are trying to

delete the folder two. This is that

folder two. And inside this folder two,

there's another folder that is folder

three. Let me just uh show it to you

once so that I can remove your

confusion. So inside this uh folder two,

I have folder three. Okay. And because

I'm trying to delete this uh folder two,

it's not able to delete because there is

already a folder three inside this

folder. That is a problem with remove

directory. So guys, I'll just clear the

screen and let me just do an ls again.

So now I'm going to show you how to

remove these folders. I showed you

removing folder four. Okay. So inside

this folder three, I went and I removed

folder four. Okay. Now I'm going to show

you how to remove multiple folders.

Okay. At the same time. Now let's say

I'm running the same remove directory

again. So I'm going to say remove folder

2. And u when I give enter, it says

failed to remove folder 2 because the

directory is not empty. Okay. Uh do you

know what the problem is? it's uh

telling right because the directory is

not empty it's not able to delete. So

because folder 3 is contained inside

folder two it's not able to delete this

folder. So if I want to delete folder

two also then what I got to do is you

know I got to first delete the folder

three and then delete the folder four.

So I have to provide the absolute path

of the child directory. Okay. So I'm

going to say remove directory. Okay.

Same like before I'm going to say folder

2/ folder 3. when I run this command

then my folder three will get deleted.

Okay, the child will get deleted but the

parent will still be uh active. Folder

two will be active. Okay, because uh

when I use the rmdir with folder two and

folder three only folder three will get

deleted. Let me show you why that's the

case. When I give enter when I do an ls

folder two should be available. See

folder two is available but when I do a

folder uh two there's nothing in here.

Okay, there's nothing in here. So if you

want to do that, if you want to delete

both the parent and the child at the

same time, you got to use a minus p

flag. So let me show you to use a minus

p flag. Okay. So I'm just going to make

the folder three now. And I'm going to

show you how to use a p flag. So similar

to how we use while creating a folder,

we got to use the same remove directory.

Okay. Rmdir with the uh hyphen p and

folder 2 and folder three. Folder 2/

folder 3. So in this case both the

folder two and the parent and the child

will get deleted. Okay. Enter. When I do

an ls I don't have a folder two here.

Okay. This one is also deleted. So

that's what a minus p flag does. Now let

me just create make a new directory. And

uh what I want to show you is the

verbos. Okay. So I'm going to make

directory. So again the the ones which I

deleted have come back again would have

been created again. So I want to show

you the usage of the verbos directory.

when I add a V here as for the slides it

said right verbose. So when I add a v

here and when I hit enter, okay, I've

done the make directory again. So I have

to actually remove the directory now.

Okay. Now when I say remove directory

and when I uh try to print the uh

verbosph

so it says first it's deleted the folder

3. Okay, which is inside folder two

after deleting that it has come and

deleted folder two. Okay, so that's what

this is all about. This is what uh you

know you need to know about the remove

directory commands. Now uh let me just

clear the screen.

So guys uh now let's uh see how the rm

command works. Okay. Now uh the rm

command here as it says from the slides

it can be used to remove even non- empty

directories. Okay. If we use the rm with

the r flag and if we use the r and p

flags together then it removes the

non-mpt directories including the parent

and the uh sub directories. Okay. So the

one limitation that we had with rmdir

command was that we could not remove uh

non-mp directories. we had to first

empty them and then only delete them.

Okay, otherwise we had to specify the

entire path and then uh you know use the

p flag to remove all the parents and all

the child subdirectories in that path.

Right? That was the limitation that we

had with remove directory. But in RM we

don't have that problem because uh let's

see okay in ls we have so many folders

okay so if I try going to f2 okay and I

do an ls here then I have three

different folders folder two folder

three folder four okay now if it's an

rmdir command it cannot technically

delete this folder called f_sub_2

f_sub_2 is basically a non-mpy directory

inside f_sub_2 there are other

directories like folder 2 3 and four so

let me just uh show to you once so

inside f_sub_2 we have three folders

folder 2 folder 3 and folder four. So

with the uh rd diir command we cannot

definitely remove but with f2 we have a

chance of removing it. Okay that's

because uh we can make use of the r flag

here. Okay but however this will also it

will delete f2 and its subfolders. Okay

so let me do an ls and uh if you can see

here initially under folder one we had

f_sub_2 and these three. Okay but now we

don't have that under f2 because that

whole f2 folder is missing. If I go back

to my folder one here, you'll see that

the F2 is uh missing over here too.

That's because on the remove, right, it

uh removed the whole F2 folder in spite

of it containing some folders. Okay, and

that's what the R flag does. That's the

advantage of using the R flag. Okay, so

if the same thing if we use the R flag

with the V flag, then it'll print the uh

status also. It's like the verbose,

right? It'll print it'll tell you what

all has been deleted and how it has been

deleted. So that's the advantage with

using RM over uh RMDR. Okay. At times

this is more beneficial. So I'm just

going to clear the screen and uh getting

back to my presentation. I'm done with

all the concepts in this slide. So let

me go on to the next topic. Okay. So the

next topic is going to be that of uh

working with user permissions. Okay.

It's very important for a Linux

administrator to know what these uh user

permissions are. Okay. because uh the

different files will be there, different

directories will be there and he has to

determine what kind of access will be

available for which user right so that's

what is control here so uh the different

permissions are basically read write and

execute okay R stands for read W stands

for write and uh execute is X okay so uh

initially you'll get this kind of an

output okay you know what let me go to

my terminal and show you what happens

when you run an ls ns ls minus L command

because user permissions is something

which will appear and which you can

control via the ls-l command right

because when you do that all the

different file contents whether it's a

directory or whether it's another file

all those things along with their uh

permissions will be visible in long

format right so let me go to my terminal

first and uh go to cd all right now when

I do an ls I have a list of all these uh

documents okay but however when I do an

ls-l

I get it in long form for okay so I get

it something like this so for each

folder I have the permission set so for

desktop I have the permission sets and

then I have the other components okay

I'm going to explain what this entire

component what the entire row means so

to not let you get too complicated first

I'm going to explain only this part okay

the first 10 characters if you see here

the first 10 characters are these and I

will explain this part first and then

I'll explain this set these three blocks

and then I'll explain the remaining

blocks blocks. Okay, so getting back to

this uh first block in my slides, you

can see that the first block it

determines what is the file type. Okay,

it's either the file or directory type.

In fact, if that is a directory, then it

would be represented by D. Okay, if you

have a D as the first character over

here, then that's a directory. Okay, as

it says, but it can also be any other

thing. If it's a hyphen like this, then

it means that it's a normal file. Okay,

buth in the first letter, if it's a C,

then it means that it's a character

special file. And uh if there is B over

here in this part of the first letter

then it's a binary special file. So

basically there can be four different

letters over here. It can be either a

hyphen or D, B or C representing four

different aspects. Okay. So uh that is

the first information that you have

about that particular file. And then you

have three different blocks. Okay. So

the next nine letters are going to

determine the user permissions. Okay.

And those nine are divided into three

three. Okay. So the first three

represent the user permissions. Okay.

The second block having three uh RWX

representatives are those of group

permissions and the final block

represents other permissions. Okay, this

means other users. Now this user is the

actual user who is logged into the

system. Okay, that particular user. So

this is the user permissions. This is

the group permissions which the user

belong to and what the other group can

view. And this is with respect to the

other users. Okay, that's what is meant

by this others. So if we have uh and the

order always goes by RWX and RWX and

here also it'll be RW and X. Okay. So

that is the order read, write and

execute. So if the first three blocks

are all R, W and X then it means that

the user has all the three permissions

or the owner of the file or the user has

uh the read, write and the execute

permissions. Okay. And in this place if

there are three characters right, W and

X in this order it means that the owner

or the user has the permissions to read,

write and execute that particular file.

Okay. And if there is R, W and X in the

next block, then it means that the group

has the read, write and execute

permissions on that particular file. So

every file that's created, right, it

will have a user and it will also have a

default group that it will be assigned

to. So all the users a part of uh that

group will have the read, write and

execute permissions. Okay. But whereas

the last three here it stands for other

users permission. So there can be

multiple users, right? The same system

can have multiple users. One of course

will be the root user. The other will be

the owner or you and besides you there

can be any number of users. It can be

your friends, your colleagues or uh you

know other people. So this others

represents that. And uh if you have a

blank in any place okay so in this case

there's a blank over here in place of w

there's a blank it means that this

others they don't have the right access

they only have the read access and the

execute access all right and similarly

if you go back to the terminal okay and

if you see here take the example of this

particular file desktop okay desktop

folder is where we were executing a lot

of commands right it is under the folder

so yeah this was the folder that we are

talking code the desktop right now it's

a directory basically okay that you all

agree with then these three characters

represent that the person who's using it

okay right now the person who's using it

uh because I'm logged in right now and

I've logged in with this username right

sorry for that guys yeah and I've logged

in with this username right Eda so uh me

being the owner and me being the user I

have the read write and execute

permissions okay but the group that I

belong through. Okay, that group does

not have the read, write and execute

permissions and the group that uh this

file belongs to. Now, because uh this

file is either owned or used by me,

okay, now because I'm the user, I have

this access and then this file will also

belong to a group, right? So, whenever

you create this file, it'll be assigned

to that particular user creating it and

it'll be assigned to a default group.

So, we're talking about that group here.

Okay? And that particular group does not

have all three rights. It has only the

read permission and the execute

permission. It doesn't have the right

permission. Okay. And the same thing can

be said for uh even the other users. So

the other users in that system who'll be

using that system, they'll only have the

read and execute access on the uh

desktop. Okay. But whereas if you take

the example of this file one.txt, right,

which I created sometime back uh during

this session, this one if you see the

permissions are such that the first one

is a hyphen. Okay, what hyphen

technically means is it's a normal file.

Okay, I explained that hyphen is normal.

B stands for binary special file and C

stands for character special file. So of

course we don't have uh those options

here. We don't have the B and C options.

But what you got to understand is uh is

that this is a normal file and this is a

directory. Okay, wherever there is D. So

since this is a file and the access for

the user is such that I have the read

and write access. Okay, but I can't

execute it. The user can't execute it.

And when it comes to the group, even the

group has the read and write access, but

it cannot execute it. The other users,

however, they have only the read access

and they cannot execute this particular

file, right? So they cannot execute or

they cannot write this particular file.

So that's what these group permissions

mean. And if you go forward from group

permissions, there are more other

blocks, right? So let's go back to the

slides and see what they stand for. So

in this slide, let's talk about the next

three blocks. Okay, so the next block is

that of a number. Okay, you have a

number over here and that represents the

symbolic links. All right, the block

after that is the one that represents

the owner name and the one followed by

that represents the group name. Okay, so

that is with respect to these three

blocks. All right, and then after that

comes the file size of the particular

file and then you have the time stamp,

the time when the file was created, the

file or the folder was created. This is

the actual file size of the block. Okay,

now that's what the user permissions

here represent. So if I quickly go back

to the uh terminal and show you this is

basically the symbolic link. This is the

uh owner name. This is the group name of

the file. This is the uh block size.

Okay. And this is all in kilobytes.

Okay. And uh this is the time stamp and

this is of course the name of the file.

Right? So we have the name of the file

and that file will have first be the

file type then user permissions then

symbolic links then the owner name then

group name then the file size then comes

the time stamp at the end. So that's

what the different file permissions are.

The read, write, and execute. And if you

want to modify any of these file

permissions, then it's also possible.

Okay. Now, let me go to my slides and

show you how that's possible. Let me

show you some theory first. Okay. So,

first of all, if you want to change the

permissions, then you can use the chod

command. Okay. You can use the chod

command as shown over here. And uh you

can use it to change the access

permission of both the files and the

directories. If you want to change the

owner of the particular file, okay,

change the owner of that particular file

or directory, then you can use the ch

own command. And then if you want to

change the group ownership of that file,

then you can use a chb. Okay, so when

you use the chod command, you got to

specify whom are you referring to? Are

you referring to the uh the user, are

you referring to the group or are you

referring to the other people? Okay, the

other users, you got to say that and

then you got to use either a plus symbol

or a minus symbol. Okay, when you use

plus, it means that you're adding these

two rights. Uh so in this case when

you're saying G plus WX so G stands for

group right so as you can see from uh

this particular slide G stands for group

U stands for users and others stands for

O okay and all stands for A okay so as

for this if you're using G over here

then it means that you're talking about

the group and you're adding the W that

is a write and the execute permissions

that means you're giving them the W and

the right and the execute permissions

okay and after you got to specify file

name. So this means it will modify the

permissions to this for this particular

file and similarly you can use the equal

to symbol and also the minus symbol. So

when you use the equal to symbol then

whatever rights you have initially that

will be overwritten. So when you say

chod u is equal to rwx and then uh it

doesn't matter what the previous set of

permissions were then the the previous

set of permissions will be replaced by

whatever you specify here. So you'll be

setting that particular user to have the

read write and execute access for that

file. Okay. And then um you can in fact

specify uh you know uh you can set

access control for multiple people. You

can set it for uh groups users all at

the same time. So in this place this

command we've set it for the users. Here

we are setting it read, write and

execute for users. And then after that

we are setting it for the other people.

Okay, for the other users we are

removing the write and the execute

access. Okay, the execute permissions.

So let me just quickly go to my uh

terminal and show you that. So currently

uh let's take the example of this

pictures okay let's take an example of

this particular folder the user that is

me I have the read write and execute

permissions the group has read and

execute only okay and uh they of course

the other users they also have only the

read and execute now what I'm going to

do is I'm going to say chmod uh I don't

want to change my permissions okay so I

would rather uh change the permissions

that my group has so I would say G is

equal to read and W. Okay. So if you see

here right now the group has read and

execute. Okay. I don't want to give them

execute. So if I want to remove execute

I have to do G minus R and then I have

to give comma G + W. Okay. But uh those

are two different arguments right? So

instead of using two different arguments

I can just give an equal to which would

replace this entire list with the uh

current arguments. So instead of having

R and X I will replace that with R and

W. read and write. Okay, I'll give a

command and then we have others here.

The other users they have read and

execute again. So what I'll do is I'll

uh say O minus execute because I want to

give others only the read access. Okay,

so in this case when I do this the X

over here that will become hyphen and

the hyphen here will become W. Okay,

I'll be enabling the W for them and

removing the execute and for these

people I'll be removing the execute. And

now that I've specified what are the

permissions and who are the recipients,

I'm going to give the file name. So

let's say pictures. Okay. So I'm going

to give the ls minusl command again. And

now you can see that if you go to

pictures, it's been reset. So the others

have only the read access. The others

are blank. Okay. And the uh group have

the read and write access and this

execute has been taken away from them.

So that is with respect to the read,

write and execute permissions that users

can have. All right. So I'm just going

to clear the screen and go back to my

slides. So similarly you can change even

the ownership of certain files and uh

certain groups. Okay. So u if you use a

ch own, okay, ch ownership with that's

what it stands for. And when I follow

that with the username and the file

name, then this particular file will

have a new user or will have a new

owner. And uh this will be the username.

Okay. And similarly even the group

command works in the same fashion. So uh

this is something that you can always uh

work on and you can figure it out. All

right guys. So working with Linux

repositories.

Okay. And it says that stable versions

of most softwares will already be

available in Linux repositories. And the

command to install them is this. So you

would have heard me say earlier that

it's very easy to update software and

the operating system itself by just

running one simple command, right? you

can update the software. So, uh this is

what I'm talking about. So, you can just

run one command. So, this is the only

command that you need to run. Okay? If

you just give sudo yum install and if

you give the package name, then that

particular package will get updated.

Okay? The pseudo is something that you

would recognize from what I told you

earlier. The pseudo is to uh we give it

to to execute this uh command as a root

user. Okay? And uh if you see that there

are two other lines and the only

difference between these three lines is

the letter that the word we are using

here. Okay. So in the first case in case

of any Red Hat enterprise Linux system

or uh even CentOS right which falls

under Red Hat we use Yum. Okay. But if

it's a Debian based system like Ubuntu

or Eduntu X Ubuntu or any any other

Debian Linux system then you would have

to use apt get. Okay. And then if you're

using a federal based system then you

got to use the dnf. Okay. So these are

the three different commands and these

are the that's because the repository

name for real it's called as yum

repository and the repository name for

debian is called as the apt repository.

Okay. And for fedora it's called dnf

repository. So that's why we say we are

first we will have to first give the

sudo uh sudo command which would make

sure that we execute this command as a

root user. And from the command

perspective, the first part would be

calling or referring to the repository.

Okay. So from the CentOS, it would refer

to the yum repository or from the Ubuntu

if it is. If I give appget, it would

refer to the apt repository. And then we

have something called as install. And

when we say install and then follow that

by package name, then that particular

package will get installed. So for

example over here it is Java, right? I'm

trying to show how to install Java on

your system. So in this case if you

first give yum update then it will uh

first of all update your links to your

repositories okay it would update the

yum command and the links that you have

between the repository and yourself so

it's not something related to

installation of java okay this is just

another command that you specify if any

of your installation fails okay so this

is not a compulsory command that you

need to run but besides that what you

have is uh yum install java 1.8.0- 0 -

open JDK. Now the package name that you

see here right that is Java. So if I

want to install Java then I would just

give this particular package name and I

would say install. Okay because the

package name of Java that's present in

the Linux repository that is called as

Java 1.8.0 open JDK. And similarly, if

you want to install any other uh

software, right? If you want to install

any other technology like Hadoop, then

you can just give one such uh package

name. You just got to find out what is

the name of the package that they have

in the repository. You can just simply

Google it and uh it will give you the

package name and you can just say yum

install or pseudo yum install followed

by package name followed by Hadoop - 2.0

or 2.3.0 or very soon Hadoop 3.0 is

coming. So you can say Hadoop 3.0

something like that. And yeah, if it's

uh if you want to install Docker, then

again you can say sudo yum install

docker and uh probably the version name.

I don't think docker needs a version

though. And uh for installing docker you

can uh do it also through Ubuntu. Okay.

So when I installed docker in my other

Ubuntu VM right which I showed you

earlier. So that VM has docker installed

and uh the uh command that I ran that

time was sudo app get install docker and

uh that downloaded and installed the

latest version of docker that was

available in the uh repository. Okay.

Yeah. So that is it and once you're done

with the installation it would take

quite some time to install and once when

everything is done then you'll have to

just you know update your environment

variables. Okay. Here you have to set

the environment variables over here in

your dot bash rc file and once you set

the environment path over there then you

can just do source and then your

software is ready it's installed okay

now this was another step which I

skipped out because this is not really

necessary for you to uh execute this

okay I'll tell you why because uh this

command which is update alternatives -

config java it is only to select a

particular version of java now let's say

that you're new to Linux okay and uh

you're downloading Java for the first

time then you just need to run this

command. So after running this command

you can straight away just uh you know

probably when you're done with this Java

is installed basically okay but it's

just that you need to go to your pseudo

you should do pseudo gedit go to your

bash rc file and update the path where

java is installed okay you got to

specify to your uh environment variables

to your runtime engine that java has

been installed in this path so you have

to just copy the path of your java and

paste it in the environment variables

over here and then you have to source

that particular bash rc. So when you're

done with these two things, your Java is

installed. Okay. But if you already have

a Java package installed, okay, so in my

case when I'll be showing you this now,

I already have a Java 1.7 package. Okay.

So now if I do a pseudo yum install Java

1.8.0 open JDK, then I'll have multiple

versions of Java. Okay. And my

environment variables would be currently

set to Java 1.7 because that's what I

already have. But uh since you have you

know multiple versions of Java and since

there are different packages you can

have multiple packages of Java installed

but you can only run one of them. Okay.

So you set which one you want to run

right? That one you set over here

whether I want to choose to execute

seven or whether I want to choose to

execute eight that I can choose by

updating over here. So I'll show you

this command also. Okay. So that is what

I want to show you with respect to Linux

repositories. So similarly you can even

uh you know you can do a pseudo yum

install PHP if you want to install a PHP

server you can just say PHP MySQL server

if you want to install any other

software like wget you can do that also.

So this is what we are saying you know

it's very simple to install software. So

if you're doing it with the GUI then

you'll have a lot of steps that you need

to do. You need to go to the website

download the appropriate package then

extract them then install them all those

things. So instead this is just simpler

and it's uh much faster. Okay, now let

me go back to my terminal and show you

how that is done. Okay, so I'm going to

go to my uh CD and the command is sudo

yum install and uh now would come the

Java package. So the package I'm going

to install is Java 1.8.0. Okay. Uh

that's because Java 8 is uh plays with

this name. Okay. Okay. So the package

name of Java 8 in uh the Linux

repositories is uh Java - 1.8.0

- Open JDK.

Now when I hit enter, it asks for the

password because uh this particular uh

sorry for that guys when I use pseudo to

execute this particular command then it

asks for a password because I'm

executing this as a root user. So that's

why if I try executing this as a local

user, as my own user, then it wouldn't

be possible to execute this command.

Okay, I have to execute this as a root

user and uh root user is the one that

has the ultimate privileges, the

ultimate access. He has access to

everything. So you just enter the

password and put enter. Then

automatically your packages will get

downloaded and uh it'll get installed.

So uh now it says you know total

download size is 33 MB and uh it asks is

it okay to download it. Y stands for yes

and N stands for no. Now if it's uh you

when you're trying to download Java when

you give this command you got to say why

and hit enter because that would

download the 33 MB package and install

in your Linux machine. Okay. But however

I have already downloaded Java and since

I've done it already so I don't need to.

Okay. I don't want to waste my time here

because uh this is a session right? I

don't want to waste your precious time.

So what I'm going to do is I'm just

going to click on end and give enter. Is

it fine? Uh Sedat Hmon all you guys who

are in the session is it fine because I

want to save some time here by hitting

N. Okay. Because otherwise it would take

some time to set up the installation

process. So okay fine. Yeah I'm getting

a yes from uh you both. All right. So

I'm just going to click on no. Okay. So

it says uh exiting on the user command.

Great. Uh yeah. So the the only thing

you got to note is that instead of n if

you put y and if you hit enter it would

download for you and it would complete

the installation. All right and uh

there's one more thing that I would

actually like to add to this. Supposing

while uh installing the same package

right while uh doing the pseudo yum

install java this package when you're

trying to run this command if you want

this y option to be chosen automatically

okay because right now it entered into

the interactive mode. Okay, interractor

mode is when the colonel was asking you

should you download this and do you want

to download this and execute it later

and I had to press N and get out of it.

Okay, but however you might not want to.

Okay, so so there may be times when you

might want to by default just click on

yes. So what you can do at that time is

you can just uh go back here sodom you

have a flag here you can just put hyphen

y and if you uh then install it then it

will not ask you it will not get into

this interactor mode. So it will take

this y flag y option automatically and

it will uh you know install the java

package. So that is what I wanted to

show you. That's what I want to tell

you. So that's how you install uh java.

Okay. So now I've just cleared the

screen guys. Okay. So the when you

execute this command in your Linux

machine and when you finished

downloading and installation of your uh

Java, what you got to do is you got to

set your environment variables. Okay. So

as it was written in the slide, you got

to give the pseudo gedit bash rc to

enter into the bash rc file and set the

enment variables here the path to where

your java is installed. Okay. So uh what

I'm going to do is uh I'm going to do

the same to and your bash rc is

something that will be present only in

your home directory. Okay. So you got to

remember to uh go to cd and from cd you

got to access that. You got to say sudo

gedit space dot bash rc. When you do

this, it'll ask you for the password.

But of course, I've entered the password

previously, so it didn't ask me. But

yeah, when you do that, you will open

this uh bash rc file. Okay, so right now

my java path is set to this. Okay, so

this means when during runtime when any

application is using or requesting for

java, then it will look for Java in uh

this path. So you just need to find out

where your Java has been installed in

your system. So it would most probably

be in your user/lib/jvm

folder. Okay. So let me uh go to the

same. So it'll be there under your root

directory. So uh if you uh go to your my

computer from your file system under the

lib folder we have various uh packages

that will all be installed over here.

Okay. So in my system it's all installed

over here. So this is the JVM folder and

inside here I have all the different

Java packages which I have downloaded

over a period of time. So guys uh in

this case supposing see I have Java

1.7.0 open JDK installed. Okay. Now in

your case you will have a Java 1 8.0

open JDK installed. So what you got to

do is you got to just right click on

that folder. Okay. Similar to what I'm

doing now. Okay. I'm going to right

click and just click on copy and go here

and paste the path over here. Okay. If

anything is existing already then remove

that and paste the new path. So the path

is nothing but where your JVM is located

from your root. So it's in root usr

library folder and then inside library

it's in JVM and here it's this is the

folder it's present in. Okay. And then

you got to also additionally give the

path to your bin directory. Okay. So you

have this is your bin directory. So what

you do is you right click on bin again

copy go to your dot bash rc. Okay. You

got to uh paste it over here. All right.

So this is how uh this is what you do.

This is how simple it is. So when you do

it, you just got to save it. And you got

to, you know, close this uh dot bash rc

file. And when you're done with uh

saving and closing it, just go back to

your terminal and you got to run this

command

source dot bash rc. Okay. So when you do

this, then your terminal will get synced

with the updated environment variables.

Otherwise, even if you don't run it,

it's fine. You can just start executing

your commands from a new terminal. Then

it would all be fine. But yeah, the

source.bass back is only to sync your

environment variables with this

particular terminal that is uh opened.

Okay, so that's how you install Java in

your uh system. Okay guys, so u I'm just

going to clear the screen now. Okay, and

I'm going to go back to my slides. Okay,

so I'm done with showing you how to work

with Linux repositories and uh the next

topic that I'm going to talk about is

that of uh tar files. So what are tar

files? Okay, so all of you Windows users

might be aware of uh this software

called Vinszip or VRA. Okay, what are

they? What do they do? They are

basically to extract your files, right?

So they'll be in compressed form and

you'll have to extract them. So uh in

Linux we have an equivalent format. So

in Linux it is either the tar file or

the gzip and the gunzip files. Okay, so

tar is the preferred option. So I'm

going to show you how to compress and

decompress a file with tar format. But

however even gzip and gunzip is

something that can be used if you want

to compress a files with the gz format

okay then you got to use this command

but however if you are going to

decompress it then you got to give guns

okay and the syntax is here okay but

however with tar you for both

compressing and decompressing you'll use

the same tar command itself so you'll

just have tar and in the arguments

there'll be a minor change so when

you're compressing the file you'll have

to specify hyphen c okay and when you're

decompressing the file, you'll have to

give the uh flag minus x otherwise it's

all fine. Uh the vi here stands for

verbos and the f here indicates that you

want to compress the file that is

mentioned followed by uh the command

here. Okay, so this f just basically

indicates that you got to compress this

particular file otherwise the uh colonel

will be wondering which file to compress

and it will throw an error to you later.

Okay, so that is what the xvf stand for.

These are the different flags that are

available with the star command. Okay.

Okay. Before I go and show you how to do

the start, let me show you a place where

tar files will be present. So in Linux,

right? So no matter what kind of

software you're downloading, whether

it's a Java package or if it's a Hadoop

package, if you're downloading them

manually from the internet, okay, then

you would get them in the tar format.

Okay? Or you might find them in uh TGZ

format. Okay? So tar is something the

most I mean I would prefer a few people

download tar because that's the easiest

uh it's easiest to extract and you know

also compress them. So I can just

download the tar file. It's very common

and you can just by just running this

one command you can compress the file.

So the Hadoop packages that are

available on Apache's website right that

would almost be around 2 to 3 GB but you

the compress format will only be around

100 or 200 MB. Okay. So same thing can

be said for uh something like Tomcat if

you're you know downloading the Tomcat

package or Nagios. So anything like

that. So those packages would have a lot

of MB and uh to download them you'll

need to compress them right. So because

the lesser you download the more uh you

save on bandwidth. So it's also easier

to transfer them in a compressed format.

So for transferring especially you use

the tar files. Okay, you compress them

into tar format and then later when

you're done downloading, you can extract

them and bring them to regular file

format. So, I'll show you how that is

done. So, uh first of all, let me go to

my terminal and uh let's go to the

documents folder. Okay. Um here I'm

doing an ls. We have this. So, what I'm

going to do now is I'm going to say

ls-l.

Okay. When I run this, you can see the

different files and the size. Okay. You

can see that the uh LMS folder right the

LMS folder here it has it's the highest

okay it's it's showing it's 4 40 496 MB.

So what we can do is I'm going to show

you how to compress this and convert it

into a tar file. So to convert it into a

tar file you got to say tar - cvf. Okay

x is when you're trying to decompress it

but uh cvf is when you're trying to

compress it. So you're going to say tar

- cvf and then here comes the uh tar

file name. So what you want to be the

name of the tar file. Okay. So I just

want to have it as lms do tar. Okay. So

this is the name of the file I want to

keep. So I will put that here. And then

you got to specify the file which you

want to compress whether it's LMS or

whether it's any other folder. So I want

to do it for LMS. So I can just say LMS.

Okay. And when I run this command then

this particular document would have been

compressed and it's present. Okay. So if

I do an ls now you can see that there's

an LMS folder and an LMS star file.

Okay. So this is the compressed version

of this folder. Now when I do an l ls

minus l command, you'll see that there's

a new tar file that's created. Okay,

lms.tar. And then you have this folder

whose tar file this one is. So that's

how uh simple it is guys. And uh what

you can uh do now is if you uh you can

just transfer this file over FTP or via

SSH or you know just upload this to your

internet and let people download this

because this is a smaller file compared

to this proper folder. Right now uh in

case you want to uh extract a file. So

in case you have downloaded this kind of

a tar file, okay, from the internet, how

will you untar it? What is the package

to uh know decompress it? So uh to

answer that question, I can we can give

the command tar- xvf and the package

name. So in my case, it's lms.tar. So

when I just do this and when I hit

enter, then that package would get

extracted. So now if I do an ls command

you can see that this particular tar

file has been extracted but you can't

see two different folders because uh the

existing LMS folder has been uh

rewritten okay so it has been uh well

let's just say it has been overwritten

and that's why you can't see two

different files but yeah as you can see

this was the process which was taken to

untar the LMS package okay so that's it

with respect to the compressing and

decompressing of files So uh let me

quickly go to the next topic in my

slide. Okay. So the next topic is that

of environment variables. So what are

environment variables? I told you that

we had to set the environment variables

in the bashrc file, right? While

installing Java. So what are they? As

the definition says here, environment

variables control the behavior of the

software packages installed in Linux.

Okay. The path where the packages have

been installed will be specified in the

environment variables. So if you're

installing Java okay and if there is

some other application which needs Java

let's take the example of Hadoop okay so

Hadoop is basically a Java framework

okay so the map produce concepts it's

all Java related and you need Java to

run Hadoop otherwise it will not run

Hadoop so by just downloading uh the

Hadoop tar file from the internet and

extracting that tar file is not enough

okay what you got to do is you got to

download Java also and uh set the

environment variables for both Java and

for Hadoop so In our case when Hadoop is

running because it's based on the Java

framework it would need Java to work

right. So at times it will ask the

runtime engine where is Java installed

so that I need some commands to be run

on Java. So at that time when the

runtime engine is asked that kind of a

question it will go to the environment

variables and it will look for the path

over there. Okay. So that was the

environment variables I was talking

about earlier. Okay. You go and set your

environment variables in your dot bash

rc file. And your dot bash rc file can

be uh accessed by going to your home

directory. From your home directory just

run gedit dot bash rc. Okay. And here

you can set your path. So if you've

installed Hadoop recently then you can

just set the path of Hadoop over here.

And if you've installed Java then you

can set the path of Java over here. So

basically whenever any other application

wants access to uh some program right?

So it can uh get access by looking at

its path from here. So that's what the

uh bash rc file is all about. Okay,

that's what the enamement variables are

all about. So uh that was about the

enamement variables and we have some of

the most common environment variables

are these. Okay, print env. So this will

basically list or prints the list of all

the enamement variables. Okay, all or

almost all the enamment variables.

That's what this will do. And then when

you say echo, you know, dollar home,

this will print the path of the home

directory of the user. So this uh hom

that you see here this is a variable

okay and uh the path of your home

directory has been specified over here.

So whenever you press cd on your

terminal right so it goes to the home

directory correct so that is the home

directory I'm talking about over here

and the path of that is what is set over

here. So when you say echo dollar home

like I told you earlier I showed you

that echo will basically print whatever

arguments you give it will print it to

standard output right. So when you say

echo dollar home it will print the path

of your home whatever stored in this

variable and similarly when you give

echo dollar path then it will print the

list of all the directories in which the

shell looks for commands. Okay. And all

those directories will be separated by

colon. Okay. So you'll have multiple

directories which you'll get as a result

and they will all be separated by a

colon. Okay. And similarly for host name

whatever is the name of your host of

your system. Right? That will be printed

when you give this because this again is

a variable and this uh is all set as

environment variables. Okay. And then

you have username your username will be

printed. So and when we say language

it's basically the uh the language right

in which the whole uh system works. It

can be either Chinese or it can be

English. So in our case, it will all be

English, right? So because we are all uh

working on English. So it'll all print

either US English or UK English,

something like that. And when you say

echo bash version, this will print the

version of uh this instance of bash. So

let's just go ahead and execute some of

these uh environment variables. Okay,

I'm just going to clear the screen and

go to cd. Clear the screen. And first of

all, let's uh put dollar or let's say

echo. when you give echo you have

nothing. Okay, I showed you earlier that

when you just put in echo and uh when

you say hi you will get high as return

the output will be high. So similarly

when you say echo dollar x right I set

the path of x to to 100 earlier. So when

when I say this right x I will get the

value of 100 now and similarly the path

of home will already be set. So if I

just give uh echo and u dollar path then

all the directories where the shell will

look for to execute commands those paths

will be present here. So scope is

located over here in this uh bin path

and separated by a colon we have the

next thing. So I have installed pig in

my system. So pig is installed here. Ui

is installed here. H is installed here.

Okay. And similarly uh if you see java

java is installed here. Okay. and Hadoop

2.2.0 Z that's installed over here right

and uh similarly there are all the

directories where your shell will look

for right they will all be specified in

uh this path so similarly you have

another command that is for uh home this

will print the home directory and my

home directory is home/reka

you can also alternatively

print your host name right so my host

name is localhost dot localadmin okay so

this is my host name right so my uh

basically My host name is local host. So

that's what's being printed here. And

when I say echo and follow that with

language, okay, with a dollar, then it

would print the language. So this is uh

using English, US English, okay, UTF -

8. So that's what this means. And in

case if you want to print the list of

all the uh enamement variables, then you

can just run this command print env.

So all the enamement variables uh that

are there in your system, they will all

be displayed here. Okay, so u that's it

with respect to environment variables.

Let me get back to my slides now and

continue with my session. So going on to

the next slide now I'm going to talk

about regular expressions. Okay, so

regular expressions or reg x they are

used to search through data. It can be

piped along with the grip command to

find patterns of text in the file. Okay,

now what this means is that you'll have

multiple different files or you know

multiple a lot of data in probably even

one file. Okay. Uh with the help of

regular expression, what you can do is

you can search for patterns of that

data. So you can use the GP to search

through data and you can uh use the

regular expressions to search through

patterns of data. That kind of a

pattern. Supposing you have a spelling

mistake in the middle. Okay. Supposing

the spelling of apple is a ple e. Okay.

And uh you know you might have made a

mistake in one of the files you have

saved it as a okay. and you're not able

to find when and when you're using Apple

AB you're not able to find that actual

string okay then it's uh you'll be

wondering why you're not able to find it

okay then you'll realize that okay it

may be because the spelling that I would

have entered in the file it's uh that

might be wrong by mistake I would have

entered a so in that kind of a situation

you can use regular expressions to find

patterns of text in the file so you're

all aware of uh the pipe I spoke about

earlier right you can use the pipe to

use one operations output as the input

to another operation, right? So you can

use that and you can use the regular

expressions with the combination of GP.

Okay, with the combination of GP

command. So you have uh a lot of regular

expressions and uh the most common of

them are these. Okay, so the dot here it

basically means it can replace any

character. Okay, it can mean any

character the dot. So and then you have

the carrot symbol here. So the carrot

symbol here, it basically uh matches the

start of the string. Okay. Now what that

means is let me give you an example.

Supposing you're doing a cat file.xt.

You're looking for some kind of data

inside this filone.xt and you're using

the gp command to search this data. Cat

will basically list down all the uh file

contents. GP will search that data. And

how will it search? When you give a, it

will just display you know all the lines

or all the words where a is present. But

when you give carrot a, it means that

the starting of the string starts with

a. Supposing I have uh three different

lines or three different strings in my

uh document in my file 1.txt. Okay.

Supposing I have uh abc uh a fg and uh a

df. Okay. And if I uh give character a

then the result that will be out would

be uh given given back to me is those

three lines because those three lines

are starting with the character a. So

that's what this character means. It

matches the start of the string. Okay.

So that's about carrot. And similarly,

if you want to match something with the

end of the string, you can use the

dollar symbol. And supposing you know

that this particular word or string that

you're searching for, it ends with XT.

Okay, in that case, you can uh put XT

and then you can uh suffix that with a

dollar. Then all the strings in that

particular file uh you know which are uh

all the all the strings in that file

which are ending with XT, they will be

displayed. Okay, so that's how you can

search for data. And uh similarly if you

give asterk uh asteric basically means

that the character that is uh you know

preceding the preceding character is it

matches zero or more times. So let's

take an example of this. Okay. Now in

this case we have u in front of the

asterk. Okay. So the asterk basically

means preceding character matches zero

or more times. Supposing I have two

different strings in my file. Okay. One

string is abc and the second string is

uh d e f. So then comes the asterk.

Okay. So when you give asterk, it

basically means that the uh preceding

character it occurs zero or more times.

But uh however if you give a question

mark it means that the character that

that comes preceding before the question

mark that appears exactly one or it can

appear more times. Okay. And then you

have uh you know these brackets here

which can be used to group these regular

expressions. Supposing you have you know

more than one or two regular

expressions, you can use them to group

them. And uh again the uh backslash here

it represents special characters. Okay.

So let me uh just run a couple of

examples of uh this for you. Okay

let me go to my terminal and go to my

home directory. I'm going to clear the

screen. I'll go to

documents. Okay. So in here I have my

three different text documents.

Automobiles file one and file two. So if

I uh do cat and automobiles txt then I

have a list of uh all these uh strings

right I have a list of all the cars and

bikes and the different uh automobile

companies. So what I'm going to do is uh

I'm going to say cat automobiles txt and

I'm going to use a pipe. I'm going to

use a grip command to search for strings

starting with the letter a. Okay. So if

I give a then all the strings where

there is a present that will appear.

Okay. Now first let me show you without

the regular expression. So when I give a

then these are the strings where a is

present. Okay. Uh however if I uh give

rep

then it will list down those strings

where a is not present. Okay. So you

might see a present in these two things.

But the truth is it's looking for small

a. Okay. If you want case insensitive

searching then you can just use uh I

also all right so uh you can see as you

can see from here in these four strings

a is not present right so that kind of

uh searching is what we need to do so I

can use a regular expression to search

for those strings starting with a

particular character okay by using the

carrot command so in uh if you take this

example so these are the list of strings

in which a is present right so in here

where is a starting okay so a is

probably starting only in uh this one

particular uh string. Okay, but maybe

also over here but because I haven't

included the in case insensitive. So

what I'm going to do is I'm going to

remove this v once I'm going to print

it. Okay, I'll just do a control l and

execute it again. So now if you see uh

all the strings where a is present

whether it's a capital a or small a

those will be listed here. Okay. And now

I can use a regular expression to uh

basically filter out those letters or

those strings which are starting with a.

Okay. By uh specifying this command.

Okay. So I have to ideally get the

answer I should get is Aprilia Audi and

Amber. Okay. So when I hit enter, okay,

so uh there's a space here. So that's

the problem. And as you can see uh it

says that there is no string that's

matching with this a. Okay. Now that's

because I removed the hyphen. Okay. I

removed the hyphen I which stands for uh

case insensitive searching. So it

basically returns that uh it's not

returning any result here. So that

basically means the there was no search.

But however if I add hyphen I okay

hyphen I and enter then I will get these

three as my results because I've added

the case insensitive searching here. So

did you all guys get this concept here

of using regular expression of uh you

know this is carrot. Okay this matches

the starting of the string. Now I can do

something similar. I can search for the

end of the string. Okay. Now let's see

again if I use a itself and if I give

dollar then it will look for all the

strings which are ending with a. Okay.

So uh that's happening because of uh

this problem. The whole dollar a should

come inside brackets. Okay. I should be

in uh quotation marks. So that's the

thing. So when I do this I'm not getting

any result. So u similarly I can uh

execute another uh command. Okay. So

another one involving regular

expressions of asterric. So what I'll do

is I'll say gp - n let's say I want to

search for the character a itself. Okay.

So um when I say a in asterisk so it

when when I use this asterisk it

basically means zero or more occurrence

of a. Correct. So I'm going to search

for that from uh here and then I have to

specify the file name over here. So I'm

not using any cat command and I'm not

using a pipe to get data in over here.

Okay. So I'm just going to display the

number of times that happens by

specifying the file name here. I'm going

to say automobiles.txt. When I hit an

enter, I get all the occurrences where

zero or more times a is occurring. Okay.

So that is uh one aspect. And uh the

other command that I can show you is

that of respect to echo itself. So I can

run an echo inside flower brackets. I

can say a to z. Now when I print this,

okay, sorry there should be just uh two

dot symbols. So when we say two dot

symbols it basically fills the

characters the sequence of a b c a ab a

ab a b c e f g h uh you know the entire

alphabetical sequence that will happen

as you can see so that's because there

were just two dots specified but had

there been three this wouldn't happen

okay it would just display this whole uh

thing again so the thing you got to note

is that the regular expression that we

are using here is this one two dots okay

so similarly you can replace it with

even numbers so we can have 89 9 and you

can say 33. So from 33 to 89 all the

numbers will be uh you know the sequence

of the numbers will be present here. You

can also have a combinations like you

know I can have uh say p over here and I

can have an a over here. Yeah when I do

this the combination of a with all of

these uh numbers would be visible. So as

you can see so a 33 p a 34p so things

like that right so patterns are also

being generated. So that is the

advantage with some of these uh regular

expressions. Okay. So I'm just going to

clear the screen now and uh go on to the

next topic. Okay. So we are done with

regular expressions now. And uh this

takes us to the final part of uh this uh

Linux demonstration. Okay. This Linux

webinar. And here we're going to talk

about processes adding users and SSH.

All right. So let's get started. Okay.

So um guys processes is something that's

really important from the administration

uh perspective of Linux. Okay. Well it's

I mean it's basically something that's

necessary not more than you know uh an

important thing. It's was basically

necessary. I mean uh you should know

what this is and when I say processes

I'm pretty sure that you know that we

are talking about the programs or

instances of programs right? So uh

anything that you start on your uh

system so whether you're starting a web

browser or whether you're you're using a

media player so everything every

software there it will have a process

involved okay there can be multiple

instances of that particular project uh

supposing I'm viewing a presentation on

my uh computer okay supposing I'm seeing

five different presentations at the same

time I mean I can see only one at a time

but I can have the remaining open and I

can put them in the background right so

uh that's what we mean so the different

instances of that particular system can

also be considered as a process. So at

any point of time only one application

or only one process will be in the

foreground. Okay. But many such uh

instances of many softwares or also of

that particular software or program can

be present in the background. Okay. So

the example of that is uh me opening uh

two chrome browsers. So I can have two

different chrome windows and uh you know

one can be in the background, one can be

in the foreground. Okay. So similarly

PPTs or whether it's uh a media player

anything like that. So that's what a

process is. Okay. Now going back to

definition an instance of a program is

called a process. All right. Any command

given to the Linux kernel starts a new

process. And there can be multiple

processes of the same program. There can

be multiple processes. When we say

processes it basically means instances.

So we can have any number of instances

of any of your application right of

chrome or of VC media player of all

those things. You can have multiple such

uh instances at the same time and all

these instances are referred to as

processes. Okay, official term is

processes and each of those processes

have some process ID. Okay, so uh yeah,

like I told you they'll be divided into

two different processes. One is the

foreground processes and the other one

is the background processes. Okay, so um

how will you determine what are the

different processes that are running in

your uh system in Windows? You can just

do control altdelete and then you'll uh

get the list of programs, right? And you

can even terminate them. You can end the

programs from there, right? So you have

different tabs. So let me show you an

example of that. Okay. So this is my

Windows system. Okay. And when I do

control altdelete, it starts my task

manager and it asks me for applications

or processes and all these things. So

this is the process that I'm talking

about. Okay. You can have any number of

processes in running in your system.

Okay. You might not be aware of all of

those things. So yeah anyways uh some

may be started by you and some may not

be started by uh you right some may be

started uh at system boot and some of

those uh processes might be started by

you when you're running some command so

that's what this is so every time you

specify uh you know a command in the uh

terminal or the kernel that will boot a

program or a software and that will also

alternatively start a process okay and

every time you start it you will have a

new process defined and if you want to

see the list of all the processes

running in your system then you can use

this top command. Okay. And what you get

followed by that will be the list of

processes and their P ID their user

username their uh priority all these

things. So I will talk about all these

aspects in sometime. So let me first

show you the different things and how

they look in the uh Linux in my VM.

Okay. So I'm going to run here. I'm

going to run the top command. And when

you do that you can see that you have

something called as P ID. you have user,

you have uh PR, you have a whole taskbar

and you have with respect to which

software is running, which program is

running, what is the application name

and all these things. Okay, so right

here uh you can't probably see anything

that I have created on my own. Okay,

except for this uh virtual box client

and maybe the terminal. Okay, but if you

want me to create one, then I can also

create one. So what I'll do is I can

just uh end this here by pressing Ctrl

C. I can get out of this uh top and what

I'll do is I'll create a Firefox

instance. Okay. So Mozilla Firefox is

installed in my system and through my uh

terminal I will start Firefox. Okay.

When I hit enter my Firefox has been

initiated. Okay. See now I did not make

any change. Okay. I did not touch the

Firefox icon but instead of that on its

own Mozilla Firefox opened. That is

because I hit Firefox and I put enter in

the terminal. So when I did that the uh

Firefox opened. Okay. Now I can just

minimize this and if you go back to the

terminal you'll see that I'm still

inside uh you know the terminal is

assuming that I'm still working on

Firefox. Okay, I've still not ended

Firefox over there. So when I uh when I

close Firefox that's when I'll come out

of the terminal over here. But instead

of doing all that I can simply do Ctrl Z

or control W. Okay. When I do Ctrl Z it

means that I'm stopping my Firefox

instance. Okay. So whatever Firefox

browser that was open that is stopped.

The process however would not be

stopped. the process would be running in

the background. Okay, now supposing I

want to push it, if I want to bring it

to the foreground, I can just say FG and

I can give uh Firefox. Okay, this will

again uh initiate Firefox for me. But

otherwise, I can just uh you know close

it and I can push it also to the

background. I can say bg and I can say

Firefox and if I give enter then my

Firefox has been pushed to the

background. So now uh what I'll do is

let me run that top command again. And

if you see over here the Firefox was not

visible. Okay. But since I started and

pushed my Firefox to the background and

all since I've done all these things, my

Firefox will be visible in this list of

processes. Okay. Now seems like I've

sent it to the background, right? So

that's why it's not coming. So let me uh

hit Firefox again. And it's opened the

uh terminal now. And what I'm going to

do is uh of course it's in the

background. So I'm going to run the top

command again and show you that Firefox

is here. Uh so we have the Firefox here,

right? As you can see there's a Firefox

process that of course keeps moving up

and down and uh it's all sorted by the

priority that each process has. Okay. So

u yeah so every single uh instance or

every single program or application that

you start right so they will be started

in this way and they will have a process

ID associated with them. they will have

the time for how long they've been

instantiated. They'll have the CPU

memory they're using, the virtual memory

they're using, uh, and all these things.

Okay, so let me explain each of these

things by going to my slide first. So if

I go back to my slides, okay, as you can

see here, these are the different blocks

that you saw earlier. Okay, on the uh

terminal. So the first P ID stands for

the process ID. So each process that is

initiated, which will have a unique

process ID, okay, and the user here is

uh the name of the user who started that

process. And PR is uh refers to the

priority of that process because uh

every process that is running in your uh

Linux it'll have a priority associated

with that. Okay. And the greatest

priority process is what will be

executed first and that'll be executed

at the top. And then so along with the

priority of that process you have the

niceness value. So niceness value is

again you know the value ranges from

minus 20 to + 20 and even the priority

value it varies from minus 20 to + 20.

Okay. So basically the nicest value is

uh somewhere it's opposite to priority.

Okay. So the lesser the nice value the

greater will be the priority of your uh

process. You can also manually set the

niceness value of your uh process to

increase the priority if you want to

give a particular uh program or a

particular process more priority. Then

you can probably decrease the niceness

value and uh that will lead to the

increase in priority on its own. So

that's what this is. And then after that

you have uh this VRT block. Okay. So VRT

stands for virtual memory. RS stands for

the physical memory. SSR stands for the

shared memory. S is the status of the uh

process. So that's what S is. So S

speaks about the status of that

particular process. Okay. And then

percentage CPU is it is about the

percentage of the CPU time. Okay. And

percentage of the memory of the physical

memory that's being used. Okay. And then

you have the time block which uh refers

to the total CPU time that this process

has been running for. And then finally

you have the command. Okay. And then f

and then after the command you'll have

the process that is uh actually running.

Okay. So um let me just quickly go back

to my thing here. So the command is

basically the uh application that's

running. Okay. So yeah that's about the

different processes. I'm just going to

end this uh top by giving uh control

zed. When I give control z uh this stops

and I can just clear my screen. So

that's about my processes. Okay. Now uh

I showed you how the top command works.

Okay. Now along with that if you want to

see the list of all the uh processes

that are running okay then you can see

that by running this command ps uh

hyphen uh space ux or uh you can do this

or you can even run ps- p. So when you

do that you will only get the list of

processes that are uh you know being

started by you. Okay. So you're the user

I'm the user and my name is Eda right?

So all the uh processes which I have

started right. So all my processes will

be visible. Of course uh uh the other

user's process will not be visible to

me. It will be only visible for him.

Okay. So I can also give uh P ID

otherwise PS I okay the PS UX it

basically displays the process that you

have started. Okay. So you any any

program or anything that you have

started that you can uh see it here. You

can see you know what is the percentage

of the memory that's being used because

of that process. What is the process ID

for that particular process and all

these things. Okay. So uh similarly if

you have uh you know anything else. So

that's what uh this command does. Okay.

The next thing that I want to tell you

is that of finding the p of a particular

uh process. So you know that we've

started uh a particular process. Okay.

We started the Firefox process that

time. And what I can do is I can find

out the uh P of that particular process

by giving this command P off and uh what

is the name of the process? Uh so in my

case it's Firefox. So I'm just going to

give P off and Firefox. That will give

me the P ID of that particular uh

process 5836.

Okay, I'm going to clear screen. Okay,

I'm going to run the process again.

Okay, I'm going to start Firefox again.

And when I do this, there is a new

instance of Firefox that starts. Okay,

so a new process would have started by

now. And uh when I just give control Z,

I'm kind of stopping my process. And uh

now if I give ps- ux then you can see

here that there's a new firefox process

that starts that's running. Okay the ID

is 660. Okay you can verify that by also

giving uh by seeing what is the answer

that I get f P I of Firefox. When I do

this I get 660. So that is uh what this

is all about. Okay. And if you see the

status it's also showing as TL. Okay.

This means that I've uh terminated that

process. Okay. So process of Firefox has

been instantiated. It has a P of 660.

Okay. And uh you know if I want to kill

this process then I can give the command

kill 60060. All right. Great. So that's

about the different process that I want

to talk to you about. Okay. So um what's

next is uh let me go back to the slides

and talk about the next topic. All

right. So I spoke about uh processes

here.

And uh the next topic is uh this is the

penalty topic actually and I'm going to

tell you how to create your own users.

So you can uh create users by this

command simply saying uh sudo user ad

and the username. Okay. If you want to

set password to that person then you got

to say password and uh the username of

that password and then it'll prompt you

to set a password for that person. And

similarly if you want to delete that

particular user you can say user delete

and then uh the name of that username

whichever you want to delete. Okay. Uh

but one thing is that you got to always

use pseudo before that because uh these

commands cannot be executed by users

like us. Okay. We need root access for

that. We need only root users who have

super user permissions can do this. So

that's why we use pseudo and we enter

the password for it. Okay. Now one thing

you need to note is that when a user is

created then by default he's also added

to a particular group. Okay. There'll be

sometimes there'll be a default group to

which that person will be added. And if

you want to add a user to a particular

group, then you can uh just do that by

using the user mod command. Okay, you

can say user mod G uh G represents the

group and then you can say the group

name and the username. So the group name

that you want to set and followed by the

username of uh that particular person.

Suppose you want to add your own groups

then you can do that by group add and

group name and then if you want to

delete them it's again the same thing.

Okay, after this process then again you

can uh assign them a different group.

Okay, so let me just show it to you on

my terminal. Okay. So the first command

is adding a user right. So before

anything let me just go to system go to

administration and uh user in groups it

asks for a password. Okay I'm g okay

when you go there you see that there are

two users currently. So Edka and Uzi. So

these are the two users and in groups

again there are Eda and Uzi. So there

are two groups here also. Now if I want

to add users I can add it from here.

Okay. I can just I can click on add user

and I can give the username. I can give

the full name, password and all these

things from the GUI. But you know the

CLI is a more simpler version where I

can just supply a command. Okay. So I'm

going to say user ad space uh I can give

the name of the user. So if I want to

create a user for myself, okay, I can uh

give this name user user ad B. Okay, but

of course it's not going to work because

it would say we need pseudo access

permission denied. Right? So what I'll

do is I'll u give pseudo access. It asks

for the root password and when you give

the password you don't have any

arguments. So that means your user has

been created successfully. So if you go

back to system and administration and if

you go to uh user and groups you'll find

that there's a new user that's added and

the user ID is 5.2. Okay. Now let me

just minimize this for now. Uh similarly

if you want to set a password for this

user because right now it might not have

a password and if you want to set a

password then you got to run this

command pseudo password and the

username. username is uh var. So I'm

going to do this. Hit an enter. It'll

say changing the new password for the

user. Okay. And uh let's say the new

password is uh this. And it'll say

retype the new password. I can give it

here. And then the tokens are updated

successfully. Okay, password is updated

successfully. So that's what uh this is

all about. So if I go back to this uh

user window and if I click on ven then

you'll know that uh there's a password

that's been added over here. Okay, this

is what I added from here. And you'll

also notice that there's a new home

directory that's created for that

person. So all these things right. Uh so

that's about creating a user. Suppose

you want to create a new group then uh

how will you do it? Uh similarly just

say group

add. So I'm going to say uh pseudo and

then enter this. So the group has been

added successfully. And if I go back to

it's under system under administration

under users and groups if I go to groups

now even inst is something that's

created. So this van is something that

got created now because as and when you

create a new user right when you create

a user without uh you know by specifying

any any group then automatically is

added to a group. So a group is created

automatically when a user is created and

it is the same as the username. So

that's how this got created. But anyways

this is the new group. So I'm just going

to do Ctrl L and uh same way if you want

to delete any users uh it's again a very

simple process you can just do a pseudo

and uh user delete and the name of that

user okay if I want to delete Van then I

can uh do this yeah so I'm not able to

delete it right now because Van is

currently logged in so if I just log off

from this VM and if I uh log in as van

and log out from there and then as a

root if I execute this command then I

would be able to uh delete this uh user

and the command is is very simple Simple

this is the command and you can all try

it at home. All right. And similarly if

you want to delete any group u again the

uh command is uh simple it's uh group

delete and then the name of the group

that is uh ins which I created. So if

you do this the group has been deleted

now. Okay. Yeah as you can see now inc

is not visible. Okay. So that was uh the

previous window I hadn't refreshed it.

So now if you see inc is deleted. So

that's how you delete the group and

that's how you uh delete a user. All

right. So that's that brings us to an

end uh to this topic. So I'm just going

to clear the screen and u what I can do

is I can just uh go back to my slides

and get started with this final uh slide

of mine. So guys uh this is the last

topic for today that is the the secure

shell. Okay, it's also called the SSH

and this is for gaining remote access of

a system. Okay. So uh you can get access

to a system which is remotely located.

So without you physically accessing that

system you can get access through this

SSH server. Okay. So that's what the SSH

does. Okay. It's called secure shell.

The connection is called uh secure shell

connection. So uh all the other topics

in this uh session right today's session

they were all basic stuff which any user

could learn. But uh this one this SSH is

something a little it's a little

advanced and this is and this is with

respect to networking. Okay. You know

it's a thing that people would look

forward to. Okay. So, if it's uh you

know, if you guys are waiting for a long

time and if you're feeling bored in the

session, then uh this is something

that's going to be a little more fun.

You're going to do something real time

and you're going to see something

incredible happen here, okay? By pinging

and accessing some other machine. So,

first of all, how does secure shell

work? So, we have two different uh

systems, right? But in my case, it'll be

two different VMs. And uh in general,

it'll be two different uh systems which

are remotely located. And you can get

access to them by the help of this SSH.

And uh how is that possible? By setting

the IP address and all those things,

right? You set the IP address and in two

different places. You set one system as

the master and you set the other system

as the slave and uh you basically what

you do is you have something called as

the ATC hosts. Okay. So you go to this

uh file and you set the master and the

slave IPs over here. Okay. You'll have

to set up this IP for uh the master and

this IP for the slave machine. And then

you can do the if config or the IP adder

show to list down the uh IP address of

that particular machine. So if it's uh

something other than what you want to

set then you can just uh do that by

deleting the existing IP table running

this command in both the machines and

then to add an IP address to that

machine you can run this command. So to

IP adder add and the IP address you want

to add. Okay. So remember to uh set the

mask for that and when you enter this

command this particular IP address will

be set for that particular node. Okay.

So that will be the master's node and

set this IP address for the slave node.

Okay, the command will be the same but

before that you got to delete the IP

address the existing one by this command

and then add the new IP address uh at

the slave end with this command and then

uh simply just type SSH master or SSH

slave. Okay. So when you do that uh your

secure connection would be established

and you if you see the username then

you'll realize that okay you're logged

in into the different uh system. Okay.

Uh that's what I want to show you now

and that's what I'm going to uh do it.

But before that you might have uh some

problems like firewalls and stuff for

that. Okay, if you have a firewall you

can still set up an SSH connection.

Okay, but the problem is you'll have to

generate RSA key and all. And I don't

want to do that because it's a little

more complicated. And since you people

are beginners, I just want to show you

by turning the firewall off. Okay, and

to turn the firewall off, what you got

to do is you got to drop the IP table.

Okay, it will just stop your IP table

and this command will permanently

disable your IP table. So this is with

respect to Linux. So when you do these

two things then you can get started. All

right. So u let me go to my uh VM and

show you what are the two different

machines that I will be pinging to. Okay

as you can see. So this is uh the VM

which I was working on. Right. So let's

say cancel and I'm just going to

minimize this terminal. Okay. And let me

just close every other uh file and

folder. All right. This is my terminal

that's minimized. So if you can see here

you have something called as master

written. Right. So this is the uh master

machine. And if I go back to my virtual

box, you can see that this is the

machine that's already running. Okay.

Now this is the slave machine which I

will ping. So I need to instantiate this

slave machine also. And even when you

are pinging two different machines, two

remote machines or two machines in the

same VM, then what you got to do is uh

you know you got to turn on both and you

got to set the IP address in both the

places and then you got to ping them

from there. So let's just wait until the

slave opens. All right. When it's

launched, we can uh start with our

commands. But in the meanwhile, I can

just go to my master terminal and uh I

can go to the terminal and start

executing my IP tables. Okay. So, uh let

me check if my connections are all

running. Let me click on this. Okay. Now

that both my uh network connections are

on. So, what I'm going to do is I'm

going to say if config. Okay. So, when

you do an if config, you get this kind

of an output. Okay. So, your F0 is uh is

your NAT address is your network address

translation. Okay. and your F1. In my

case, it's F1. But uh generally you

people will not get an F1 because this

comes when you're running a VM. Okay. So

I have set up a bridged adapter. Okay.

Host only adapter actually between my

two VMs. So I have a master VM and a

slave VM. Right. Yeah. Since there are

two VMs in the same machine, I need to

set different IP addresses for both the

VMs, right? So that's when F1 comes into

the picture. Otherwise, in your case, if

you're running running Linux and if you

run this if config tab, then you will

not get F1. you'll only get at 0 or

you'll just get one option you'll get ln

not and you'll get at zero. Okay. And uh

this lnot basically represents the uh

entity address. Okay. So this 10.0.2.15

this basically is your IP address which

you need to use to connect to the

internet. So if you don't get an address

over here then it means you're not

connected to the internet. Okay. So

that's what uh this means. And right now

my uh F1 address is 192.160.56.2.

Okay. And similarly, if I go to my slave

VM, let me just log in here first. As

you can see from here, it's a slave VM.

And if I launch my terminal, what I'm

going to do here is I'm going to run the

command if config again. Right? So,

right now, it says that my uh okay, I

don't have a NET address. Okay, my uh

network is not connected. Okay, I have

F1 connection and that is 192.168.56.2.

Okay, but my N address is not set. So I

think I'm disconnected from the

internet. So what I'm going to do is I'm

just going to click on system f0. And

when I do this, I'll be connected to the

internet now. And I'm going to run this

command again. And uh now if you see I

have the uh NAT address. Okay. So this

is my network address 10.0.2.15.

And in in case of my master VM 10.0.2.15

was again the NAT address. Okay. It's

the same but however the one would have

to be different. Okay. I mean whether

it's different or not I need to change

my uh F1

but now what matters is I need to ping

my slave from my master right so I need

to drop whatever IP address is there

right now so if this is the IP then I

have to drop this IP so even in your

case by default there will be one random

IP address you can drop that IP address

by running one of the commands which I

showed you in my slides I'll show you

that again similarly you got to do the

same thing at even your master's end you

got to drop the IP uh with the F1 IP

address and when you when you've done

that you can set your new IP address so

you will be setting two different IP

addresses one for your master and one

for your uh slave okay you'll be setting

one over here in this VM and you'll be

setting one over here and uh that

address will be over here okay so I'll

make my slave as 192.168.56.3

okay so I'll drop this one and I'll

update it as uh3 and in fact master can

be the same 192.168.562

can be the you know the IP address of my

uh master slave. Okay, so I'll use these

two things and once I add these two IP

addresses to the ATC/hosts file, then I

can start pinging them. Okay, I can

start pinging them and I can get remote

access to them. All right, so what I'll

do is I'll first clear the screen and

I'll go to my slave and again I'll do

the same thing. I'll I'm going to clear

the screen now. So going back to my uh

VM, the first command that uh we got to

run is we got to drop this particular IP

address. So to delete the IP address, we

have this command uh sudo IP adder

delete and then whatever the IP address

is. Okay. So here uh this was the IP

address, right? I want to drop the F1

address. So what I'm going to do is I'm

going to put this here. I'm going to say

dev F1. Now when I hit enter, this

particular IP address will be dropped.

Okay. Okay. This is the password. Okay.

Now if I again run if config you can see

that I don't have an H1 address. That's

because I dropped it over here. Correct.

Let me just show it to you. That's

because I dropped this particular

address. Okay. Now similarly let me run

the same command in my uh slave also.

The command is IP adder delete. The IP

address over here is u 192.168.56.2.

Okay. So this is the same here also. So

I'm going to just uh paste it here and

say dev1

when I give enter. Okay, I need to give

pseudo. So that is a problem. So I'm

going to give pseudo IP adder. It asks

for the password. There you go. And uh

yeah, my IP address has been uh

discarded. Okay. Now if I again run the

if config, you can see that F1 again

does not have any IP address. Now what I

need to do is I need to set my own IP

address over here. So let me first set

the IP address over here itself in my uh

this uh slave VM. So to uh add the IP

address the command is almost the same

except that instead of delete you'll

have to put add okay and uh you'll have

to specify the IP address you want to

set. So I want to set 192.168.56

1.2

okay I'm going to say that 102 and then

I need to give a mask. So if you

remember I told you that we need to give

a mask. So it'll be /24 or let me give

103 because this is the slave right I

can give 13 here 103/24

when I give enter the IP address would

have been added. So if I do the if

config now you can see that f1 has this

address 192.168.56.13.

This is what I added some time back.

Right? This is what I added here. Now

similarly I need to go back to my master

VM and uh I've deleted the uh IP address

from here. I need to add the IP address

here the new one. Okay. So the command

is add 192.168.56.1.2/

the mask. That's 24. Give enter. Okay.

Now let me check the if config. As you

can see the uh IP address for my F1 is

there. It's up and running now. It's

192.168.56.1.2

do over here in this case. Okay. Now

I've uh now that I've done this uh

there's one more important thing that I

need to do. I need to add my IP

addresses to the etc/hosts file which

indicates to both the VMs where the

master is and what is the IP address of

the master and what is the IP address of

the slave. Okay, now that I've added

this one. So let me just uh copy this

address. I'm going to copy this and I

need to set this address of the master

and similarly the address of the uh

slave in the etc/hosts file. Okay, how

will you access the EDC/hosts file? You

need to first go to your uh home

directory and from here, okay, let me

clear the screen. Home directory. So

here you got to give sudo gedit

/c/hosts.

Okay, when you hit enter, you'll open

this file. Okay, this file is called

hosts/c file. So in here, you know, I've

already set my IP addresses. Okay, now I

can just delete it for names sake and I

can just copy paste what I had copied.

So it was 192.168.56.12.

This is the IP address of the master

which I wanted to set. Correct? If you

see here, this is the IP address that I

added now. And I'm adding this IP

address 2 to the host. I'm going to add

that as master. And similarly, if I go

to the uh slave, the IP address is 192

168 56 and 193. Okay, now I need to go

to the EDC file and uh since that is a

slave, I got to set the IP address for

the slave. And of course, you the slave

IP already set, but I'll just uh update

and save it anyways. I'm going to save

this and I'm going to close this. Okay.

Now, uh similarly, I need to go to the

uh slave VM and set these two IP

addresses. Okay. Now again the command

is go to CD and uh go write sudo gedit/

EDC/hosts.

Okay. So here also the IP address is set

to 102 and 103. Okay. Now this is the

slave VM and the IP address of this

machine is 103 and the master is 102.

Okay. That's the other VM. So uh I mean

it's the same. So I don't need to make

any changes here. I'm just going to

close this. Yeah, I can just close it

without saving. Now, uh now that I've

done this, I can straight away start

pinging or get SSH connection. Okay, I

can just say since this is the slave, I

can say SSH space master. Now, since

I've added the IP address of the master

in the uh host table, I don't need to

specify the IP address of that

particular system. I can just say SSH

master. And if I put enter, then it'll

ask me for the master's password. And

the other VM's password is what I'm

going to put here. And when I put enter

as you can see I'm logged in now. So the

password has been entered and uh you can

see the last login here. Okay. So the

last time I logged in was on uh this

date and I had logged in from this slave

itself. Okay. From this particular VM

itself. So um to prove that this is the

actual master what I can do is I can uh

just go to cd and I can do an ls

command. Okay. I can go into any of

these desktop or the downloads or the

pictures uh folders. Right? because I

made quite a few changes in my master

slave. And from the master slave is

where I showed you the earlier uh files,

right? I created the automo.txt, the

file 1.xt, the file 2.txt.

Okay, if you can remember, then my

documents has uh these contents. Okay,

it has folder one, it has automoils. TXT

and all these things. So I can just add

the same to my slave. So I can just

navigate to desktop and if I do an ls I

get the list of all these things. Okay.

So as you can see there is uh the

automo.txt and the readme file in my

downloads folder. Okay. Now let me go to

my uh master. So in my master if I go to

downloads I have these two files. Okay.

So this is what I mean when I say remote

access. So these two VMs are

communicating with each other such that

the slave is accessing and it's running

commands inside the master and whatever

is visible over there I get access to

here. Supposing you want me to uh you

know open another file. Okay. So the

music folder has these three files

right. So I can access these also. I can

just say cd and go back one path and say

I want to smooth change to music. So

when I go here and I do an ls I have

automoils.xt

file 1.xt and file 22.xt. Basically

these three text files are present in

the other VM in the other machine. Okay,

they are present over here. However,

they're not present in this machine. If

you want me to prove that they are not

there in this machine, then I can just

minimize this. Go to uh in the file

directory, go to music. Okay, it's

empty. So this basically means that I'm

accessing the master VM from this slave

VM. Okay, alternatively, you can also

check the downloads folder. There's

nothing here either. So yeah, that's how

we log into the remote machine. And in

my case, I've logged into slave from my

machine. And I have accessed these

folders. Okay. I can also view these uh

contents in this folder by going to cat

automobiles.txt. And when I hit enter,

whatever uh data set that I created

earlier in the session, right, couple of

hours back. So those are visible over

here. Okay. So that's it. So another

thing is that if you want to exit from

your master's machine, right? If you

want to exit your SSH shell, then you

can just hit exit. Okay. When you hit

exit, it says uh log out. Okay.

Connection to master is closed. So this

shows that now we are back to your own

VM. And now if you uh try going to CD

and if you go to music or something

you'll not find any documents or any

folders in that particular directory.

That's because this is your VM. This is

the slave VM. And similarly I can just

uh you know from my master's VM also I

can get access to the slave VM by just

uh typing in SSH and slave. The password

is uh this and this is the last time

that I was logged in and u I'm here.

If I go to CD music and if I do an ls

there's nothing available here. Okay,

that's because uh the slaves VM does not

have anything in the music folder or

anything in the documents folder. So

that is the reason. Okay, and similarly

I can exit from here by giving this

command exit. It says uh it's logged out

and connection to slave is closed. Okay

guys, so this is uh about the SSH and um

this is about the secure shell

connection. There is something called as

the RSA key. Okay, that is something

that'll get generated if there is a

firewall. So in my case, I have blocked

my firewall by dropping the IP tables.

Okay, so the command to drop the IP

tables are this one. They are service IP

tables and stop. Okay, this will drop

the IP table temporarily. And if you

want to permanently disable the IP table

then you can just run the command p sudo

uh check config and IP tables off. So by

doing this your uh firewall will be

turned off and you can use the SSH

connection in the way I showed you.

Okay. Now this is a very simpler way but

in case of a real scenario okay where

the machine is located remotely where

you cannot actually disable your

firewall. Okay. Because firewall is

important to block any unauthorized

access right. So firewall is important

to be enabled. So in that case if you

want an SSH connection to be present in

spite of a firewall then there is

another procedure where you have to

generate an SSH key right an RSA key

from the master's end and set that key

at the slave end so you have that kind

of a process and uh that is something

that's a little more complicated than

this and of course that I can't show you

now but I promise to show you that in my

uh next Linux webinar okay so if you

guys promise to come back and visit me

in that webinar then I can promise you

to uh show it to you there. All right

guys, so uh I'm uh hoping that it's all

fine. I'm hoping that you people

understood the concepts here and u it's

been a good session. It's been pretty

long but it's been worth it right. Uh

basically u Hmon who's new to computer

science he says that you know he's got a

lot of you know he's understood Linux

well and uh yeah he also says that he's

going to install CentOS. Okay, that's

good because even this was CentOS. Maybe

this is why you want to install CentOS

but don't just keep yourself restricted

to this CentOS. Hmon you can also

install Ubuntu and find out which one

you like. So see I like CentOS and uh

this is my preferred Linux distribution.

Okay. So I recommend everything Ubuntu

and CentOS to you. You can install them

and uh you work on them and you will

only figure out which is better for you.

So let's talk a little bit about the

kernel and the shell. So what is a

kernel? Now the computer programs that

allocate the system resources and

coordinate all the details of the

computer's internals is basically known

as the kernel. Now the kernel is the

heart of any operating system. It

interacts with the hardware and most of

the tasks like memory management,

taskuling and file management. Now users

communicate with a kernel through a

program called the shell. The shell is

that utility that processes your

requests. When you type in a command,

basically at your terminal, the shell

interprets the command and calls the

program that you want. The shell uses

standard syntax for all commands. It is

basically a command line interpreter

which translates commands entered by the

user and converts them into a language

that is understood by the kernel. And

obviously the next logical question is

what is a shell script? Since I spoke

about the shell, it is only obvious that

I'm going to mention the shell script.

The basic concept of a shell script is a

list of commands which are listed in

order of execution.

With that, let's move on to our next

topic which is evolution of the shell.

So let's begin with a short history of

the modern shells and then explore some

of the useful and exotic shells that are

available in Linux today. All right. So

the shell or the command line

interpreter have a long history but this

discussion begins with the first ever

Unix shell. Ken Thompson of Bell Labs

discovered the first shell for the Unix

called the V6 in 1971. Now similar to

its predecessor, this shell was an

independent user program that could be

executed outside the kernel. Now I'm not

going to talk about the Thommpson shell.

We are going to begin our journey with a

look at the modern shell since 1977 when

the bone shell was introduced. Now the

bond shell created by Stephen Bourne at

the AT Bell Labs remains useful even

today. The author developed the Bond

shell after working on an algol 60 gate

compiler. So you'll find its grammar

more similar to the algorithmic language

than other shells. Now the source code

itself although developed in C even made

use of macros to give it the algol 68

flavor. Now the bond shell had two

primary goals to serve as a command line

interpreter to interactively execute

commands for the operating system and

for scripting. In addition to replacing

the Thompson shell, the bone shell

offered several advantages over its

predecessors. Now the bone introduced

control flows, loops and variables into

scripts providing a more functional

language to interact with the operating

system. Now the shell also permitted you

to use shell scripts as filters

providing integrated support for

handling signals but lacked the ability

to define functions. Finally, it

incorporated a number of features that

we use today, including command

substitution and here documents to embed

preserved string literal within a

script. Now, the bone shell was not only

an important step forward, but also an

anchor for numerous derivatives, many of

which are used today in typical Linux

systems. Next we have the sea shell

which came in 1978

was created by Bill Joy while he was

still a graduate student. It has been

widely distributed beginning with the

2BSD release of Berkeley software

distribution. The C shell is a command

processor typically run in a text window

allowing the user to type commands. Now

the C shell can also read commands from

a file called a script. Like all Linux

shells, it supports file name, wild

carding, piping here documents, command

substitution, variables, and control

structures for condition testing. What

differentiated the C shell from others,

especially in the 1980s, were its

interactive features and overall style.

Its new features made it easier and

faster to use. The overall style of the

language looked more like C programming

language and was seen as more readable.

Now another improvement that we saw on

the bone shell was the corn shell in

1983.

It was developed by David K of Bell Labs

again as a comprehensive combined

version of other major shells that were

present at that time. The initial

development was based on the bone shell

source code. Now the corn shell is

backward compatible with the bone shell

and includes many features of the C

shell as well. Now the corn shell

compiles with pix 2 shell and utilities.

Major differences between the corn shell

and the traditional bone shell include

job control, command aliasing and

command history that is designed after

the corresponding C shell features.

After the con shell, we have the 10X C

shell which was a derivative of your

basic C shell.

Now this shell in 1983 was essentially

the sea shell but with programmable

command line completion, command line

editing and a few other features. Then

we have bash which still remains one of

the most popular shells even in today's

time. Now this was written by Brian Fox

for the GNU project as a free software

replacement for the Bond shell. It had

been distributed widely as default login

shell for most Linux distributions and

Apple's Mac OS. Now the bash can also

read and execute commands from a file

like all Linux and Unix shells. It

supports file name globing piping here

documents and command substitution. The

keywords, syntax, and other basic

features of the language are all from

the basic shell. The shell's name is an

acronym for born again shell. a pun on

the name of the bone shell that it

replaces.

The bash command syntax is a superset of

the bone shell command syntax. It

supports brace expansion, command line

completion, basic debugging, and

exception handling using trap. Now, it

can execute the vast majority of shell

scripts without modification with the

exception of the bone shell scripts

tumbling into French syntax behavior.

The bash command syntax includes ideas

drawn from the corn shell and the sea

shell as well. After that, the world

came across various other shells such as

the public domain con shell which was

basically a public domain or a free

version of the corn shell. You had the

alchemist shell. Then you had the

extensible shell or the plan 9 shell.

Today we have many other shells namely

your Zshell, your DBN armquist shell or

the Dash shell and the Mir BSD corn

shell. In this segment I am going to

majorly focus on four shells which will

give you an idea of all the other

derivative shells as well. I'm going to

be talking about first the basic shell,

the bone shell. I'm going to talk about

the bornag again shell, the corn shell,

the 10x sea shell, and an exotic shell

called the scheme shell. Moving on,

let's talk a little bit about shell

versus bash. Now, most people use these

two terms synonymously, but they are not

the same thing.

Now, the shell command language is a

programming language which is described

by the posk standard. It has many

implementations including the bash. Now

because shell is a specification and not

an implementation, the /bin/sh

is a sim link or a hard link to an

actual implementation on most of the pix

systems. Now the bash started as a shell

compatible implementation but as time

passed it has acquired many extensions.

Now many of these extensions may change

the behavior of valid pix shell scripts.

So by itself bash is not a pix shell

rather it is a dialect of the pix shell.

So summarizing about this I would say

that shell is actually a specification

of which bash is an implementation. For

a long time the shebang line of the

shell script used to point to the bash

on most Linux systems. As a result, it

has become more safe to ignore the

difference between the two. But both of

them are pretty much different things.

With that, let's look at shell versus

bash versus a few other Linux shells.

First of all, the sea shell. Now, if

you're a network or systems

administrator in a Linux or Unix

environment, you will most certainly run

into the C shell. So, it is good to at

least have some familiarity with it. Now

casual users and even most developers

will probably suggest other shells. But

if you are comfortable with C

programming language then the C shell is

a great shell to begin with. Now the con

shell is the one that you can use

interactively to execute commands from

the command line or programmatically to

create scripts that can automate many

computer maintenance and system

administration tasks. Now, bash is far

too big a subject to be covered fully in

a single line, but it is one of the most

commonly used scripting languages that

you will find today. People are

comfortable with bash scripting and most

of the content that you will find around

shell scripting will be in bash. But you

should probably learn it for its

versatility and ease of use more than

anything. Most colleges and universities

teach their students to script in bash

because it's a great place to begin as

well. So now I'm going to run the same

script in three different shells which

are derivatives of the three most basic

shells which are your bond shell, your C

shell and your corn shell to see how

different or similar they are. So for

that I have opened up my terminal. This

is CentOS 7 the Fedora version. So what

I'm going to try to do is take a single

argument which is going to be a

directory name and my script is supposed

to search recursively for all executable

files in that directory along with the

number of files that are found. I'm

going to reuse this script design in

each of the examples to illustrate the

differences. So first let's see what

directories do we have. Okay. So what

I'm interested in is this Eclipse

directory. So what I'm going to do is

okay this is one file Java Oxygen. Let's

see if it's executable or not.

Okay, as we see the Java Oxygen file is

executable. So when I pass Eclipse as an

argument, this directory as an argument

to any of my scripts, I am supposed to

get an answer that this Java oxygen file

is executable and the number of

executable files found in that

particular directory is equal to 1. So

first I'm going to run the 10x shell and

see. So I'm going to go and open up this

10x shell. So basically what I did is

open up my 10x script. It's divided into

three basic sections. First note that I

use the shebang symbol to declare this

file as interpretable by the defined

shell. This allows me to execute the

file as a regular executable rather than

proceed it with an interpreter binary.

All right. It maintains a count of the

executable files found. So I initialize

this count with zero here. So the first

section, this section right here tests

the arguments passed by the user. This

arg

variable represents the number of

arguments that are passed excluding the

command name itself. Now you can access

these arguments by specifying their

index. For example, if I say this hash

one, it refers to the first argument.

The script is expecting one argument. If

it doesn't find it, it emits an error

image. So using this dollar 0, I'm going

to indicate the command name that was

typed. Now let's come to the second

section. This basically ensures that the

argument passed in was a directory. The

d operator here, the hyphen d operator

here returns true if the argument is a

directory. But note that I specify a not

directory sign here. This exclamatory

symbol which means negate. Now this way

the expression says that if an argument

is not a directory you emit an error

message which is this one. And for the

final section it iterates the files in

the directory to test whether they are

executable. I use the convenient for

each iterator which loops through each

entry in the parenthesis in this case

which is the directory and then tests

each as a part of the loop. Now this

step here uses the hyphen x operator to

test whether the file is an executable.

If it is the file is emitted and the

count is increased. I end the script by

emitting the count of executables here.

Okay. So now that we have understood

what the script is, let's go ahead and

run this

and then I'm going to toy Eclipse.

And as we had predicted, it says that

Java oxygen is your executable file and

one executable files found. Now let me

clear this out for you.

Next, let's try doing the same thing

with our corn shell.

Now this is the code. Now as you can see

our shebang line immediately it's

different. Now this corn shell is a

derivative of the bone shell and it

looks so much more similar to it than

the sea shell. So let's look at our

example again. Now the first thing

you'll notice here is its similarity to

the first code that I had put up. Let me

open it side by side for you.

Okay. So what I'm going to do is I am

going to open another new terminal. Let

me just open another tab right here,

another new window. So I can basically

show you the similarity between both of

these.

So I'm going to go ahead and

Okay, now we have these two on both

sides. So the first thing you'll notice

on your con shell script is its

similarity to the 10x shell script.

Structurally the script is almost

identical. The first, second, and third

parts of the script, you have your test

arguments. Then you have your ensure

argument which is a directory and then

you iterate the directory to emit the

executable files. But the key

differences are evident in the way

conditionals, expressions and the

iteration is performed. For example,

instead of operating C like test

operators, the KSH adopts the typical

bond style operators. So here you can

see this not equal to versus here this

not equal to. Now the corn shell also

has some differences related to the

iteration. Now in the corn shell the

forin structure is used with the command

substitution to represent the list of

files created from the standard output

of the command ls representing the

contents of the name subdirectory in

addition to the other features defined

here. The con supports the alias feature

to replace a word with the userdefined

string. Now the con has many other

features that are disabled by default

such as file name completion but you can

enable it if you want to. So let me

close this. So let's try running this

file

and let's put in Eclipse again. And as

you see the answer is the same. Okay.

Finally we going to try the same thing

using the bash or the born again shell.

Now the bash has continued to evolve

with new features, support for regular

expressions and associative arrays. Now

although some of these features may not

be present in other scripting languages,

it's possible to write scripts that are

compatible with other languages. To this

point, this script that you see here is

identical to the corn shell script

except for the shebang difference. Let

me open the corn shell real quick and

give you a sidebyside comparison on

this.

Okay, so as you can see it's pretty much

the same except for your shebang line

which obviously has to be different

because of where they are pointing. One

key difference among these shells is the

licenses under which they are released.

Now the bash as you would expect having

been developed by the GNU project is

released under GPL but the C shell 10X C

shell Z shell and so on are released

under BSD in BSD like license. The con

shell is available under the common

public license but apart from that as

you can see the way you write the script

in bash and con is the same except for

their shebang line. So let me just

run this and show it to you.

And as you can see the answer is the

same. Now my point being why I chose

these three specific shells is that

it'll give you an idea of how all the

other derivative shells work. More or

less it's going to be similar to these

three basic shells. Else your logic will

always remain the same. With that, let

me move back to my presentation.

Now, apart from these, you can go ahead

and pick the shell you like. Many of the

ideas and much of the interfaces of the

shells remain the same almost 35 years

later. A tremendous testament to the

original authors of the early shells.

Now, in an industry that continuously

reinvents itself, the shell has been

improved upon, but not substantially

changed. Although there have been

attempts to create specialized shells,

customized shells, the bond shell

derivatives continue to be the primary

shells in use.

Let's look at our hardware requirements.

You should have a system with at least 2

GHz dualcore processor or better, a

system memory of 4GB or more, and a

recommended free disk space of at least

25GB. Now, let's look at the software

requirements. We are going to be doing

this on our system with Windows 10

installed. Also, we are going to use a

tool called Virtual Box. Alternatives to

this also exist like VMware but we will

be using Virtual Box here. Also, it is

important that you enable virtualization

in your BIOS settings for the PC

otherwise virtual box won't run. So,

let's move on to the demo part. Setting

up the Linux VM on our system has two

major steps. The first thing for you to

do is download the virtual box utility.

And second is to download Linux. We will

be using YUbuntu here which is a very

popular Linux distribution. So let's

first go ahead and download Virtual Box.

Open the link and go to your download

section. As I'm having Windows here,

I'll click on this and then my setup

should start. Now I'll just cancel this

setup because I have already downloaded

the file before. As you can see I have

my file here and the other thing for you

to do is to download the Linux

distribution. So to do that type in

yubuntu download

here you can download the latest Ubuntu

and as you can see it has the

recommended systems requirement over

here which we talked about before. To

download the Ubuntu, you click on this

download button and soon enough the

download should begin.

Now the download process starts. But I

have already downloaded this as well on

my system. So I have my Virtual Box over

here with my Linux distribution here. So

let's install Virtual Box first. To do

this, open the setup and follow these

steps.

Now we can start installing the Oracle

virtual box. So click next and go with

the normal location

and continue clicking next. And this

shows warning here but don't be worried

about it. This won't have any issues. So

click on yes and then install.

Now that the installation has finished,

let's start our virtual box. So now that

the virtual box is now open, we need to

create a new VM. So to do this, we click

on this button new and we provide it a

name

and I provide it up to 4 GB of RAM. Now

I'll create my hard disk and this will

be dynamically allocated. Now that you

have this set up, what you need to do is

that you need to copy this ISO image and

load it into our VM. So to do that you

need to click on settings here

and select this.

Now provide it with your file.

So I select my Ubuntu here. This is my

Ubuntu image and I'll open it.

Now hit okay and start the VM.

Now let's maximize this. And here I'll

select the first option.

So because this is your first time doing

this, it might take up to like 2 hours

at max for you to set up this

environment.

Now click on install Ubuntu and follow

along the instructions.

Now restart your system.

Now you should have a working Ubuntu

system on your virtual box.

And with that the demo is concluded. In

this way, you can set up a number of

virtual machines on your system and

continue your DevOps journey.

The first thing we talk about is the

Linux directory commands. So, what we'll

do here is we'll take a look at each

command and what they work like in

Linux. So, the first command is the pwd

command, right? So the pwd command is

basically used to display the location

of your current working directory. Now

directory is basically a file. You have

to realize that everything in Linux is a

file. So directory is a file which

contains other files as well. Right? So

the pwd file is used to display the

location of the current working file

directory that you have. Let's take a

look at it. As you can see pwd is the

syntax for it and it basically shows you

whichever directory you have. So let's

take a look at it, right? Then so let's

say you want to check out the directory

for one of your files. So let's say you

go to files and you open up terminal

and then you type in pwd.

So this is basically your directory. It

is in home and KB is the user, right? So

this is basically what pwd does. Moving

on to the next command. So next up we

have the second command which is the

mkdir which is basically make directory.

Now make directory is used to make

different new directories under any

directory that is already there. So

let's say for example we've already seen

that we are in the directory home and if

you want to make a new directory under

any existing directories that are

present in Linux you use the mkdir

command and for syntax of the command

you'll have mkdir and then your

directory name right so let's say for

example if you want to name your new

directory then you just have to write

mkdir and new directory so let's take a

look at it right so you're already here

in the terminal and you're inside the

directory right with pwd.

So what we do here is you make a new

directory say mkdir

and let's say new diir.

So now if you basically ls into it we'll

come to ls later but if you ls into it

you can see there's a new directory that

has been formed here. So this is the

mkdir command. So moving on to the next

one. So the next one is basically

another command called rmdir. Just like

you make a directory, you can also

remove a directory. So remove directory

is basically used to delete a directory

that you've already created. And to

basically make that happen, you'll have

to type in rmdir and your directory

name. So let's take a look at how it

works. Right? So as you can see here,

you've made a new directory called new

diir. So to delete it all you have to do

is rmd diir and directory and it has

been removed. Now if you cross check it

you'll see that your directory has been

removed. Right? So this is how remove

directory command works. Rmdir. Moving

on to the next command. Next up we

basically have the ls command. Like in

previous examples we used ls right. So l

command is used to display a list of the

content that is present in a directory.

So let's say you have a directory which

is the home directory and you want to

see what's present inside that

directory. So if you just type in ls

it'll show you all of the files present

in the present directory there. And for

the syntax you just need to type in ls

and you'll get all the files that's

there. So let's just check it out. So

suppose you want to check out the system

files inside your directory. So if you

go to your computer directory, you'll

just type in ls in the terminal. And

these are all the files that is present

in this directory which is the my

computer for Linux. Since there is no my

computer for Linux, you'll have all

these files, the system files that you

have. So this is basically what ls does.

So ls basically just displays the

contents of the directory that's there.

Right? Now if you want to see which

directory I'm talking about I'm talking

about this directory which is computer.

Right? All of these files that you see

bin boot dev etc. All you got to do is

just type in ls and you can see them. So

this is the ls command. So moving on to

the next command.

So the next command we see is basically

the cd command. Now the cd command is

used to change the directory that you're

currently in. Right? So if you go to the

computer directory with all the system

files that's there just type in ls and

you can basically see all the files

that's there. Right? So you want to go

into one of those files and check the

contents of those files. Right? You want

to change the directory. Now these are

subdirectories that are already present

in the computer directory. Right? So you

just change directory to let's say bin

or library or dev. So you just need to

type cd change directory and the name of

the directory right and you will

basically get into that directory. So

let's just check it out. So basically

guys if you can go to terminal you see

right right now you're in the root

directory. The root directory is always

shown as a slash. It's a forward slash

right? So if you want to change

directories, let's say let's check out

the directories that are there to check

out the contents of your root directory,

you will just have to type ls and you

can see these are directories. So to

change the directory, what you have to

do is simply type in cd and choose any

of these directories that you have.

Let's say you want to get it to bin.

And that's it. You go into bin. Now your

directory has changed from the root

directory to the bin directory. Now the

bin directory is a part of the root

directory. So we have slash and then

bin. But now you've changed your

directory to bin. So this is the cd

command. So moving on. First we saw the

Linux directory commands. Now we move on

to the Linux file commands. So there are

various Linux file commands. The first

one we talk about is the touch command.

So basically the touch command is used

to create empty files and you can create

multiple files by executing the touch

command only once. For example, if you

see here you can create a empty file

called file.txt

and you can also create two files in the

same command. So you now as you can see

if you type in touch file 2 or file

three or whatever the name of your file

might be you can create any number of

files at one go. So this is basically

what touch is used for. And for the

syntax touch basically you have to write

touch and then the file name. And if you

want to make two or more files together,

you can write touch and then add the

file names one after the other. So let's

check it out. So guys, I'll basically

make a file in this folder called Linux

that I have. Right? So all I need to do

is just as you can see there are other

files as well. So let's see how we can

create a new file and all you have to do

is open a terminal. So guys as you can

see I've basically just cded into this

and it's in the Linux folder like we saw

before and we'll create a new file. Just

to do that you'll have to type touch and

edurea

2 for example and after that you'll just

have to check it out. So edurea 2 is

basically a file that you've just

created. Now if you want to create

another file for example two files

together let's check that out as well.

Let's first clear this out. So to clear

your terminal you'll just have to type

in clear and that's it. Right. So let's

create more than one file together with

one command. You'll have to type in

touch and name of your file. Let's say

my name is Korak. I will type korok11

txt and koro12.

txt. So these have been created. Let's

check them out. So as you can see there

are two files that have been created and

you can see that there's only one single

touch command that I have used. So this

is what touch is used for. So basically

the next command is the cat command. Now

the cat command is one of the most

frequently used Linux commands. Right?

So the cat command is short for

concatenate. Now what this helps us to

do is it helps us to create a single or

multiple files. So if you have created

an empty file called touch, you can

basically add content to it if you type

in cat. So it allows us to create single

or multiple files, view contents of the

file, concatenate files and redirect

output in the terminal of files. So what

it does is you can copy the content of a

file and put it in another. And we'll

show that as well. So let's see an

example of how CAT works. And the syntax

for cat is if you want to create files,

you know, files with content in it,

you'll basically have the cat command

followed with a greater than sign and

the file name. And if you want to

concatenate, basically copy the content

of one file to another. You'll have to

write cat and file name. So let's check

it out. So basically the cat command can

be used like this. Let's say you want to

insert something into the new file

you've just created. Created code of 11

one. So basically what you can do now is

add content to it. So let's say hi.

And to basically get out of it, you have

to do Ctrl D, right? And that is you

adding content to your file. Now if you

basically check this and just write for

see this is basically showing you the

content of the file that's already there

and this command is basically letting

you add content to the empty file that

you created using touch. So up next we

have the next command which is the rm

command. rm is basically short for

remove and it is a command which is used

to remove a file and the syntax for that

is rm followed by file name. So let's

check it out. So if you want to remove a

file, you'll have to first go to the

directory where the file is present. And

then once you enter the directory,

you'll just have to type in rm and post

that you'll have to type in the name of

the file. For example, since I've

recreated a file called kor11

txt, if you put rm that and it's

removed. So just to cross check, korok1

file has now been deleted. Now let's try

this file as well. Right? So if you just

type in kor12

so since 11 one is not there anymore

you'll have korak12.txt

and you do this and now check it you'll

see that korak12 has also been removed

right so this is what rm does. So up

next you'll have the cp command. Now the

cp command is used to copy a file or a

directory. Now, all you need to do to

use a cp command is type in cp and type

in the name of the files that you want

to copy, right? So, let's say you want

to copy a text file called into another

text file called demo.txt. So, all you

need to do is type in cp and the name of

the two files that you want copied into,

right? The first name is the file you

want to copy the contents of and the

second name of the file is the file you

want to basically copy it to.

So let's check it out. If you basically

go into the Linux directory that you

have, that's basically a folder that

I've created and these are the files

that are present in there. So you want

to copy the contents of one file into

another. All you need to do is type in

cp and the name of the first file that

is already existing

one txt and

new.xt,

right?

And all you need to know here is you can

go check the contents of the file after

this. Right? So if you go and check out

new.txt,

it's basically empty. Why is that?

That's because edurea 1 is also empty,

right? So if you basically add some

contents, let's say hi

and save this and just shut it down back

again. Go back to terminal. And now

let's check this out again. Just copy.

So you can just do this and check it out

again. Right. So if you go back to your

file now and open up new.txt,

this is the same content as your ed1

file.

So this is what copy command does. So

moving on to the next command. The next

command is the MV command or the move

command. So the move command is

basically used to move a file or

directory from one location to another.

So all you need to do to use the move

command is basically type in mv. Then

the name of the file that you want to

move and finally the name of the

directory you want to move it to. So

let's check it out. So you're basically

in the directory where you have your

files. Now you want to move your file to

another directory. So you have to just

type in mp the name of the file that you

want to move. Let's say you want to move

new.ext, right? So new.ext and where you

want to move it to. Let's say documents

or let's say

now if you basically now check it with

ls your new.ext file has gone off to the

documents folder.

Next up, we have another command which

is the last of the file commands that

you have. This is the rename command.

Now, the rename command as you can see

is used to rename files. It is useful

for renaming a large group of files. And

the basic syntax for that is rename and

then apostrophe s with the name of the

old folder and then the name of the new

folder. And after that you'll basically

have to show which type of file you want

it to be. So this is how you basically

do renaming. So let's check it out. So

you basically just type in rename

command with the old text file and

basically you want to convert it to new

text file which is basically you want to

convert it from a text file to a PDF

file. So this is the command you given

and then press enter. Right? So you've

now changed rename all the text files

into PDF. So let's say if you ls into

that now you can see it's demo3 PDF eda

1 PDF. All of these text files have been

changed into PDF because the rename

command. So this is how rename works.

Moving on to the next command. We've all

checked out the Linux file commands. Now

we move on to the Linux file content

commands. So when it comes to file

content, the first thing we can see is

the head command. Now the head command

is used to display the content of a

file. Now the content of a file can be

displayed with other commands as well.

But the head command how it's different

from the other commands is that it

displays the first 10 lines of the file.

And basically the syntax for that is you

just have to write head and the name of

the file you want to show 10 lines in.

So let's check it out. So now if you

check out the head command, let's say

for example you type in head and

basically the first 10 lines of a file

that you want to check. Let's check it

out.

Right? So as you can see the first 10

lines have been displayed. Now if you

want to check the contents of that file

I'm going to show it to you.

Yeah. As you can see, the first 10 lines

are from 10 to 100 and the rest of the

lines have not been printed. If you

cross check back here again, so it's 10

to 100 with no other content that's

here. So head is basically something

that is used to show the first 10 lines

of your file. Right? So moving on to the

next command. So next up, just like

head, we have the tail command. Now the

tail command is used to display the last

10 lines of the file content. Just like

head is used to display the first 10

lines of the file content, tail is used

to display the last 10 of it. Now it is

useful for reading error messages,

right? So tail is basically something

which is used and after tail you just

have to specify the file name. So let's

check it out with the same file that we

saw before. Right? Then so just like

head let's just try using tail, right?

And

so the last 10 lines are these as you

can see as in head if you can see here

I'll just show it to you eda.

So if you put head you can basically see

it's from 10 to 100. That's the first 10

lines of the file. But in eda 2 which

has tail it'll show you the last 10

lines of the file. Right? This has no 10

to 60 here. It starts from 70. Now this

is the difference between head and tail

right. So move on to the next command.

So up next we have a very important

command which is the tag command. Right?

So the tag command is the reverse of the

cat command that we have used before. So

it displays the file content in reverse

order. So let's check it out. And

basically the syntax for it is just tac

and then file name. So let's check it

out. So if you want to see the content

of your file just type in tac and the

name of the file that you want to see.

As you can see tac has basically

displayed the content of this file in

reverse order. If you want to check it

out you can again check this. So this

has 10 to 150 and if you check here tag

aurea 2 has made it 150 to 10. Right? So

this is what tag does. Now moving on to

the next command. So up next we have the

mo command. The mo command is basically

a similar command to the cat command and

it is used to display content the same

way cat does. So the only difference

between more or cat is that there in

case of larger file sizes the screen

full output is displayed. So for this

I'll have to show you an example. Since

we do not have many large content file,

we can just check some of the files that

we have. Check them out. And the syntax

for more command is basically more and

then file name. So let's check out the

more command, shall we? So let's

basically check out the more command,

right? So if you type in more and let's

say,

right? So when you have more, you

basically type in more and then the name

of the file. So this will basically

display the content that you have in the

file and it's just like cat. Now the

difference between cat and more is

basically more is generally used for

larger files, right? Files with larger

amount content, larger sizes. So this is

basically all about more. It'll help you

show the content that is there in the

file. It's just like cat. So the next

command is the less command. So the less

command is similar to the more command

but has some added features to it.

Right? So along with the fact that

similar to the more command, the less

command will show you content on your

file, it automatically also adjusts the

size of the terminal window that you're

using, right? So the basic command for

less is less and then you'll have to

basically have the file name. So let's

check it out. So let's just check out

the less command does and the file name.

So this will basically give you the

content that you have, the contents of

the file that you have and automatically

reshuffle or adjust the length and

breadth of the terminal that you have.

Right? So this is what less does. Moving

on to the next command. So after that we

have the different Linux user commands.

Right? So when it comes to user

commands, the most important is the su

and the pseudo commands. So the su

command provides administrative access

to another user, right? So in other

word, it allows access to the Linux

shell to another user. So let's check it

out. And syntax for it, that's very

basic. So you'll just have to write su

and specify the username, right, of your

Linux system. So let's check it out. So

all you need to do here is go to

terminal and type it su and then the

username. My username is KB as you can

see. So now you have to specify the

password. So this is something which

allows access to somebody else. Right?

If you type in SU, so you can basically

use their Linux system, right? You have

been allowed access into KB's Linux

system if you have password and if you

know the username as well. So this is

what SU does. So next up we have the ID

command. Now the ID command is used to

display the user ID and the group ID

that you have. So you have a user ID for

your Linux system. You have a group ID

for your Linux system and the command

for that is ID. Right? So let's check it

out. All you have to do here is type in

the word ID and you'll basically get

your user ID and your group ID as well

along with the username. So this is what

ID does. So next up we have the pseudo

command. Now pseudo command let's just

show you pseudo is something which is

used extensively in Linux to give you

access to files which need permission

right user permission administrator

permission to access them right you need

administrator permission to access

certain files so how do you do that

let's say for example if you go into the

terminal for your computer you go into

this computer and you go into terminal

And let's check it out. You do ls and

then you cd into one of the directories.

And all you have to do now is see the

files that are there. Right? So these

are all the files that are there. Now if

you want to access one of these files,

these files are actually administrator

protected. So you need to have pseudo to

basically ask for permission which has

to be granted by the administrator. So

just type in sudo then let's say sudo

zip and you'll have your password.

So these are restricted and basically as

you can see these are restricted because

this is basically machine understandable

language and you can already see that

this is basically what is there in the

file which is the zip file. So this is

what pseudo does. So this was a very

important command that you needed to

know. So moving on to the next command.

So next up we have the user add command.

So the user add command is used to add

or remove the user from the Linux

server. Right? So if you add or remove

the user, you'll have to have special

permission for which you'll have to use

the pseudo command as well. Right? So

you just write sudo and then user add

and then you add the new user. pseudo

has to be because you'll have to have

special permission from the

administrator to do this and the syntax

for user ad is user ad and then you

basically add the username. So let's

check it out. So you basically want to

use user ad, right? This will basically

add user. What you need to do is add

sudo and then the user add command and

the name of your user. Let's say I want

it to be KB9.

Right? It'll ask for your password. Your

new user has now been created. And let's

move on to the next command. So the next

command is the pass WD command which is

the password command. So the pass WD

command is used to create and change the

password for a user. So let's say for

example you have to use sudo here as

well. you have a user already present

and if you want to change password just

sudo into that user type the new

password type retype the new password

and then basically it'll show you the

password has been successfully updated

and the syntax for this is pass WD and

then username so let's check it out once

so just type in pass WD then KB that is

basically your user right now so we'll

basically change the password for KB

since it's already an existing user

which add the password, right? So,

current password is already there. What

your new password to be is

and you have to retype it, right? So,

the password has now been updated

successfully. And this is how you

basically use the pass WT command. So,

next up we have the group ad command.

So, the group ad command is basically

used to create a user group, right? So

when you create user groups, you'll also

have to use the sudo command because you

want to access restricted files, right?

So the syntax for group ad is group ad

and then group name. So let's check out

the group ad command. So first of all,

you have to type in sudo and then group

ad and then group name. Let's say we

name our group educator

2022

and then password for KV which we've

just created. Now, so now this group has

been added into this user. So that was

basically how you use the group add

command. So finally you come to the

Linux filter commands. Now there are

various filter commands that Linux has.

The first thing you can see is the cat

command. Now the cat command is also

used as a filter. Right? Now filtering

here means to filter a file. It is used

for inside pipes. Now you basically

filter out the content that is there.

Now, if you want to filter using cat,

you'll have to write cat and then the

file name with cat or tag and then cat

or tag again, right? So, you'll have

pipes in between and you'll basically

have the cat and tag cat and tag

commands back inside pipes. So, let's

just check it out. So, if you want to

use the cat command as a filter, let's

check it out. Type in cat home and then

we'll basically have this which is the

pipe and then the command t then cat

finally we'll have tag.

So this is basically what the cat

command does as a filter. Next up is the

cut command. Now the cut command is used

to select a specific column of a file.

So the D option is basically the

delimiter option and the F option is

basically the column. So the D option is

used as delimiter and it can be a space

or a slash or a hyphen or anything else.

Whereas F is the column number and the

syntax for this is cut and then you put

the D limiter. You put the column number

and then you put the file name in the

end. So let's check it out as well.

So with the cut command you'll just have

you type in cut then you'll have the

delimiter

after which you will have the f and the

file name in the end.

Right? So this is basically what the cut

command does. It cuts out from a

specific column and the specific column

number. Since there's only one column

here and we specified F2, there is no

cutting out. So if we do the same thing

again and change F2 to F_sub_1, let's

see how it's different, right? So this

is basically what F1 F_sub_2 does. It

shows you the column name and it'll show

you basically a specific part of the

file that you want. You'll cut out a

part of that file and it'll show it to

you. But since we have only column one,

it'll show you just the column one here.

Right? So this is what cut does. Moving

on to the next command. So the next

command is the grep command. So the grep

command in Linux is the most powerful

command and it is used to filter the

Linux system. Right? Grep stands for

global regular expression print. Right?

So it is basically very useful for

searching content from a pack. Right? So

for example, you need the syntax as

basically command and then grep and then

you search the word. Right? So let's see

how gref works. So let's check it out.

So to basically check out how Gre works,

let's check this out. Let's say cat and

iterator 2. Then you'll basically have

this with gre 3.

So this is basically every content in

the file which is in RA 2 which has the

value three in it. So these are the two

values which has three in it and that is

what grep is showing. So this is how

grep works. So moving on to the next

command is the com command. Now the com

command is used to compare two files or

streams. Right? So by default it for

displays three columns. The first

displays the non-matching columns of the

first file. The second for the second

file and third displays the non-matching

columns for the third file. So the

syntax for this is fairly easy. It's

just com and then you specify the file

names that you want. Right? So let's

just check this out. So if you want to

check out how the com command works,

let's see this com. and basically add

the two folders you want and the

contents of it which you want. So these

are all the files content that is there

in both the files right input is not in

sorted order but the file number one is

not in sorted order and so this is

basically showing the content of all of

the files that I've given which is 2 and

home and the content widget which has

right it displays it in three different

columns.

So this is what com does so checking out

the next command. So the next command is

the sedd command right. So the sed

command is short for stream editor. Now

sedd is used to edit files using regular

expression. It does not permanently edit

files. Instead what it does is the

edited contains remains only on display

and it doesn't really affect the actual

file. So the syntax for sedd is

basically the command and then sed with

apostrophe s and the old word with the

new word. Right. So if you want to check

it out, let's see. So basically for

having SED, you'll basically have to

show the stream editor. So this is the

command for it. You have to put SED eco

and eco is basically used in Linux and

you basically have this thing printed

called eda 7. Right? So as we can see is

used to edit files using a regular

expression. Right? So it doesn't really

permanently edit those files but it's

only for view. You can't really change

what's there in the content. So as I

showed before if you write class E= 7

with sed and change it in class. So this

is just for view eda 7 what you see is

for view. It hasn't really changed the

content of it. Right? So next up we go

to the next command which is the t

command. Right? So twe command which is

t command is similar to the cat command.

The only difference between both filters

is that it puts standard input or

standard output and can also write them

into a file. So let's check it out. Also

the syntax for t command is the cat and

then file name then followed with t and

then with new file and then you have cat

attack. So let's check it out. So as you

can see here the DE is basically putting

in standard input standard output and

writing the same thing as you can see in

HDA 2 into the new 98 file as well. So

this is what T does the T command. So

moving forward we have the TR command.

Now the TR command is used to translate

the file content like from lowerase to

uppercase right? So if you have some

sort of content in a file which is in

lower case, you can change it to upper

case. And the syntax for that is

basically command follow tr and the old

word to the new word. Right? So let's

check it out. So guys, when you're

talking about the cat command, you'll

basically have to write cat and the name

of the file followed with tr which is

translate and then just replace the file

with the old file. Then replace the word

from the old word to the new word. So

let's say we have hello as the own

world. I want it to be upper case on

hello right. So it'll show me hello

world right? You go back to the file now

it shows you hello world right. So hello

world is like this and I wanted to

basically make it uppercase. So this is

what I have to do to make it uppercase

use the tr command.

So next up we have the unique command.

So the unique command is used to form a

sorted list in which every word will

occur only once right. So the syntax for

this is the command followed by the file

name and / unique. So every command has

to be there only once there is absolute

redundancy. So let's check it out. So

all you have to do for the unique

command is basically type in sort

followed by the name of the file you

have and put in unique after that. If

you do this, this is basically showing

you everything in the content only once.

So there is redundancy that's there.

Everything is unique. So this is about

this unique command. Moving on to the

next command. We have here our final

command which is the WC command. Right?

So the WC command is used to count the

words, lines and characters in a file.

So let's say if you want to count the

number of characters you have in your

file, just type in WC followed by the

file name. So let's check it out. So

finally we come to WC. So what you have

to do here is type in WC

and the name of the file you want. Let's

say you want home.

Right? So this is basically showing you

the number of characters that the home

file has. Home file has certain content

in it and that content has around 48

characters in it. So that is all about

the WC command.

First we will have a look at the Linux

commands that are very basic. Like even

if you are not working in DevOps, if you

are someone who's using the Linux- based

operating system, you must be knowing

these commands. These are the frequently

used commands like while you're working

in DevOps. Okay, I'm just showing you

the list. Then we will practically see

how to use this commands on the command

prompt. So these are the few commands

I've tried to cover maximum number of

commands so that you're comfortable

working with DevOps. So now let us try

to execute these commands in an Linux

based system. So in my system I have

installed Ubuntu operating system. So

let us start with the basic commands in

Linux. So the first command that you

must know is the man command. Man stands

for manual. Like if you want to know

about any command in Linux, you can just

type man space the name of the command.

Say for example, you have to know about

ls. Say for example, just type man space

ls. So ls is a command. We'll talk about

it later. So just press enter.

Okay. So here it shows the name of the

command, its syntax and the description.

Like if you want to know what it is and

what it does so you can use man command

for it. So the next command that you

should know is the clear command. If you

want to clear your terminal just type

clear and press enter. So this clears

your terminal. So the next command that

you must know is uh say for example if

you want to know where is your current

working directory. For that there is a

command called pwd that is present

working directory. Simply type pwd and

press enter. Okay. So here it says home

edurea. So this is my current working

directory and if you want to change your

directory for that there's a command

called cd that is change directory.

Suppose from home edurea you have to

switch your working directory to home.

So simply type home.

Okay. So if I now type pwd it says home.

So this was another basic command. So

the next command is eco command. Say if

you want to type anything like if you

want to print anything on the terminal.

So you can use eco command for that. Say

for example eco

hello world.

So I have to print these two words on

the terminal. For that I'll use the eco

command. Okay. So it says hello world.

Pretty simple. So the next command is su

command. Let's see first who is the

current user. For that there's one more

command called who am I.

Okay. So here it says edureka. So

Edureka is the current user of this

system the Linux system. So if you want

to switch to the root user who has all

the permissions as of now the Edureka

he's not a super user. He doesn't have

any permissions related to file

operations or any other operations. So

root is a user the basic user he has all

the permissions on this Linux OS. So if

you want to switch to the root user so

simply type su press enter it'll ask for

a password. Type the password.

So here it says authentication failure.

So there's one more command bash sudo

bash.

Okay. So before it was edurea here and

now it is root here. So if I type who am

I?

So here it says root. Okay. So in case

if this doesn't work, SU doesn't work

for any reason. So you can use this

command called pseudo bash. So it

switches to the root user. And if you

want to switch back to Edureka, simply

type SU and the username.

Okay. So you're back to the Edureka

user. Okay.

These are very basic commands guys, but

you must be knowing this. So the next

command is the pseudo command. So pseudo

command is for user who doesn't have a

proper permissions or privileges for

executing some commands or operations.

So in that case you have to use a pseudo

command. So say for example adding a

user, deleting a user, adding a group

and many other commands that we will see

in the upcoming commands. So I'll just

give you a few examples here of pseudo.

For example, you have to add a user. So

adding a user, deleting a user that is

mostly done by the root user. So he has

all the permissions to add a user and

all. So say for example if you have to

add a user. So the command for that is

sudo user

add and the name of the user. Say for

example Arvind.

Oh it says Arvind already exists. So

type Arvin 111.

So it has created a user. And say for

example if you have to add a password to

this user. So the command for that is

pseudo p A sd and the username.

So it'll ask for a password that you

need to set. You can type whatever you

want. Retype it.

So it has created a user and it has also

added a password for that user. So say

for example you have to delete this

user. So the command for that is pseudo

user delete userdeel and the username

or win one one.

Okay. So the user has been deleted. Say

for example you have to add a group. A

group can have multiple users. Okay. So

you have to add a group to the system.

So the command for that is sudo group

add

and the group name. So you can say the

group name as techies. Okay. So the

group has been added. Similarly, if you

want to remove this group

sudo group deel and the group name.

Okay, pretty simple.

So let me just clear my terminal. So the

next command that we are going to talk

about is the touch command. So the touch

command is used to create any file on

your system. Say for example, I have to

create a file, a text file. You can give

whatever name abc CBA.ext.

Oh, it says permission denied. Okay. So,

here we are going to use the command

sudo.

So, it has created a file called

CBA.ext. And how can we see that? Simply

type ls. Can you see here the file that

we have just created the CBAT txt? So,

this is the use of the touch command to

create a file. So the next command that

we are going to talk about is the text

editor command. Say for example vi nano

vim gedit and so on. So the vi editor is

the most popular and a classic text

editor in a Linux family. So to use it

uh say for example you have to write

something into that file. So for that

purpose you will use p sudo vi and the

name of the file cba.txt.

Okay. So press enter. The file has been

opened now. and press I to insert

anything into this. Say for example, hi

this is Edurea.

So to save this file simply press escape

colon W for write and Q to quit.

So our file has been saved. So there's

one more command called cat command. So

this command can read, modify or

concatenate text files. So this command

is also used to display the contents of

the file. So say for example I've

written something into this file called

CBA.txt. Now I have to display the

contents of this file. So what I'll do

is cat and file name CBA. TXT.

So here this was the line that I had

written in this file CBA. TXT. So the

cat command can be used for that. So

there are also other flags that can be

used with this command. Say for example

hyphen B. So the command would be

cat-ben and the file name. So this is

used to add line numbers to the

non-blank lines. So the next flag is

hyphen n that is cat-n. So this command

is used to add line numbers to all the

lines that are present in the file. Caty

s is used to squeeze blank lines into

one lines. And cat-en capital e it shows

the dollar sign at the end of the line.

So these were a few flags that you can

use with cat command. So let me just

clear the terminal. So the next command

that we are going to talk about is the

copy command. This command is used to

copy files and directories. A copy of

the file directory still remains in the

working directory. So let me just show

you how do you use this command. So it

is very simple. Copy. So say for example

CBA

txt. I have to copy this file to the

location. Say for example home

edurea. Right now we are at the home

location. Have to copy this file to this

location home edurea. Okay. So the

command is very simple. CP file name and

the destination name. So press enter. So

let us now see whether the file has been

copied there. So for that we'll have to

switch to that location.

CD edureka.

Uh so let us use the ls command. Okay.

So here you can see the cba.txt file has

been copied. So this was a very simple

command and there are a few flags that

you can use along with this command. So

there's a flag called hyphen n that is

cp - n and the file name. So this does

not override the file. The next flag is

the hyphen u that is cpu. So this

command updates the destination file

only when the source file is different

from the destination file. There's one

more flag called hyphen capital R that

is cp capital R. So this command is a

recursive copy for copying directories

and this command even copies the hidden

files. So these were a few flags that

you can use with the copy command. So

the next command is the move command or

the MV command. So this command moves

the files and the directories from one

directory to the another. The file or

the directory once moved is deleted from

the working directory. So this was not

the case with the copy command. So I

hope you get the difference between copy

and move. So let us see what is the

syntax for this. So the syntax is MB um

the flag name like if there are any

flags here, the file name

and the destination name. Okay, the path

to the destination. So let us just say

first we'll have a look at the files

that are present here. Okay, so

demo.txt. Can you see this file here? So

we'll try to move this file to the home

folder. So the command is very simple.

MV the file name

demo. TXT.

It says permission denied. So just

simply use sudo.

Okay, the file has been moved. Let us

now verify this cd.

Okay, so we are here at the home folder.

Simply use ls command. So as you can see

here, demo.txt has been moved. So this

was a very simple command and easy to

use command. There are three flags that

are associated with this command. MV-I.

So this command enters into an

interactive mode and the command line

asks before overwriting the files. So

the command mvu updates the destination

file only when the source file is

different from the destination file. And

the third flag is the mv -v. So this

command enters the verbos mode. And this

command prints the source and the

destination file. So for those who are

not aware of what verbose mode is. So,

verbos mode provides additional details

as to what drivers and softwares it is

loading during the startup. So, this was

all about the uh move command.

So, the next command that we are going

to talk about is the rm command. So,

this command removes files from a

directory. By default, the rm command

does not remove directories. Once

removed, the contents of the file cannot

be recovered. So, the syntax for this is

very simple. rm the flag flag name and

the file name. It's a very simple

command and easy to use command. So I'll

just show you how to use this. Say for

example I have to remove this file

demo.txt. So simply I'll type rm in the

file name demo.

TXT.

Oh, it says permission denied.

So the file has been removed. And let us

just verify this. Okay. So we cannot see

anywhere the demo.txt file. So it has

been removed. So this was a very simple

command rm. So there are two flags that

can be used along with this command. The

first flag is the rm - r. So this

command removes even the non-mpt

directories and the other flag is rm -

rp. So this command removes the non-

empty directories including the parents

and the subdirectories. So this was the

rm command. So the next command that

we're going to talk about is the mkdir

command. So if you want to create a new

directory then this command can be used.

It's a very simple command and the

syntax is even more simple. So if you

have to create a directory simply type

mkdir and the directory name. So say for

example in home I have to create a

directory called techies.

It says permission denied. No issues.

So the directory has been created. Let

us just verify this. So as you can see

here this directory has been created

here at this location the home folder.

So the flag that can be used with this

command is hyphen p that is mkdir - p.

So this command creates both a parent

directory and a subdirectory. And if you

want to create multiple files into a

directory you can use the command mkdir

- p and the file names. So this command

will create multiple subdirectories

inside the new parent directory. So let

me just clear the terminal. The next

command is the rmdir command or the

remove directory command. So this

command is used to remove a specified

directory. Although by default it can

remove only an empty directory, there

are flags which can be deployed to

delete the non-mpt directories as well.

And the syntax for this command is very

simple. Simply type rmdir

the flag name and the directory name.

Okay. So very simple. Let us just see

how do you remove a directory rmdir. So

let us just remove the directory that we

created in the previous command rmdir

and the name was techies.

sudo rmdir techies.

Okay. So the directory has been removed.

Let's just verify this. So there's no

directory called tech is here as it has

been removed by the rmdir command. So

there are a couple of flags that you can

use with this command. The first flag is

hyphen p that is rmdir - p. So this

command removes both the parent and the

child directory. There's one more flag

called hyphen pv. So the command is

rmdir - pv. So this command removes all

the parent and the subd directories

along with the verbos. So I hope you're

clear with this command rmdir. So the

next command that we are going to

discuss is the grap command. So this

command is used to search for a

particular string or a word in a text

file. So this command is similar to

control f but this is executed via a

command line. So let me just show you

how do you use this command. So let us

say for example let me have a text file

here. So the syntax for using this

command is very simple. So say for

example we have a file here called gp

test as you can see here this one. So

let me just see the contents of this

file using cat command

grip test

dot txt.

So this file has these words dog apple

ball cat mouse. So say for example I

have to search the word cat in this

file. So for that I'll use the command

gp the word cat and the file name

gp test dot txt.

Okay. So as you can see here the word

cat has been highlighted just because it

is present in this file. So say for

example we want to search for a word

that is not present here. So say for

example cat one or any other word. So

say for example mad.

Okay. So it is not showing anything that

means that this word is not present in

this file. So this was a very simple

command grip and there are a few flags

that you can use with this command. So

say for example grip

hyphen i and obviously the file name. So

this command will return the results for

case insensitive strings. So there's one

more flag called hyphen n that is grap

hyphen n. So this command returns the

matching strings along with their line

numbers. The next flag is the graph - v.

So this command returns the results of

lines not matching the search string.

Next flag is grap - c. So this command

returns the number of lines in which the

results matched the search string.

So the next command that we are going to

talk about is the sort command. So this

command sorts the results of a search

either alphabetically or numerically.

Files, file contents and directories can

be sorted using this command. The syntax

for this command is very simple. Uh let

me just see the files that are present

here. So there's a file called sort

test. So let me just see the contents of

this file. sort

test dot txt.

Okay, these are the words that are

present in this file. So I have to just

sort these words. Okay, so the command

for that is sort the file name sort

test dot txt.

So as you can see here these words have

been sorted alphabetically B, D, F, M, S

and T. So this is the use of sort

command and there are a few flags that

you can use with this command like the

first flag is sort hyphen r and the file

name obviously. So this command returns

the results in reverse order. So there's

one more flag called hyphen f. So this

command does the case insensitive

sorting. So whether you have uppercase

words or alphabets or whatever in your

file. So irrespective of the case this

command will sort the file and there's

one more flag called sorty-phen n. So

this command returns the results as per

the numerical order. So say for example

you have numbers in this file and if you

want to sort them numerically like

ascending order that can be done using

the command hyphen in. So this was

pretty much about the sort command. So

let me just clear the terminal.

So the next command that we are going to

talk about is the ch own command. So

different users in the OS have

ownerships and the permissions to ensure

that the files are secure and put

restrictions on who can modify the

contents of the file. In Linux there are

different users who can use the system.

So each user has some properties

associated with them such as the user ID

and a home directory. We can add users

into a group to make the process of

managing the users easier. A group can

have zero or more users. A specified

user can be associated with a default

group. It can also be a member of other

groups on the systems as well. So if you

talk about the ownerships and the

permissions so to protect and secure the

files and directories in Linux, we use

permissions to control what a user can

do with a file or a directory. So in

Linux there are three types of

permission. The read permission, the

write permission and the execute

permission. So the read permission

allows the user to read files and

directories. It lets the user read

directories and subdirectories stored in

it. The write permission allows the user

to modify and delete a file. Also, it

allows a user to modify its contents for

the directories. So unless the execute

permission is not given to directories,

changes do not affect them. The third

permission is the execute permission. So

the right permission on a file allows it

to get executed. For example, if we have

a file named php.sh.

So unless we don't give it an execute

permission, it won't be run. So these

were the permissions types of file

permissions in Linux. There are three

types. The first one is the user. So

these type of file permission affect the

owner of the file. The second one is the

group. This type of file permission

affects the group which owns the file.

So instead of the group permissions the

user permissions will apply if the owner

user is in this group. The third

permission is the other permission. So

these type of file permission affect all

the users on the systems. So to view

this permissions. So let us just say we

use a command ls-

l.

So this command will list down all the

files and the directories that are

present here along with their

permissions. So as you can see here

these are the permissions these are the

users the groups and the timestamp and

these are the names of the file to use

this command. So say for example there's

this file called abc.txt whose user is

edureka okay so you have to use this

command ch. So the syntax for that is

pretty simple ch the owner name the

owner that you want to change. So say

for example root and the file name. So

file name is abc.t txt

operation not permitted. Sudo, let me

just try sudo.

Okay, so this works when you use sudo.

So let us now just run the command ls- n

to see the permissions of this file. So

as you can see here it was first edurea.

Now let us see the changed owner. Okay.

So previously it was edurea and now it

is root. Okay. So this is how you use

the ch own command. So just to summarize

the ch command is used to change the

owner and the group of the file.

So the next command that we are going to

talk about is the chod command. So this

command is used to change the access

permissions of files and directories. So

the syntax for this command is pretty

much simple. So say for example if you

want to change the permissions and the

privileges of a file. So for that uh let

us just see the list of files that is

present here and the permissions. So say

for example this file bac.ext

it has these permissions. So we want to

give all the permissions to all the

users and the groups that want to use

this file. So for that let me type the

command chod

7. Okay. and the file name bac

txt. Okay. So let us again have a look

at the permissions of this file. Okay.

So as you can see here previously these

were the permissions read write read and

read and now it has changed to read

write execute for the user the group and

the others. Okay. So there are a few

numbers that are associated with the

permissions like zero means no

permission at all. One means the execute

permission. Two means the write

permission and four means the read

permission. So here we have used the

command ch 7. So seven here means read

write execute all the three four 2 and

1. So read execute for the user. The

second seven is for the group and the

third seven is for any other users or

the groups. So this was the chmod

command and I hope you have understood

this command.

So let me just clear the terminal. So

the next command that we are going to

talk about is the lsof command. So while

working in Linux or Unix based system

there might be several files and folders

which are being used. Some of them are

visible and some of them are not

visible. So lsof stands for list of open

files. So this command provides a list

of files that are opened. Basically it

gives the information to find out the

files which are opened by which process.

So with one go this command lists out

all the open files in the output

console. So the syntax for this command

is pretty much simple. Let us just type

ls.

So as you can see here this is the list

of open files

these many files. Okay. If you scroll.

So here you observe there are details of

which files are opened. The process ID,

the user associated with the process. FD

stands for file descriptor. Size of the

file altogether gives detailed

information about the file opened by the

command, the process ID, its user and so

on. So cwd here stands for current

working directory. Okay. Txt stands for

the text file obviously. So say for

example if you want to know the list of

all files opened by a particular user.

So there are several users of a system

and each user can have different

requirements and accordingly they use

files and devices. So to find a list of

files that are opened by a specific

user, you can use the command say for

example lsof

hyphen u and the username say for

example edureka.

So these are the lists of file that are

opened by the user edureka.

Let me just clear the terminal. So then

next command that we are going to talk

about is the id command. So the ID

command in Linux is used to find out

user and the group names and numeric IDs

of the current user or any other user in

the server. So this command is used to

find out a few important things such as

the username and the real user ID. Find

out the specific user's UID, show the

UID and the groups associated with a

user. List out all the groups a user

belongs to and display the security

context of the current user. The syntax

for this command is pretty much simple.

ID, the flag, and the username.

Okay, so there are a few flags that you

can use with this command. The first

flag is the hyphen G. So the command

would be ID - G and the username. So

this command prints only the effective

group ids whereas ID - capital G prints

all the group IDs. ID - N prints the

names instead of numbers and ID - R

prints real IDs instead of numbers. ID -

U prints only the effective user ID. ID

- help displays the help messages. ID -

version displays the version

information. So without any option it

prints every set of identified

information that is the numeric IDs. So

what you need to do here is simply type

ID and press enter. So as you can see

here it displays the UID for this user

Edureka the group ID and the group that

he belongs to and the respective group

ids as well. So say for example if you

want to know the user ID for this user

called Edurea ID- u Edurea.

So 1,00 as you can see here user ID is

1,00 and group ID is also 1,000. Let me

just verify this. The command for that

is idy-g

okay

1,00 as you can see here. So to find out

all the UIDs and the groups associated

with the user. So say for example

there's another user called Arvin. So ID

Arvin.

So as you can see here the outputs user

ID group ID and the groups that he

belongs to. So this was about the ID

command.

So the next command that we're going to

talk about is the tar command. So the

tar command is used to zip and unzip

files of the tar format. So let me just

show you the syntax for this file. So

say for example if you want to zip a

folder. So for that the command is tar -

cvf space file name

and the folder name source folder name.

So this was a very easy syntax for the

tar command and say for example if you

want to unzip a file. So in DevOps while

installing something you might be

getting a file in the tar format while

unzipping that file you can use this

command tar - x bf and the tar file

name.

So you can use this command to unzip a

file. So this was about the tar command.

The next command that we are going to

talk about is the cut command. So cut

command is used for extracting a portion

of a file using columns and delimiters.

So say for example if you want to list

everything in a selected column then in

this case you need to use the hyphen C

flag with the cut command. So say for

example let me just see here. So there's

this file called

So let me just show you how do you use

this command. So let us first see what

are the files present here. So say for

example this file demo 1

txt. Okay. Okay. So this file has these

lines A11 B22 and C3. So say for example

if you want to display only two columns

like A1, B2 and C3 from this file. So

using cut command we can do it. So the

syntax for doing that is very simple.

Cut - C1 - 2 space the file name. So the

file name is demo 1 txt. So hyphen C

here stands for the column and which

columns? One and two column. Okay. So

just press enter. Okay, as you can see

here, it will display these two columns.

So, say for example, you want only one

column and not the two columns. So, just

remove this two hyphen C1. Press enter.

So, you you can see here A B C only the

first column is displayed. Okay. So,

this was about the cut command. So, the

next command that we are going to talk

about is the SE that is set command. So

zed is a text editor which can perform

editing operations in a non-interactive

way. So set command gets its input from

a standard input or a file to perform

the editing operations on a file. So set

is a very powerful utility and you can

do a lot of file manipulations using

said. So say for example if you want to

replace a text in a file by searching it

in a file you can use the set command

with the substitute s flag small s to

search for the specific pattern and

change it. So say for example let me

just show you an example here there's

this file called demo. So set test.

Okay. So cat let me just see the content

this file set test

dot txt.

Okay. So here it says how are you bubb.

So say for example I have to replace

this bubban by any other name. So I can

use the sed command here. sed space

single quote s that is the flag that you

can use with this command. So the word

that you want to replace and the new

word chan. Okay. And the name of the

file obviously s e d t e s txt.

So as you can see here first it was how

are you babban and now it is how are you

chugan. So this was the command sed. I

hope you have understood this command.

Let me just clear the terminal. Okay. So

the next command that we are going to

talk about is the unique command. So

unique command is used for filtering out

the duplicate lines in a files. So the

syntax for this command is pretty much

simple. So say for example you have to

remove all the duplicate lines from a

file. So you can use this command unique

and the file name.

So this was a very easy command. The

next command that we are going to talk

about is the watch command. So watch

command in Linux is used to execute a

program periodically showing output in

full screen. This command will run a

specified command in the argument

repeatedly by showing its outputs and

errors. By default, the specified

command will run every 2 seconds and

watch will run until interrupted. So the

syntax for this command is very simple.

You just have to type watch the flag and

the command.

Let me just show you an example using

this. So there's this flag called hyphen

d that you can use with watch. So this

parameter hyphen d highlights the

differences between the successive

updates. The options will read the

optional arguments which changes the

highlight to be permanent and this

allows the user to see what has changed

at least once since the first iteration.

So let me just type hyphen d watch

hyphen d free

m

free command we have used we'll see what

free command is in the later part of

this session. So the next command that

we're going to talk about is the eval

command. So, eval is a built-in Linux

command which is used to execute

arguments as a shell command. So, it

combines arguments into a single string

and uses it as an input to the shell and

execute commands. So, the syntax for

this command is very simple. Eval and

the arguments. So, let me just show you

an example of eval command here. So say

for example you have to type eval -

help eval help. This command shows the

description of the eval command itself.

So as you can see here. So let me just

clear the terminal. So the next command

that we are going to talk about is the

history command. History command is used

to view the previously executed

commands. This feature was not available

in the bond shell. Bash and con shell

support this feature in which every

command is executed and is treated as

the event and is associated with an

event number using which they can be

recalled and changed if there's a

requirement to do so. So these commands

are saved in a history file. So in bash

shell history command shows the whole

list of commands. So say for example

just type history here press enter. So

this is the list of commands I've used

till now. 400 500 plus commands I guess.

Yeah 584 commands I've used. So say for

example if you want to see only last

five commands that I've used. History

space 5. Press enter. So these are the

last five commands that you have used.

Can can see here.

Let me just clear the terminal. Okay. So

the next command that we are going to

talk about is the dd command. So DD is a

command line utility for Unix and Unix

like OS whose primary purpose is to

convert and copy files. The command line

syntax of DD differs from many other

Unix programs in that it uses the syntax

option

equal to

value.

So this syntax option equal to value is

used for its command line operations. So

I'll show you just a practical example

of this command. So say for example you

have to back up the entire hard disk. So

to back up an entire copy of a hard disk

to another hard disk connected to the

same system. So this command dd can be

used. In this command the unit's device

name of the source hard disk is say for

example the source hard disk name is dev

hda and the target hard disk name is dev

hdb.

So how do you use this command? DD d

space if I if stands for input file

space the name of the source or disk. So

it is dev space hda

and I just forgot to place equal to sign

here as discussed earlier it has a

syntax of option equal to value. So

input file is this the source file and

the output file of is

dev/

hdb.

So as of now we are not copying

anything. So but I'm just showing you

how to use this command. So input file

and output file should be mentioned very

carefully just in case you mention

source device in the target and the vice

versa you might lose all the data. I

hope you have understood this command.

Okay. So there's one more command that

we talked about like the free command.

Okay. So the free command displays the

total amount of free space available

along with the amount of memory used and

swap memory in the system and also the

buffers used by the kernel. The syntax

for this command is very simple. Free

space or options you can see. So let me

just type free command here and press

enter. So as you can see here total

installed memory that is present on the

system. So used means the used memory

and free means the unused memory. Shared

displays the memory used by the temp

folders. Buffer displays the memory used

by the kernel buffers. And cached

displays the memory used by the page

cache and the slabs. And buffers/cache

displays the sum of the buffers and the

cache. And there are a few flags or

options that you can use with this

command that is hyphen B. The command is

free-b. So it displays the memory in

bytes. If you use hyphen k this displays

the amount of memory in kilobytes which

is by default hyphen m displays the

amount of memory in megabytes and hyphen

g small g displays the amount of memory

in gabytes. I hope you have understood

this command free. So let me just clear

the terminal. Okay. So the next command

that we are going to talk about is the

SSH command. So while working in DevOps

you might frequently use this command.

the SSH command. So SSH means that

secure shell. Okay. So this command

refers to a cryptographic network

protocol for operating network services

securely over an unsecured network.

Typical use cases include remote command

line execution. But any network service

can be secured with the command ssh.

So say for example if you have a master

node and the slave node. So if you are

running this command, the command that

I'm going to type now on the slave node,

this will give you access to the master

node. So the command for that is very

simple. SSH and the master's IP address.

So if you run this command on the slave

machine, it you can get access to the

master machine. And vice versa, if you

execute this command on the master

machine along with the slave IP, you can

get access to the slave machine. So

there's one more command called SSH key

gen.

So this command is used to generate a

public private authentication key pair.

So authentication keys allows a user to

connect to a remote system without

supplying the password. So keys must be

generated for each user separately. So

if you generate key pairs as the root

user only the root user can use those

key. So the syntax for creating pair of

keys is very simple. So you need to type

sshen key gen space- t and rsa. Press

enter.

Here you can press enter. It says it

already exists. So I want it to

overwrite. Press enter. Enter past

phrase empty for no passphrase. Enter

passphrase. Press enter. Press enter.

Okay. So the key has been generated. As

you can see here, hyphen t option here

is used to specify the type of key that

you have to create. So you have the

option of specifying the passphrase to

encrypt the private part of the key. So

if you encrypt your personal key, you

must supply the passphrase each time you

use this key. So in this case we have

just pressed enter. We haven't passed

anything in the passphrase. So this

prevents an attacker who has access to

your private key and can impersonate you

and access all the computers you have

access to from being able to do so. So

this was about the command SSH key. Let

me just clear the terminal.

So the next command that we are going to

talk about is the IP command. So the IP

command in Linux is present in the net

tools which is used for performing

several network administration tasks. IP

simply stands for internet protocol. So

this command is used to show

manipulative routing devices and

tunnels. It is similar to the if config

command. Okay. The next command that we

are going to discuss is the if config

command. So if config that is interface

configuration command is used to

configure the kernel resident network

interfaces. It is used at the boot time

to set up interfaces as necessary. After

that, it is usually used when needed

during debugging or when you need a

system tuning. Also, this command is

used to assign IP addresses and net mask

to an interface or to enable or disable

a given interface. So, the syntax for

this command is very simple. If config

space options

or and space the interface.

So there are two options that you can

use with this command that is ifconfig -

a. So this option is used to display all

the interfaces available even if they

are down. So if you use this command if

config a. Okay. So you can see all the

interfaces that are available.

Okay. Yeah. And there's one more command

called hyphen s. So if you type if

config

- s so this displays a short list

instead of all the details.

So this was about the if config command.

So let me just clear the terminal. Also

if you want to know the IP address of

your machine you simply need to type if

config press enter. Okay.

As you can see here this is the IP

address of your machine. So to know the

IP address of your machine, you just

need to use this command if config. So

let me just clear the terminal.

The next command that we are going to

talk about is the IP command. So IP

command in Linux is present in the net

tools which is used for performing

several network administration tasks. So

IP stands for internet protocol. This

command is used to show or manipulate

routing devices and tunnels. It is

similar to the ifconfig command but it

is much more powerful and more functions

and facilities attached to it. If config

is one of the deprecated commands in the

net tools of Linux that has not been

maintained for many years. IP command is

used to perform several tasks like

assigning an address to a network

interface or configuring network

interface parameters and so on. So it

can perform several other tasks like

configuring and modifying the default

and static routing, setting up a tunnel

over an IP, listing IP addresses and

property information, modifying the

status of the interface, assigning,

deleting and setting up IP addresses and

routes. So let me just show you a

practical example of IP

space

address.

Okay.

So this command is used to show all the

IP addresses associated on all network

devices. So as you can see here, these

are the various network devices and

their IP addresses. Yeah. So there's one

more command called

IP space link.

So this command is used to display link

layer information. It will fetch

characteristics of the link layer

devices currently available. Any

networking device which has a driver

loaded can be classified as an available

device. So IP- link press enter. Okay.

So this is the output. These are the

available devices and the link layer

information as you can see here. So let

me just clear the terminal. So the next

command that we're going to talk about

is the net stat command. So net stat

command displays various network related

information such as network connections,

routing tables, interface statistics,

multiccast memberships and so on. So the

syntax for this is very simple. For

example, netstat

net start

and hyphen a.

So as you can see here if you use this

command net a. So it is used to show

both the listening and the non-listing

ports that are available. So this

command is used to show both the

listening as well as the non-listing

sockets. And there's one more command

called net start-

a.

So this command will list all the TCP

ports that are available. So as you can

see here, these are the TCP ports. So

this was about the net start commands.

So the next command is the NS lookup

command. So NS lookup stands for name

server lookup. This is a useful command

for getting information from the DNS

server. It is a network administration

tool for quering the domain name system

to obtain domain name or IP addresses,

mapping or any other specific DNS

record. It is also used to troubleshoot

DNS related problems. So the syntax for

this is very simple. Simply type ns

lookup

and the option.

Let me just type nsookup. Say for

example google.com.

So it is giving you the details of this

domain google.com the server the

address. So if we type this command like

ns and the domain name. So this will

display a record that is IP address of

the domain as you can see here. So this

command queries the domain name servers

to get all these details. So this was

about the NS lookup command. Let me just

clear the terminal. So the next command

that we are going to talk about is the C

URL or curl command as you can see. So

curl is a command line tool to transfer

data to or from a server using any of

the supported protocols such as HTTP,

FTP, SCP, SMTP and so on. So curl is

powered by a lip curl. So this tool is

preferred for automation since it is

designed to work without any user

interaction. So curl can be used to

transfer multiple files at once. So the

syntax for this command is very simple.

Curl hyphen space I repeat curl space

options

and the URL.

So there's one parameter or the option

that you can use with this is hypheno.

So this parameter saves the downloaded

file on the local machine with the name

provided in the parameters. So this was

about the curl or the curl command.

So the next command that we are going to

talk about is the AWK command. So AWK is

a scripting language used for

manipulating data and generating

reports. The AWK command programming

language requires no compiling and

allows the user to use variables,

numeric functions, string functions and

logical operators. So, AWK is

abbreviated from the names of the

developers that is AHO, Venberger and

the Kigan. So, the syntax is pretty much

simple. I'll show you how do you use it.

So, say for example, let me see the list

of files that we have. Okay. So, C abc

txt. So, let us just see the contents of

this file. A bc txt. Uh let's just see

another file. demo demo1.txt.

Okay.

Demo1.txt.

Okay. So I'll just show you how do you

use this command. So say for example you

want to print every line from a

specified file. So we can use this

command AWK single code curly braces.

Okay. And the name of the file. So say

for example AWK test.

Okay. So this was the file. This has

only two lines. Okay. So if you want to

print every line from a file so you can

use this command AWK.

So say for example I'm looking for a

specific pattern in a file. So say for

example AWK

I'm looking for the word. Okay. So let's

consider this file itself in single

quotes. I'm looking for RAM and I want

to print it

and the file name awk test dot txt. So

it will print any of the lines that has

this word ram.

Press enter. Okay. So these two lines

have this word ram. So it has printed

both these lines. So this was another

use of awk.

So the next command that we are going to

talk about is the tr command. So tr

stands for translate. So this command in

Unix is a command line utility for

translating and deleting characters. It

supports a range of transformations

including uppercase to lower case

squeezing repeating characters, deleting

specific characters and basic find and

replace. It can be used with Unix pipes

to support more complex translations.

Okay. So I'll just show you an example

of the TR command. So say for example

this file called AWK test. Okay. So let

us just see the contents of this file.

Now we'll try some other file

CBA. TXT.

Okay. So let us just say we want to

convert this into uppercase everything

into uppercase.

Here we want to display this. Hi, this

is Edureka in upper case. So for that we

will use the command CAD the file name

CBA

dot txt

and the pipe symbol

TR space double quotes

A2 Z

space and the

capital A2 Z.

Okay. So this is the syntax for doing

this.

Press enter. As you can see here,

everything has been converted to

uppercase. So this is one of the usage

of the TR command.

So let me just clear the terminal.

The next command that we are going to

talk about is the env command.

ENV command is used to print environment

variables. It is also used to run a

utility or a command in a custom

environment. In practice, ENV command

has another common use. It is often used

by shell scripts to launch a correct

interpreter.

In this usage, the environment is

typically not changed. So, say for

example, I have to see a list of all the

environment variables that are present

on my system. So, I'll simply type env.

Okay. So, these are the list of

environment variables that are present.

Say for example, if you want to run a

command with an empty environment. So

for that the syntax is envy-en

I and the command. Okay. And uh say for

example if you want to remove a variable

from the environment.

So for that the syntax is env

and the variable

name. Okay.

So I hope you have understood this

command env. Let me just clear the

terminal.

So the next command that we are going to

talk about is the IP tables command. IP

tables is a command line interface used

to set up and maintain tables for the

net filter firewall for the IP v4

including the Linux kernel. The firewall

matches packets with rules defined in

these tables and then takes the

specified action on a possible match.

So I'm going to tell you the usage of

the IP tables commands. So say for

example while working in DevOps for some

reason you need to disable the

firewalls. So for that this command IP

tables can be used. Say for example

service

service IP tables

stop. So this command can be used to

disable the firewalls.

Okay. So this was uh one use of the

command called IP tables. Okay. So as of

now we are not running this command on

our system. So the next command that

we're going to talk about is the appget

command. So appget is a command line

tool which helps in handling packages in

Linux. Its main task is to retrieve the

information and packages from the

authenticated sources for installation,

upgrade and removal of packages along

with their dependencies.

So APD stands for advanced packaging

tool. So if you're using Ubuntu based

systems, so here the command appget can

be used. While if you're someone who's

using the Red Hat based system such as

the CentOS, so in that case you need to

use the command yum. Okay. So the syntax

for this command is very simple like apt

get

the options

or the flags and the command.

Okay. So say for example I have to

install something on my machine.

So I'll use the command sudo

app get

install.

Say for example I want to install this

image editor called pinta. Okay. So I'll

just type pinta. s p s p s p s p s p s p

s p s p s p s p s p s p s p s p s p s p

s p s p s p s pseudo apt get install and

pinta. Okay, so this was about the apt

get command. The next command is the df

command and the disk usage command. The

df or the disk free command reports the

amount of available disk space being

used by the file systems. The du or the

disk usage command reports the size of

directory trees inclusive of all their

contents and the size of individual

files. The aim is to make sure you are

not overshooting the 80% threshold. If

you exceed the threshold, it is time to

scale or clean up the mess because

you're running out of the resources. So

the syntax to use this command like uh

if you want to see the disk free space

in a human readable format you can use

the command df

s p s p s p s p s p s p s p s p s p s

pseudo df - h

okay okay so this is the disk free

command that we are using and we can see

here the output size available size used

available memory percentages and the

mounted location.

So, but in most cases you want to check

which part of your system is consuming

lots of disk space. So the command for

doing that is

sudo

du - h

- d

1 and the b r.

So as you can see here this location it

is consuming a lot of disk space.

So this was about the df and the do

command.

So now let us talk a bit about shell

scripting. So first and foremost

question what is a shell? So an

operating system is made up of many

components out of which two are very

prime components and these components

are the kernel and the shell. So a

kernel is at the nucleus of a computer.

It makes the communication between the

hardware and the software possible.

While the kernel is the innermost part

of an operating system, a shell is the

outermost one. A shell in a Linux OS

takes input from you in the form of

commands, processes it and then gives an

output. It is the interface through

which a user works on the programs,

commands and scripts. A shell is

accessed by a terminal which runs it. So

whenever you run the terminal, the shell

issues a command prompt where you can

type your input which is then executed

when you hit the enter key. So the

output or the result is thereafter

displayed on the terminal. The shell

wraps around the delicate interior of an

operating system thereby protecting it

from accidental damage. Hence it is

named as shell. So there are two types

of shell basically the bond shell and

the C shell. So the prompt for the bond

shell is shown by the dollar symbol and

its derivatives are pix corn and bash.

Pix shell is also known as SH. Con shell

is also known as SH and the bornag again

shell is now known as bash. And the bash

is the most popular shell. The second

type of shell is the C shell. And the

prompt for this shell is shown by the

percentage sign. And there are two

subcategories for this that is the C

shell which is also known as CSH and the

top C shell which is also known as TCSH.

So now the question is what is shell

scripting? So shell scripting is writing

a series of commands for the shell to

execute. It can combine lengthy and

repetitive sequences of commands into a

single and a simple script which can be

stored and executed any time. So this

reduces the effort required by the end

user. So let us understand the various

steps in creating a shell script. So

what you do is first you create a file

using the vi editor or any other editor

and you name the script with an

extension.sh.

So we will also have a look at it like

we will execute a shell script but I'll

just tell you a few steps of how to do

it. Then we have to start the script

with the symbol such as hash exclamation

mark and the /bin /sh.

So hash exclamation is an operator

called the shebang which directs the

script to the interpreter location. So

if we use the command hash exclamation

mark/bin/sh

the script gets directed to the bond

shell. Then once we open this file, we

have to write some code. We have to save

it. And for executing, we have to just

type the command bash and the file

name.sh.

I'll just show you how do you do it.

Here I have the g terminal or the g bash

opened here. So we have to type say for

example abc.sh.

We have to write something here. So what

we'll do is I have a simple program

which calculates the sum of the digits

of a number. It accepts a number from a

user and it calculates the sum of its

digits and it displays the result. So

this is a very simple program. I'll just

write it here.

I'll just save it. WQ. Okay. So it is

saved. And now we have to just run this

script using the command bash. Let me

just check whether I have inserted.

Okay, so we are missing out on a very

important thing here. We have to type

shebang operator. Okay, so hash

exclamation/bin

/sh.

We have written whatever we wanted.

Okay, so we have saved it and now bash a

b c.sh.

So it says enter a number 88.

So the sum of digits of 88 is 16. So

this is how you write a shell script and

you run a shell script. So this was a

very simple program but you can write

any program that you want and you can

run it using the bash. So we have come

to the final part of this session that

is the git commands and before knowing

the git commands we'll quickly brush up

a few things about git. What is git? So,

Git is a free open-source distributed

version control system tool designed to

handle everything from small to very

large projects with speed and

efficiency. So, Git has the

functionality, performance, security,

and flexibility that most teams and

individual developers need. It also

serves as an important distributed

version control tool that is used in

DevOps. Tools like Git enable the

communication between the development

and the operations team. So whenever

you're developing a large project with a

huge number of collaborators, it is very

important to have communication between

the collaborators while making changes

in the project. Commit messages and git

play a very important role in

communicating among the team. The bits

and pieces that we all deploy lies in

the version control system like git. So

to succeed in devops, you need to have

all the communication in the version

control and hence git plays a very vital

role in succeeding at DevOps. So this

was the definition of git and uh this is

the diagram that you must remember like

the working directory, the staging area,

the local repository and the remote

repository. You just need to remember

these things. So if you remember these

things then you will get a clear

understanding of what command is used to

do what things. So now we will have a

look at few of the g commands like as

you can see here we will cover a few

commands get config get init and so on

and few of these commands as well. Now

let us go to the get bash. So the first

command that we will see here is get

config command. Okay. So this command

sets the author name and the email

address respectively to be used with

your commits. So how do you do it? The

syntax is pretty simple like get get

config

hyphen global

user.name name

and the name say for example Edureka in

my case let's just say Arvin okay

this is the syntax that is used hyphen

global previously I just typed a single

hyphen there are two hyphens here you

have registered the username and now you

have to register the email so that is

get config

- global

user dot email

and the email address that is ervand

at ureka.co.

Okay,

so this works fine.

So the next command is the get init

command. So this command is used to

start a new repository. So this is a

very simple command. Simply type get

init like you can type the name of the

repository if you want else it will

initialize an empty repository without

any name. Okay. So here as you can see

here on desktop it has created a

repository

get a repository has been created on the

desktop with our command. So the next

command is the get clone command. So

this command is used to obtain a

repository from an existing URL. Say for

example uh let me just show you. I'll

clone a repository from my GitHub

account. Okay. So say for example this

is the repository game of life which is

available on my GitHub account. To clone

that URL I'll have to first go to this

tab clone or download. Click here and

then you'll get a link. Okay. Copy that

link clone with https. Okay. Copy that

link and paste it here. Get clone and

the repository. Paste.

Press enter.

Okay. So the repository is being cloned

here

and u it is still working and it is

done. Okay. So as you can see here the

game of life repository has been cloned.

So this was a very easy command.

Let me just clear the terminal. So the

next command is the get add command. So

this command adds a file to the staging

area. And the command for that is very

simple. Get add and the file name.

So this is a syntax for the add command.

And suppose if you have more than one

file to add to the staging area, you can

simply use the star option. Okay. So it

will add everything like more than one

files or multiple files. So this was

about the get add command. The next

command is the get commit command. So

this command records or snapshots the

file permanently in the version history.

So the syntax for this command is get

commit

hyphen m and any of the message that you

want to type.

Okay. So with each commit you can type a

message to notify. So this is the syntax

for this command. Let's just say there's

one more command called get commit- a.

So there's one more flag with this

command hyphen a. So this command

commits any files you have added with

the get add command and also commits any

files you have changed since then. So

this is the syntax for this command. Get

commit - a. Similarly there's one more

command like as you have seen earlier in

the Linux command. The rm command get rm

the file name. Okay. So this command

deletes the file from your working

directory and stages the deletion. This

was very easy command. get rm.

Similarly, there's one command called

get show

and here you have to specify the commit

id. Okay, so this command shows the meta

data and the content changes of the

specified commit. So this was about the

get show. The next command is the get

remote command. So this command is used

to connect your local repository to the

remote server. So for that the syntax is

very simple. Say for example get remote

add the variable name

and the remote server link.

This is the syntax to use the get

remote.

If you want to delete a branch on your

remote repository, so how will you do

it? So there's one command called get

push

origin

the remote server and the branch name.

Say for example B2 is the branch name.

So the next command is the get pull

command. So this command fetches and

merges changes on the remote server to

your working directory. So the syntax is

pretty simple. Get pull and the

repository link.

So this is a very simple command. The

next command that we are going to talk

about is the get branch command. This

command lists all the local branches in

your current repository and its syntax

is very simple. Just get and branch.

This is a very simple command and if you

want to create a new branch so for that

the command is get branch. Say for

example the new branch that you want to

create. So get branch and branch name.

And if you want to delete the feature

branch. So for that the command is get

branch - d and the branch name. Say for

example B1. So this was the usage of the

get branch command. The next command is

the get checkout. So this command is

used to switch from one branch to

another branch. And the syntax also is

very simple. Get checkout

and the branch name where you want to

switch. Okay. let's say for example B1

or B2 or even master.

So this is one use of checkout. So if

you want to create a new branch and you

want to switch to that branch. So for

that the syntax is get checkout - B and

the branch name B4. So this command

creates a branch and also switches to

that branch. There's one more command

called get merge.

So what this command does is this

command merges the specified branch

history into the current branch and the

syntax for that is get merge and the

branch name

branch name. So this is a very simple

command like get merge and the branch

name. There's one last command that we

will have a look at that is get rebase.

So what this command does is this

command will move all your work from

your current branch to the master

branch. They look like as if they are

developed sequentially but they are

developed parallelly. So the syntax for

rebase is get rebase and the branch

name.

So this was the syntax for get rebase

what a Linux file system is. Now when we

talk about Linux file system, the first

thing we need to know is what it is.

Right? So Linux file system is a set of

processes that controls how, where, when

data that is stored and retrieved from a

storage device. How do you store it?

Where do you store it? When do you store

it? All of those are basically taken

care of by the file system. Right? So a

good file system is extremely essential

for everyday system processes. Right? A

Linux file system is basically a

structured collection of different files

on a disk drive, right? Or a partition.

So what you can see is that the file

system helps in basically making all the

files present in the Linux system into

much more structured collected set of

files. And as you know in Linux

everything is a file. Be it your

devices, be it your applications,

everything in Linux is a file. Right? So

file systems on Linux basically control

how and where the data is stored along

with the fact that every partition

consists of file system of their own

just like in Windows you have C drive, D

drive and all of that based on name

spaces right in Python there is no CD

drive although you can have partitions

but these partitions will basically have

their own set of file systems right and

the main thing is that file systems

helps us store data systematically. So

this is what a Linux file system is.

Next up we talk about the different

types of Linux file system. Now when we

talk about the different fi types of

Linux file systems there are there are

approximately six types. The first is

the ext. So ext is basically ext 234

which basically stands for extended file

system. Now ext2 was the first Linux

file system that allows managing 2TB of

data. But at the current moment, ext4 is

the fastest file system that you can

have on Linux. Next up, we have the JFS.

JFS basically stands for the journal

file system. Journal file system is

basically developed by IBM along with

Unix, right? So JFS is an alternative to

the ext file system. Extremely

limited. The third kind of file system

that you have is the Razer FS file

system. So earlier Razer FS was used as

a default file systems for Linux SUV.

But now they shifted to ext3. But what

Razer FS does is that it dynamically

supports the file extension but has

certain performance drawbacks which is

why now people have again moved back to

EXC3 from Razer FS. So next up we have

the XFS. So when it comes to XFS you can

see that XFS was considered a high-speed

GFS which is the journal file system in

high speeded which is developed for

parallel IO processing. Now one example

where XFS is used is basically by NASA.

The next one is the BTRFS. Now BTRFS

basically stands for B3 file system. It

is basically a file system which is used

for fault tolerance repairs of the

system etc. Next up we have the swap

file system which is the last kind of

file system. So when it comes to swap

file system, swap file systems are used

for memory paging in Linux OSS, right?

So memory paging only comes into play

when there is the system hibernation

going on. So a system that never goes

into hibernate is required to have swap

space equal to RAM space, right? So swap

space is always equal to RAM space for

systems that never go into hibernation.

Up next we have the file system

architecture. Now when we talk about

architecture there are a lot of things

we need to know. Let's let's get going.

The first thing you need to know about

the file system architecture is that it

is a hierarchical file structure and it

can manage and provide for non

nonvolatile storage data along with the

fact that the name space describes

logical structure of the f. I'll tell

you all about what all of these means.

And finally, we see that advanced

information about the partitions is

always stored. So let's say for example,

this is your architecture where you have

the kernel, you have the virtual file

system and you also have the different

file systems that you want right along

with the hardware in the end. So let's

go through what I just explained you. So

when I talk about hierarchal structure

what I mean is that this system

basically has a root directory and that

root directory has certain

subdirectories right. So all other

subdirectories can be accessed from the

root directory. So this is what

hierarchical structure means right. So

when I talk about uh the fact that it

can provide for nonvatile storage data

when I talk about nonvatile storage data

I talk about RAM I talk about ROM right.

So basically this file system is bas

designed in such a way that it can

manage and provide space for all

volatile data. Right? All systems

require a name space. So name space is

something that defines the naming

process, the length of the file name or

a subset of characters that you have. So

this nameace is also used for logically

defining the structure of the file that

you have. Right? And finally we see that

the data structure needs to support a

hierarchical directory structure right.

So the structure is used to describe the

available and use disk space right for a

particular block. So finally we see that

the advanced data that the structure

stores or represents contains

information about the file system stored

on the drive right. So this information

that is contained about the partitions

is completely distinct and independent

from other file system metadata. Now

let's look at this architecture we have.

So the file system requires an API to

access the function calls or to interact

with file systems. Right? So API

facilitates tasks such as creating,

deleting and copying the files. When I

talk about API, I mean application

programming interface. So the first two

parts of the given system file system

together make up the Linux virtual file

system and it provides a single set of

commands that you have. So next up we

talk about the different file system

directories that are there. So let's get

going. As you can see the topmost file

directory that you have is the root

directory and you can basically access

any of these other directories that are

there from the root directory itself.

You can see there's bin, dev, etc. USR,

home, lib, sbin, temp where all of these

files have certain functions, right? All

of these directories have certain

functions. They store some sort of

information about the system, right? So,

let's take a look at some of the file

directories that are there. So, starting

off, we talk about bin. Now, when we

talk about bin, the bin directory

contains mostly binaries. Now when I

talk about binaries, binaries is

basically some of the applications and

programs that you can run. So the ls

command which is basically the list of

the files that you have. So the ls

command that you have on Linux and other

basic tools are also present in this

directory which is the bin directory.

Right? Then we talk about the dev

directory. Now when we talk about dev

directory, we see that the dev directory

contains device files. Right? So many of

these are generated at boot time or even

on the fly, right? So you don't really

have existing device files already

present. So some of them are generated

on the fly or when you boot the system,

right? Next up we have the etc. Now this

is fairly important because unlike the

fact that etc stands for etc. here etc

stands for everything to configure. So

everything to configure because it

contains most if not all the systemwide

configuration calls right so all of the

users the passwords the machines that

are there on your network the user the

password all of these are present in the

etc directory uh then we have the home

directory so when we talk about home

directory you can see that you find your

users personal directories here for

example if let's say home/cor contains

my directories home/get guest will

contain another guests directory on the

same system. Then we come to lib. Now

lib is basically short for libraries.

All the libraries are found in this

directory. Libraries are basically files

containing code that your application

may or may not need during runtime.

Right? So the library under root it

contains all the important kernel

modules. As you can see there are two

different lib directories. So one is

under root and one is again under where

right now before we get to that we can

see another directory which is the media

directory. Now as you can understand

media directory is the directory where

external storage will automatically be

mounted when you try and plug it in or

try to access it. Right? So media

directory is the directory where if you

connect storage device or an SD it'll

automatically get mounted in your

system. Right? So these are the basic

directories that are there. Let's move

on to features of Linux file system. Now

when I talk about features, the basic

three features that I can think about is

the fact that Linux is case sensitive.

Now case sensitivity is because of the

fact that it distinguishes between

lowerase and uppercase characters,

right? So there can be a file which is

named T S text with T capital and there

can be another file which has got the

same name but none of the capital

letters. So these are two different

files in Linux right you don't need to

rename them you can have case sensitive

files. Next up we can see that Linux has

various hidden files that are there. Now

Linux distinguishes between standard

files and hidden files. Most

configuration files are hidden in Linux

OS. Right? So usually we don't need to

access or read these hidden files. The

hidden files are represented by a dot

before they are filed in. Right? So I'll

show you how you basically access hidden

files or you can basically check out

where the hidden files are. Next up we

see the different partitions,

directories and drives that are present

in Linux. Right? So Linux does not use

drive letters to organize the drive as

Windows does. Right? Like local dis C,

local disc. Linux does not have that. In

Linux, we cannot tell whether we are

addressing a partition, a network or an

ordinary directory because all of the

files, all of the directories that are

there, every application, every uh

device, all of everything that you have

is a file, right? Even the file which

has different commands is a different

file. Even a command like ls is a

different file which is present in bin.

And we'll check that out in a while.

Right? So next up, let's come to the

demo for Linux file system.

So basically when you go into Linux,

this is your interface that you have. So

where can you find your files? You go to

files. You can also check out your

directories from the terminal. And that

is basically what we're going to do. Now

here here you can see that there are no

such partitions as such, right? You

don't have a C drive, you don't have a D

drive. So where do you find your system

files like in C? So you can just go to

other locations go to computer and as

soon as you go to computer you can see

that these are the files that are there

the bin file dev file etc home lib and

you can basically go into these files.

So basically some of these files have

restricted access. So let's just go and

see how you can access them through the

terminal. So you basically go to your

terminal and let's just check out check

out a few Linux commands now. So to

basically see the files that you have in

your system just type in ls right and if

you want to move into the directory you

have to put cd right choose directory

and let's say desktop right and then

let's say ls again. So this is basically

how you cd into the desktop directory.

Now if you want to move into another

directory all you need to do is the cd

space dot dot and you move back here and

if you see ls now you are back to square

one where you can choose anything else

right so if you want to clear this you

can just type clear

and you'll basically have your terminal

good is new right so basically you want

to know what is the user that you are in

called right so all you need to is type

in

right so this is the name of the user

that I have created and it's called KB

and all you need to do to find out which

user system you are currently on is just

type in who am I right moment you do

that your system user will be shown to

you so let's go back and check out

something else so now you basically see

if you type ls this is all the

directories that you have in your system

like we talked about bin with your bin

files with your library files the dev

file the etc home all of these are there

now what we can do is check out some of

these directories that we have ready so

let's get going so let's check out what

is there in the bin file that we have

right so let's do let's choose the

directory bin and choose it we can do cd

bin now we are side bin. Let's check out

the files that are there. So, as you can

see, these are the various files that

are present in the bin. Right? If you

can check properly, you will also see

that the ls command that we have is also

a file that is present in the bin file.

I repeat, in the bin directory. So, a

command itself is also a file. Now, this

basically shows us that everything in

Linux is basically a file. Right? Now

apart from ls I can show you some other

files which we talked about which are

directories as well like mount itself is

another file which is present in bit and

is a directory in itself as well. So as

you can see ls is a file. So let's go

back to our right. So let's now check

out let's clear this out. Right. So

let's check out this command called cat.

Right. So cat stands for concatenate.

Now what concatenate does is basically

takes any file and it shows you the

binary and whatever is there. So this is

basically the binary encoded file for

your ls file which is present in the bin

directory. Right? So even for a command

like this you will basically have a

binary encoded file which is there.

Right? So this is what cat does. It

takes a file and shows you the contents

of it. So the machine understandable

language that is this right now is shown

to you. Right? So let's go back and

clear this out.

Right? So let's now check out another

command which is a cb command. Let's say

you want to repeat let's say you want to

copy the contents of file into another

file that you make. Right? So let's

check out what you do for that and you

need the copy command which is written

by CP. So first you write sudo. So

sseudo is basically command which gives

you permission to access administrator

files. Files that you do not get access

to generally right. So sudo cp and ls is

the file I want to copy into my new file

which is korak. And that's it. It's been

copied. Now basically since I copied the

contents of ls into this new file which

is called korak. Let's see what happens

when you pseudo into Korak instead.

Right? So as you can see different files

in ls are basically now here copied into

the file which is called korok. Right?

So this is how you copy files. Let's go

back.

So next up let's just talk about another

command that we have called rm. Right?

So let's say sudo rm

ls right now let's go let's say ls. So

as you can see we've just removed the

file ls right first what we did is we

copied the contents of ls into gor and

now you can see we've removed file ls

and this is basically not there in the

directory anymore. Now basically as you

can see there's no ls. So let's check

out Korak because that's the file we

copied it into. As you can see, Korak

has all the files that were present in

the ls file, right? So to change that

back to ls, all you need to do is pseudo

cporak

and ls, right? And clear it out. And

let's just check ls now. Now if you go

check ls, now the copy of contents of

kor are now in ls. And that is how you

can basically copy paste any of the

contents in your folder into any other

folder. Right? So let's check out

something else now. So let's just try

something else. So since we know that

every single thing in Linux is basically

a file. So the command just like ls the

command cat is also a file. So can you

really concatenate

the cat folder? You can write cat. Let's

see what happen. Right. So this is

exactly what happens. You go on and on

and on and this is basically your cat

folder and it keeps on going until you

do this. So we'll just clear this out.

So you can basically concatenate the

concatenate file with the same command.

Right? So this is pretty interesting. So

let's not go check out some other

directories that are there. Right? So

cdv/ dot you go back go to ls. Let's

check out let's say your library

right or the sbin that you have.

So these are the sbin files that you

have. So let's check them out. Let's see

if we can really do something here.

Right. So there is this command called

add user which is also a file which is

present in the sbin directory. Right? So

let's see what happens when you have add

user.

So let's basically say we want to create

a new user. That is basically the

command for adding a new user. So let's

do sudo because you need administrator

permissions sudo and then add user

and let's say new user's name.

Right? So this is going to be

right. So basically what you need is

full name let's say

you can just

right so now you basically have created

a new user called dedurea which has a

full name of corp and you can basically

skip these you want to add all of the

room number workphone and home number if

you want to you can do that but the

entire point of this is to show you how

you create new user from an existing

user, right? So, basically, let's go

back and check something else out.

Right? Then, let's go back into the

directory and do ls. Let's check out

some other directories. Now, let's cd

into let's say user directory,

right? So, as you can see here, there's

a separate bin that is there here inside

the usr directory as well. So if we cd

into the bin directory that it has see

what's there. So as you can see the bin

directory is kind of similar to your

root bin directory that is there. Now if

you can check there are most of the

files that you see here are already

there in the root bin directory. Right?

So what is basically different and which

directory are you using when you

basically store files? where is the file

getting stored right so to do that you

will basically have to

type in this command let's say which ls

are you using so you use the ls command

which is stored in the user directory

right same let's go for which cat right

which concatenate same here in the user

directory which

cp so all of these are they're present

inside the user directory, right? And

not in the root bin directory that you

have. Although the files in the root bin

directory and your user bin directory

are kind of similar except there are

certain more files that are present in

the user directory. Right? So let's now

go check out some of the other

directories that are there. So let's

just cd back

cd back here.

Right. So let's check out some of the

other directories that you have. So the

boot directory will consist of files

that you have to boot right that you

need to boot. Now the temp directory is

the directory which has temporary files

that are present there right. The media

directory is basically the directory

which lets you connect or mount any

external storage device uh

automatically. So if you CD into media

and check out what's in there, there is

no other external storage device that is

in there right now. So there's nothing

in the media file also. So let's check

out some other directories that are

there. Right? So let's check out the

home directory. So home as we talked

about is the directory which contains

the user's personal directories. Right?

So if you l into this you will see that

there is another new user that's been

created which is right along with the KB

user that was there. Now this has only

been created because we've used the add

user command right so this is basically

showing you all the users that are

present. Now if you want to let's say ls

into them cd kb and ls into this you can

see that your personal directory and

files are here right so next up let's

just check out

some other folders let's cd

right

so let's check out dev which is the

devices Right? If you check out the

devices, so if you go into devices, what

you can see is SDA and SDA1. So these

these four that you see here are the

various virtual drives that you have,

virtual discs that you have on Linux,

right? So these are the various devices

you have. So if you go back, let's say,

let's clear it out. Right? So and

finally let's go check out what proc is

right. So this is basically a file which

is not really there. Right now proc is

basically something which is created

every time your system starts up. It's

not there when your system shut down.

Every time it starts up it has a file

called proc. Now this proc file will

basically have information related to

all the ongoing processes that you have

the memory management hardware

management hardware configurations. So

every Linux system has a proc file no

matter which version it is right

whenever you start up a Linux system you

will have a proc file. So let's go back

let's check out our network directory

now. So for network directory we have to

cd into etc. right

if you will as into this you can see

that networks right here. Now you can cd

into networks

right. So this is basically what you

have. This is your network. Now what you

need to find from here is the different

files that you have. So these are the

different files. Let's say you dive into

this,

right? And you listen to this. You can

have these files,

right? And you can just check the VPN

connection using let's say

cd

open.

Right. So finally what we'll do is check

out where the hidden files are there. So

you can just so as you can see this is

basically the computer where you have

all your directories and you have all of

these are visible and you have hidden

files because Linux allows you to have

hidden files. So to check out the hidden

files that you have, all you have to do

is Ctrl H, right?

All these are basically

right. So as you can see these are all

authenticated files and

so if you just go into this and do Ctrl

H, you can see the number of files that

are there have increased. Right? These

are other files that are there. Right?

So just to see the files which are

hidden in Linux, all you need to do is

Ctrl H.

Now let's talk about RPM. So the full

form of the RPM is Redhead Package

Manager. The files used by this program

have an extension of RPM. RPM was

originally created in 1997. It is free

and released under GPL license. It is

default packaging for distribution which

comes under RL centers Fedora etc. So to

maintain packages by maintaining I mean

adding updating deleting packages in RL

CentOS or Fedora we use RPM. So if you

want to install any package in CentOS

there are commands like RPM minus IBH

then the name of the RPM. For example,

if you have got MySQL RPM with version

5.7. So let us suppose the name of the

MySQL RPM is MySQL 5.7.

RPM. So this is just pseudo name which

I'm creating right now. So what you have

to do is RPM minus IBH and then the name

of the RPM file mySQL527.

RPM. It will install your package. So

let's check out the features first.

First feature is crypto. The packages in

Appium can be verified cryptographically

by MD5 checks sum and GPG key. So to

check the integrity of any file we have

got MD5 sum. So to verify that package

has not been changed from the source to

your machine we use MD5 and then to

authenticate that whether it is from

correct source and there's no one behind

the source and IP spoofing it and

getting into your system you need GPG

key so you take a GPG key from that

machine then install it authentication

source archives is also available which

helps in authentication so you helps

helps in patches also. Patches can be

applied which helps in updating the

process faster and easier. So if you

have patches you don't have to reinstall

your system. You just have to change

particular some few files and just to

rebuild it, restart it. It's not that

you again going to compile your whole

program and then going to restart. It is

automated and installation time

verification. It is done for the

dependencies like if I have got a

package and it is dependent on 15 or 20

different other packages. So it asks you

to download them to carry on with the

installation of your current package. So

basic tasks for RP is the basic task for

any package manager installation

updation uninstallation query and

authentication. So we need to check how

to install a particular package, how to

update an existing package, how to

remove the currently installed package,

get information about the package, what

is the version which it is using, things

which it depends on and then

authentication to verify the package for

the security reasons that the package is

from authenticated source. Red Hat

developed RPM packages can be found at

Red Hat Enterprise Linux CD rooms, Red

Hat network or Red Hat Erata page having

list of packages. So if you go to any of

this link on internet, I'm just going

over there and with I'm going to search

MySQL. So it gives me all the versions

of the MySQL. So it suggest that it has

found 95 RPMs very old ones 5.0 since

2009. So we can see there are the

packages MySQL client programs and C

libraries for 64bit machines. This one

is for 32-bit machine. I386 for i686.

x86 64 is for 64-bit architectured

machines. So there are different RPMs

for different machines. Now how to

install? So to install minus I is the

option but we probably go for V also

because it is the verbose mode and it

suggest that okay something is going on

because if you just install any RPM

package with RPM minus I it will be

installing it but there will be no

status bar in it that okay 100% this is

now 10% 20% 50% 100%. So to get that

feel that okay your software is being

updated or software is being installed

use verbose also and then print hash

marks of the package archive as as it is

unpacked we use minus h ussually we use

minus ih now check the rpm signature to

check the signature we have this command

minus minus check sig so it checks the

pgp signature before installing any

package if its integrity and origin is

Okay, because at the back background it

checks for your MD5 sum as well as your

GPG key. So if integrity and origin is

okay then one can go ahead install that

package. If you have any query on that

package minus q is the option. So it is

pretty straightforward till now. If you

want to have a query on package it's

minus q. If you want to install that's

little bit different when you want to

uninstall a package it is like eradicate

minus. So we will come up to that. It

checks the dependencies of the package.

If package is dependent on some other

packages to ignore these dependencies,

use minus minus node depths. So rp minus

q - node depths and the package name.

One can check if a particular package is

already installed or not. To do that

just add minus l. So minus l is for list

all the installed packages. So if it is

installed rpm minusql. Now to install

all the packages which are there to view

all the installed packages use minus

command. So RPM minus QA. So one can

list all the recently installed RPM

packages. One can shorten the list to

check for recently installed by adding

minus minus last which will return the

last package installed on the machine.

Upgrade up a package. You need to do it

minus u rpm minus uvh. V is again for

purpose and h for hash. So I minus uvh

and then your package will be upgraded.

Now to remove a package as we have

discussed it is minus e rather than

minus r or minus uninstall. So it is

like eradicate. To remove a package use

minus e option. In case you don't want

to remove the dependent packages you

just want to remove your package then

apply minus minus node deps in it. To

find the package to which particular

file belongs to use minus f in your

query. So f will give you file name. To

find the details about a particular

installed package again rpm minus 2 i

and the package name to verify an rpm

package use minus capital v p option

because small p v is for verbose. So use

minus hyphen capital v option. RPM

capital V P and package name will give

you the verification of the package. So

to verify all the packages use A rather

than P just remove P because P is for

specific package name. If you go for A

it will verify all the packages in the

system. So this RPM demo can be done on

CentOS or Fedora machine. Right now in

our setup you're using one. So let's

check it out how it is being done. So if

I'm going to install RPM minus IVH, you

can see those hashtags coming. So if

you're not using minus vh in there or h

is in there these will not be coming to

verify whether a package is there in the

files or not just use rpm minus minus

verify to query on a particular package

that what are the things which are there

in the package rpm minusql httpd. So we

know that httpd is there for hosting web

servers. So this is if you go to etc

folder this is how it looks when it is

being installed. So it gives you all the

files which is packaged in the RPM

folder and inside any RPM. Now let's

talk about Yum. So RPM was the package

manager. Yum is again the another which

is being used in the free versions of

the CentOS. So if you don't have that

RPM files and you want to install from

the source repository which you are not

because in RPM files you need to have

that RPM downloaded. If you don't want

to download RPM, you don't want to take

that headache of downloading. RPM from

internet, what you can use is you can

use yum. So yum was created in 2003 and

is primary choice for RPM based dro. So

wherever we are using RPM based dro like

Santos, Fedora, Yum is the repository

for it. We tend to do in Yum is we just

write the package name which we

understand. So I don't know the version

of my SQL. I just go for yum install

MySQL. It will search whether MySQL is

there in the repository. It will come up

with a specific version number. It will

suggest okay, it is there. Install it

via this command. When you do that, you

don't know where that RPM package is

kept or whether even RPM package is kept

or not. It automatically downloads that

package and installs it. So, installing

and updating the packages are simpler.

software dependencies are taken care of

and installed along with it because if

we are using RPM package we have to

install all those dependency by ourself

but in yum it is just like appgget it

will install all those dependencies. So

we have two things RPM and yum the same

thing which rpm and yum is is almost

synonym to dpkg and aptgate. So if you

want any package to be installed

manually in Ubuntu or any Dia Linux DBN

dro what we tend to do is we use DPG

command to install it and the extension

of the file is dep similar to what we

have in sent to us where we use the same

mechanism we use RPM minus IB and the

extension of the file is RPM and in the

same way the Y has replaced RPM to some

extent

Appgate has replaced DPKG to some

extent. So let's talk about Yum first.

The software dependencies are taken care

of and installed along with it. Yum is

primarily in command line interface but

GUI based wrappers also exist but it is

pretty simple in command line interface.

It's easy to use in command line

interface. It is the official package

manager of Red Hat and CentOS. So RPM is

there but this is the official package

manager. This is the package manager. So

RPM and Yum. RPM is the package manager

which installs the package while Yum is

the repository management tool which

will fetch the package. So to get MySQL

installed you need to find it on

internet where you can get RPM files.

But if you want to install it via you

don't need file. go yourself take the

pain by yourself and search it on

internet where the profile is downloaded

and then install it. So you don't need

to do that in the in here you just need

to list the files okay whether it is

listed or not if it is there in the

source repository you can install it and

you don't need to know what was the

source of it where it has installed that

headache is of yum repository yum

fetches appropriate package as required

by our our Linux which is compatible

with our Linux in RBM it can be that I

have like in centus 7 the default python

version is 2.7 but by mistake I go and I

don't use yum I install it via RPM and

install Python version 2.4 4 which is a

very old version so it is not

compatible. So to not to take care which

is not to take headache of what is the

compatible version of the software with

this Linux distro it is advisable to use

the repository manager. RPM can alert

you to dependencies but is unable to

source additional packages. So in RPM it

will check these are the dependencies

which need to be taken care of. It will

invoke a alert to you that you need to

install these packages first but it will

not give you the source directory or

source from where to get these services

or these packages. But yum finds out all

the dependencies and also the additional

packages installs them if you're

installing any package v. Yum by default

has multiple repository location in its

configuration file and it fetches

packages for installation. So how to

install using yum? Use command install

to install a package using yum. So if I

need to install anything just do yum

install python. I don't need to give the

version of it. If I'm going to use 2.4

2.6 like by default in py centtos 5 2.4

was there by default 2.6 was there in

centto 6. Now in centtos 7 it is 2.7.

But if you want to go for 3.5 3.6 6 or

3.7 of version of Python you need RBM

for that but via Yum repository or you

need to tweak Yum repository a bit you

need to go to the yum source repository

d and then tweak go over there so the

first syntax is yum install python it

will ask you if you are interested to

install this package or not just

question on it if you don't want if you

are writing a cell script and you want

it to be installed by itself just insert

minus y command the same thing happens

with appgget 2. Same thing happens with

yum 2. y minus y install package name

python. It will be installed and it will

suppress the confirmation question and

it will take the input as yes that okay

yes has been already been provided

install it automatically to remove yum

remove package name and again to provide

confirmation and suppress the

confirmation and automatically do is it

yum minus y then list package names. So

if you want to check whe the specific

package is there in the source

repository or not yum list any specific

package name. So it is checking for open

s which is my SSH server which listens

on port 22 and if you want to connect

from one machine to another there is a

service called user bin SSH.

So that enables you to SSH from one

machine to another machine which we just

had example of SSH username at the rate

your machine name IP. So that's the

package we are searching for. Yum list

open SSH. So to list all the available

packages installed use installed keyword

yum list installed and if you want to

check all the packages which are there

in yum repository just write down yum

list. Use command if you want to search

any package use command search to find

all available packages to match the name

of package specified. If I don't know

the exact version of it or exact name of

it, yum search SSH or open SSH anything.

So it provides the exact package name

which needs to be installed to find

which package provides a particular file

because if you are seeing some file in a

system which you haven't created and it

is there by some package. You can search

the originator package for the file name

using command yum provides file name.

again for updating any specific package

for right now I have using Python 2.6

six I want to update to Python 2.7 yum

update package name if that update is

available there it will update it

automatically and to check update for

which packages are available you can

write command yum check update if you

want to update the whole system just

like Ubuntu update update and update

upgrade was there yum update is there in

sent to us to list all the enabled

repository in yum we use command repol

so to check what are the repositories

which are there in my rum yum source

directory yum repol list to view both

enabled and disabled one because few

repositories are commented. So to check

all those yum list all to install a

specific repository yum minus minus

enable repo the repository name which

was disabled. So enable that repo and

the package name. So to view all those

commands the other few commands in yum

are yum history check what are the

things which you have executed in yum

previously yum clean all. So it removes

all the caset packages and header

created to resolve the dependencies. Yum

group list which lists yum groups group

info group installed and then group

remove demo about the yum commands which

we have just gone through. So we have

search we have checked that to list a

package it was the command yum list. So

we are just listing the package with yum

list open ssh. Now it is going for all

the packages all the repository it has

probably it is going to FTP server of IT

Madras. So FTPATM.ac.in

and from there it is checking for the

open SSH update a package. So again yum

update open SSH was there. So if there

are any update available as per the

source repository it will update it.

Install a package. This is a pretty cool

package in Linux. It enables you to run

all those executables of C of Windows

machine. So XPR FIFA fan or NFS fan. So

you won't be able to get those things on

Linux distributions because FIFA or NFS

doesn't supports Linux distributions. So

if you want to run Linux distribution

too, you just need to install wine. The

wine application enables you to run exe

also. So actually these windows files

are executable formats exe format. So

wine enables you to run your exe files.

So what it has done is y install wine

and then it will be installed. So right

now yum history tells you about what are

the things which have been done in last

time. So it says that yum history has

got 34 commands in it. Last one was

install libx11 development package and

before that it was update. So access is

also defined. Date and time is also

defined. Now how to search for a

package? So it is yum search open ssh

which it has been done. It is now

searching for the package. What are the

packages available with the name open

ssh. You can see there are many

different packages which are available

for open ssh. Choose any one of them.

OpenSS server, open SSHS client, LDAP,

gsi based, pearlbased, anything which

you want. If you just want to open ss

server on your machine, install using

open sss server x8664.

Now let's get back to DPKG. Debian

packages. DPKG is the main package

management system in Debian and similar

oss. It is used to install, build,

remove and manage packages. package for

it has an extension of deb at the end.

PPKG is low-level tool. Apt is commonly

used as highle tool as it can deal with

complex tasks involved in package

manual. The DPKG database is located

under where lib dpkg. So dpkg is almost

similar to what rpm is there in centtos

and yum is similar to what is apt get is

there in ubuntu. So how to install?

Again just like RPM we used to install

via RPM minus I. So similarly DPKG minus

I package name. So if I have that DBN

package with me like if I need to do any

installation via RPM I need to have that

RPM package. So similarly I need to have

DVN package to be installed by DPKG. So

I'm installing Python 2.7 DBN. So DPKG

minus I Python 2.7 deb. So to check

whether your dpkg demon package has been

installed or not you can use command

dpkg minus s python. It will check if

the package is installed and if it is

installed it will return. Again to list

package tpkg minus l package name. If

you want to list all the packages don't

add the package name. If you just want

the content which is being used in

python 2.7 file like the last time which

we saw for httpd we list all the file

names of httpd. Similarly over here we

did that with RPM minus QF. Now in this

scenario we can do it with DPKG minus C.

To remove a package just like in RPM we

did by RPM minus E. We have got DPKG

minus R the package name. And now it is

not required to give the Debian

extension of it. Now installing the

packages from the directory itself. So

we need to install all the packages

which are there in the directory minus R

because it will install all the package

recursively. So use command minus r and

then minus minus install and the

directory name. So it will install all

the packages which are there in the

directory. So if you have got 15

packages which you need to install, you

can do this. You can put all those 15

packages in the directory and then

install recursively using directory. You

don't need to give name of each and

every package at the time of the

installation. Now to update a package

like we have to update Python you need

to do dpkg minus u a specific package

name. Now let's check the demo. So gpkg

minus s python. Now let's check the dpkg

minus s python. So it suggest python is

not installed and has got no information

on it because this file has not been

installed using debian package. If I ask

app to install python for me, it will

check and install the python version to

2.7.

So now I have installed python 2.7. It

is unpacking and linking all those

libraries and processing things up for

me. Now let's do py dpkg. The thing

which I have done is dpkg minus s

python. Now it suggests package name is

python. Status installed. Okay,

installed. Priority is optional. It

gives all the information about the

package. I have done it get because I

don't have the tpn package right now

with me. So now dpkg minus l python.

Let's run this command and check what

does it give. So it gives me the python

version of 2.7.15. Now let's get to apt

because you would be using app package

manager very frequently rather than

using dpkg. Appget is the command line

interface to handle package using app

library. Just like the yum library it we

used to have sent to us. We have got app

library in debian based dros Linux

distros. It is the default package

management system for debian like dros

like Ubuntu. It is an efficient way of

handling packages in your system. Rather

than using TPKG it is advisable to use

app because dependencies are managed

automatically. Upgrades and removals are

handled carefully to maintain the

stability of the system and it has an

external UI support with tools like

synaptic aptitude. But right now we are

not using any tool like synaptic or

aptitude. We going via command line

interface. Now let's understand few

commands first. App cacher app cacher is

a command line interface to search for

app software packages. This tool is used

to search software packages and get

information about them. One can search

for a package without having exact name

of the package. If you even have some

pattern of it, you can get it from the

app cachet. The data is fetched from

different sources listed in sources list

file. So as we saw in yum yum repo list

was there. Similarly, we have app get

source list over here. So it has got a

number of links from where it searches

for its packages and installs it. where

cache app archives contains already

downloaded packages to avoid downloading

them again. If one needs to reinstall a

package after removing it. So now uses

of some of the app caching command. How

to list and search a package using app

caching? Use command package names to

list package starting with particular

string. So example if you just want to

search all the packages which are

starting with open might it be open SSL

might it be open SSH anything what you

need to do is apt cache package names

and open open SSL or Python anything so

that will fetch all the package names

you search for a package with a

particular name apt cass search python

use command show to get details about a

package if I want to get all the details

about specific package I would use apt

Caches show Python check the dependency

of a package like if I install Python

what are the other packages which will

be installed which are required in

support of Python to enable Python to

run. What are the other packages which

are required to run? We can get that via

app caches show package Python. Now to

update a package use app get update

specific package name. So if you are to

update Python we will be using app get

update Python. If we have to upgrade the

whole system app get update simple and

then if we want to install a package but

prevent from upgrading if already

installed use minus minus no upgrade

options. Now to install a package app

get install package name. It was for

updation. Now let's go how to install a

package. Rather than using update just

use app get install package name. If you

want to install multiple packages, app

get install multiple packages, Python,

MySQL, Open SSH, anything. And again,

you might need to provide minus Y with

it. In some of the previous version like

in 16.04, it used to ask for the

confirmation to install multiple

packages having a particular string use

wild card. So all the packages in the

source.list

which is having star name as regular

expression in it, it will install all

those packages. Now apppt get upgrade.

If you want to upgrade the system, you

can use command app get upgrade. It may

remove or update some of your installed

packages. If you want to upgrade only

some specific package of your system,

you can use appgget install python minus

minus will only upgrade python. It will

not upgrade its dependent packages. Now

if you want to remove app get remove

specific package name. If you want to

remove all the configuration files

associated with it, what app does is apt

stores the configuration file because in

future if you reinstall the package, you

don't have to take care of the

configuration again. But if you want to

remove configuration file along with

package, apt get remove minus minus

package. So removing a package doesn't

remove state configuration file to

remove configuration file along with it

append with purge option. Use command

download to download a package without

installing it. So if you are download

the package just get apt get download

python. So if you want to get into the

source code of any package because we

are using Linux distribution everything

is open source over here we can view

source code packages of any package. So

in that scenario we can use app get

source python. So it will unpack the

source code of the python. So to check

for the dependencies we can use command

apt get check. So if you have to check

the dependencies of Python packages

upgrade check Python to install build

dependencies use build options. So it is

there that whenever you are building

your product or any software where there

are many built dependencies of it to get

that apt get buildup Python. So let's

get into the demo of apt. So the first

thing is apt caches show package SSH. So

let's run it our own system. Apt caches

so package. Let us go for open SSH. So

it says there is no open SSH. Now we

have installed Python. Now it is showing

all the packages of the Python. A long

list. So what are the packages which has

it has installed? It has installed any

JSON that might be used for the JSON

conversion from dictionary to JSON in

Python. Mod Python modisgi. Modisi is

usually utilized for web servers. If

you're hosting your Python packages

online, Mod Visgy, Mod Python are being

used. So it lists all the packages which

are installed along with the Python

package. So rather than showing show

package, it is showing package names and

these are default commands. If I'm

writing package and using tab, it will

be giving package names by default. So

these are the package names which are

installed along with Python. So Python

RPM is there, cryptodoc is there, http

library is there, feed parser is there.

So there are many packages like that. We

have already seen how to install

package. Now check how to app get remove

minus minus purge python. So it is

asking me for yes or no. Let's do no.

And now what I will do is I'm just

appending minus y. Now it will not ask

me for yes or no. By default it has

taken that okay I have given a

confirmation for deletion of this

package as I have supplied minus y

command. If you can see the last line it

says purging configuration files. So all

the configuration files have been

deleted. Now let's try the previous

command app cacher package names. So you

can see even if I have not installed

these packages, these are getting from

the caches. It says that if you install

Python, these are the packages which

will be installed along with it. So you

don't need to install any package to

check what are the dependencies and what

are the files which will be installed if

I install Python. I'm going to install

app get install Python 3. So you can see

that I already have Python 3.6.5 in my

machine. So it is not installing Python

3 and it also suggest that few of the

packages are no more required this

Python 2.7. And if I run command app

auto remove it will clean my disk space.

It is suggesting that these packages are

no more required. Python 2, Python 2.7

minimal, Python minimal, lip python

standard library because I already have

Python 3.6.5 6.5 it's 18.04 2.7 is the

older version of it. So I don't need

these packages. Now I'm cleaning this

off. Let's try app get update. So you

can see it has gone to security.

Archive. Unbuntu.com. These are the

source list repositories which it has

and it is installing packages from

there. Now it is updating itself. It is

checking if any new version is there. It

will be updating itself. Now it is

reading the package list. Everything is

done. Similarly, if I want to upgrade,

it suggest me these many packages will

be upgraded if I run this command. So,

you can see how Linux community is

working. There's a lot huge community

and is working all day and there are

many updates coming every day. Now, it

has started upgrading it. So there are

commands like appgget check app get

install python with minus minus no

upgrade.

What is DNS? Well DNS stands for domain

name system and its main responsibility

is to translate internet domain and the

host names to IP addresses and vice

versa. Well, most of you might know that

every physical machine connected to the

internet is identified by an IP address.

But most of you might not know that

these IPs are unique only inside that

same domain. Right? And another fact

that you might not be aware of is that

when you type in a URL in your web

browser, then it uh you know

automatically gets converted to the

equivalent IP address of that server

which you're trying to access. Supposing

you're trying to access google.com, then

when you type in google.com in your

browser, then it would be automatically

converted to Google's IP address, right?

and only based on the IP address is the

system able to fetch Google's server and

display uh you know give you the results

on your screen.

Well, uh can anybody tell me why that

happens? Why do we do that? Why does

there why is there an internal

conversion into an IP address that

happens? Can anybody guess why that

happens?

Well, uh that is because uh the URL or

the fully qualified domain names like

google.com, facebook.com, yahoo.com, all

these uh.coms, right? These are the

addresses of any server or machine on

the internet. Okay? And uh they are

however only easy to remember by the

humans only for us. For computers

however it's easier to remember for them

it's easier to remember in the form of

IP addresses. So whatever we have

google.com has an equivalent IP address.

facebook.com has another equivalent IP

address. So every single uh site and

every single URL has an equivalent IP

address, right? They would be hosted on

a server and to access that server, you

have to access uh that server's IP

address. So that's how things work in

the background. And uh yeah

so this task of uh translating between

the IP addresses and the domain names is

what is done by this uh by this tool

called DNS. Okay. So the domain name

system does that and uh well it's a big

benefit and people nowadays might not

realize the thing okay any newcomers

might not know because without the

invention of uh DNS our lives would have

been very difficult because back in the

80s '90s at that time when we didn't

have the DNS then if we had to uh access

each and every website with the help of

just by giving the uh host name so for

example if I want to access google.com

back in the 80s or '90s right instead of

giving the IP address I if I had to give

the Google say google.com then I have to

specify this in the hosts file okay I

have to map the IP address and the host

name in the in the host file and doing

that today seems a very tedious task

because we have so many websites and we

have so many uh IP address which we have

to manually feed and uh this is a manual

task right so to to eliminate this

overhead we came up with a DNS and boy

now it's a very big uh help and a lot of

our effort is saved so that's the thing

and talking of how DNS works It works on

a concept which is very similar to a

client or a server network communication

architecture. Okay. So here our systems

will be the u DNS client. Okay. Now

supposing I'm accessing internet. Then I

would be a DNS client first of all and

then I'll be sending these requests to

the server. Okay. I'll be sending the

request to the DNS server by specifying

the host name. uh if I type in

google.com in my URL in my uh in my web

browser then that you then that host

name would go to DNS server it would the

DNS server would resolve to google.com

to a particular IP address. Similarly,

if I type any other uh website like

facebook.com or yahoo.com DNS server

would do the task of converting that

that host name into its equivalent IP

address and then give back that IP

address to us. Okay. And uh the very act

of uh sending a request is called a

lookup request. Okay. And what you get

back from the DNS server in the form of

an IP address that's going to look up

response.

So these are the two things that uh are

involved. And wherever you you configure

the DNS server in whichever environment

or whichever machine that's generally

called a DNS server. Okay. It can even

it can even be a running environment.

And similarly every uh system that tries

to access that particular server that

they are called DNS clients. So we don't

have much of a configuration to do from

the DNS client side. But of course DNS

server side we have a lot of

configuration to do.

Excuse me guys.

Yeah. So that's about uh this example.

And another thing that I want to show

you is that u this concept of DNS lookup

request. Okay. Now if you see this image

over here you can see that uh over here

I've specified lookup request and lookup

response. Okay. But over here this DNS

client is making a request in the form

of an IP address. Right. And then the

server is giving back the DNS response

in the form of a fully qualified domain

name. So in my case DNS.van.com

is a fully qualified domain name that I

have set for my demonstration on this

system of mine. Okay, on this uh virtual

machine. Now,

now you might ask the question why am I

specifying IP address? Now that's

because uh the fact that of course you

people know right you can either enter

the IP address or the host name. So to

represent that I've entered this and

when you enter the host name into your

web browser and when you and when the

server gets back to you with the IP

address and that's called a forward

lookup. Okay. So it resolves the host

name or the domain name to the IP

address. Uh whereas the reverse lookup

this one resolves resolves the IP

address to the host name. So in this

case when I send an IP address supposing

I know the IP address of a machine but I

don't know the uh host name or the

domain name then in that case what I get

back the lookup response I get back from

the server that would be a reverse

lookup right so there are there can be

two kinds of uh ways in which you can

access and look up so that these are the

two things with respect to DNS

now the uh question that can arise in

your mind is that u where does the DNS

server get the IP addresses of the host

name Right? You can ask that from where

how if there are so many websites, if

there are uh so many domain names, if

there are so many IP addresses for those

uh systems inside a particular domain,

how would our DNS server access that

particular uh IP address or that

particular server? You can ask me that

question. And to explain that question

is what I'm going to explain in this uh

next slide. Right? So here first of all

we have a local system. Now let's assume

it's me. Okay? Okay, I'm trying to

access a new uh website, okay, which has

not been which is a very new website. So

or let's ignore the fact that it's a new

website. The f uh let's just consider

that we are going to try to access

google.com. Okay, so when we try to

access google.com then that request

would first of all go to a resolver.

Okay, now the resolver is nothing but

your ISP server and it's basically built

into your network operating system and

the IP address of google.com would be

built inside resolver. Okay, it would be

present as the cache memory and uh since

the IP address would be present, the

host name would be resolved and the

response would be it would come back to

you. But in case if there's a new

website which is been newly newly

published and if that website if that IP

address is not in your resolver, what

happens? Google.com is famous, right?

But Google.com is uh you know there's no

guarantee that the website that you're

talking about is has been accessed by

someone in your ISP and it's on there in

a DNS cache. What would happen at that

time? So at that time the entire uh we

have the we have a different root

hierarchy of DNS right so those would be

accessed now that's where the whole

concept of DNS comes into the picture

and that's where we have first of all

something called as the root server okay

now the root server sits at the top of

the DNS hierarchy okay and uh there are

about 13 sets of these root servers

placed strategically around the world

and about 12 organizations access these

you know they control these these root

servers and the thing with these root

servers is that they will not tell you

which exactly which IP address your host

name is resolved to. Okay, if you

specify uh vart.com, it's not going to

return back with the IP address of that

particular domain. What the root server

will do is it will point you to another

server. Okay, and that is called the top

level domain servers also called TLD

servers. Okay, now when they point back

to the TLD servers, the TLDD servers

will have further information. So they

can point you to a direction where you

will get the IP address. So the root

server will point you back to the TL

server in which your domain may be

hosted. Okay, the domain that you're

trying to access that may be hosted in

one of the domains over here and these

one of these domains are what make up

these 13 set of root servers. So from

the 13 you shortlist one of them and

those come to the resolver. It tries to

access the top level domain servers and

these tople domain servers they store

information of these tople domains such

as.com or the.net or the.org org domains

all these domains right so whether it's

facebook.com or google.com those kinds

of those kind of information or details

will be present in the top level domain

servers now even now you cannot totally

resolve to a particular domain's IP

address supposing I want to access a

particular IP address inside a domain

that I cannot get it here I just by this

time the top level domain only uh it

only knows this particular domain is

hosted under these uh servers okay so

what the TLD will do is it would again

return back the particular domain or uh

let's say let's call it authoritative

name server okay the TLD would return

this name server back to the resolver so

based on that information the resolver

would again query the authoritative name

server okay now the name servers is what

knows everything about the domain

including the IP address so the root

server would return back the top level

domain servers such as the com or the

net or theorg and these tople dom domain

servers they will return back the

domains where your IP address is part of

right and uh that is through the

authoritative name servers and yeah

that's how things happen and then the

resolver would finally get uh short uh

you know get to the IP address inside

your authoritative name server and uh

finally it would it would store the IP

address in its cache locally for later

use so the next time somebody else is

trying to access this website in your uh

you know through your ISP then they can

uh instead straight away access that

website with the IP address since it

would already be present in the cache

and yeah finally once it's present in

the resolver the resolver would send the

response back to the local system. So

this is how a DNS server works. Okay.

Now uh if you guys have understood this

part then you're all set. You can

understand exactly how how to set up

your DNS server which uh which which

server to use. Right. So speaking of

which server we have a lot of uh DNS

servers available in the market and we

what I'm going to use in my session is

that of a bind DNS server. So bind is

one of the most popular and one of the

earliest DNS servers which was in use

and it's basically a name server and it

also be configured for mail service and

uh I'm going to use bind. However you

can uh try out unbound or you can try

out power DNS. We have a number of name

uh DNS servers. So moving on to uh how

to configure a bind DNS server. I can

show you that in 10 simple steps. Okay.

Now let's see how uh we do that. Now

that's the next topic. And uh the 10 the

10 steps that are involved are mentioned

here. Right. And first of all the most

obvious of the steps is this one. You

have to install bind because bind is a

DNS service and we'll have to install

bind with the help of yum command in

cententos machines. Uh if you're however

doing this on a Ubuntu machine it would

be apt get install bind. Right. So this

is the first step. The second step would

be to add a static IP address. Uh now

can anybody uh guess why we add a static

IP address to your u uh machine to the

to the system where you're configuring

the DNS server?

Anybody?

Well uh see the reason for that is uh

because when we reboot our uh machine so

sometimes if your server crashes and

then it reboots then at that time you

don't want your IP address to change

right. So for that purpose you say boot

protocol is static. Okay. So initially

by default when you're trying to

configure it for the first time you'd

find DHCP over here that's uh stands for

dynamic host control protocol which

would assign a dynamic IP address every

time you reboot your server. But uh when

you change it to static then what IP

address you set here this is going to be

constant. It's not going to change.

Okay. So that's the uh uh need to assign

a static IP address. And that makes up

the uh second step. And along with these

you need you need to also add these two

lines of net mask and say which uh

subnet it belongs to. Okay. And the

gateway. So uh in my case my IP address

is 192.168.56.2

and this is what I've entered in my uh

ed0ero file which is present under uh

this directory sysconfig network

scripts. Right. And you also add the

gateway. Okay. Again, you add these

three lines and the rest remains the

same. And you of course change the f0

file. And uh moving on, the next step is

to assign a fully qualified domain name

for your server. Well, what's the point

in hosting a domain if you don't want to

give a domain name, right? So that's the

whole point of assigning it. And uh you

can simply assign a domain name a fully

qualified domain name by entering this

file, the HCIS config network file. And

uh you'll have two lines. You will have

networking is equal to yes. This will be

a line which would be initially there

and even the host name is equal to

followed by the current machine name

that would be the uh entry initially in

your system. Okay. So when you configure

it you can change it with the domain

name that you want to give. So in my

case I'm giving DNS1.van.com.

Okay. So you can uh change it

appropriate accordingly. You can do

that. Um so once you've set the uh fully

qualified domain name the next step is

to go to the uh hosts file and add the

entry. Okay this entry you've uh in your

uh

in this file right in your networks file

you've added the domain name you've said

uh this is your host name. Now you're

defining an IP address for that host

name over here in the hosts file right

that's the step here. These two lines

would uh be there by default. You don't

need to worry about that. And the fifth

step would be to go to your resolve.conf

file. Okay, this will again be present

under under the etsy directory and you

need to add these two lines. So you need

to say search and your domain name. Uh

you can ignore the DNS one part but you

got to uh put your domain name over

here. Uh in your case it can be anything

but in my case it's van.com otherwise it

can be google.com or yahoo.com

excuse me it can be anything like that.

And of course you should say name server

and point the IP address which you want

to act as the uh DNS server. Okay. And

uh this is one important step which has

to be configured even in the client's

even in your DNS uh client. Okay. So

supposing uh if I want to check later

what is the uh uh if my domain name is

working right that time I will have to

go to the resolve.confer file in my

client and add this particular line. I

will show you that later right? I will

show you that in my demonstration. So

just remember that it's a very important

uh step which you need to do even in

your clients. In fact this is the only

step that you have to do in your clients

in your DNS client side right. So then

this uh next step would be to go and

edit the named corner file. So from here

onwards is where the uh actual

configuration of bind starts. So till

here you were just configuring your own

network. the first five steps from the

sixth step onwards till the uh eighth

and in fact even the n till the eighth

step it's all about bind DNS okay so

this named corner file is a file that

comes when you install bind okay and uh

what you have to do is you have to enter

the named doc corner file and you'll

have a number of lines there which of

course I can't uh I I couldn't print all

the lines in my slide so I have just the

three lines which we have to uh change

so we have to edit these three lines and

the thing is initially when When you

open this file, you will have this uh

line, okay? Where in curly brackets, you

would have local host like it says here.

What you have to do is you have to

replace this local host with your IP

address. So in my case, I would be doing

it with uh 52 uh sorry.256.2.

That's my IP address, right? And uh

you'll have one more line for pointing

to the IPv6 port number. And this you

need to comment this. You don't need

this line anymore. Okay? And the third

line which you have to edit is that of

allow query. and you will have none

initially. You should replace this with

any. So that is the uh sixth step which

you have to uh configure. When you're

done with this, you can uh then go to

the other file in the Etsy which again

uh the file name is RFC.1912.zones.

And this of course comes from uh comes

when you install bind. And uh here is

where you define your zones. Okay. Now

there are two concepts of forward lookup

and reverse lookup. Right? So I told you

that when you enter the host name and

then uh you hit enter in your browser

then that's called a forward lookup. But

however if you enter the IP address

that's a reverse lookup. So if you want

people to query your server either uh in

the forward or the reverse fashion using

one of these uh uh lookup fashions. So

at that time for that purpose you have

to set up two different zones. So your

first zone would have the rules and

settings

for what should be returned to them when

they access you from the forward lookup

and when they access your server through

the lookup uh through the reverse lookup

then the settings for those would be

present under this uh zone. Okay. So

I've just defined that it's uh the I

I've just defined the forward lookup as

uh my domain name here. As you can see

it's in the form of van.com which is uh

like a domain name and for the reverse

lookup of course it would be from the IP

address. So for this reverse lookup I've

said it would be in the form of an IP

address and I've named it as

reverse.zone. Okay. And similarly file

would be forward zone. Okay. Now this

file RFC file this is going to be again

a very long u file and you'll have a lot

of lines there and uh these would be

this would be placed in there. So you

would understand this better when I open

the demonstration. So stick around till

then till you understand this completely

because it's a little tricky at uh this

step. Okay. And uh then moving on to the

next uh point uh the next step is the

configuring of the forward and the

reverse zones. So whatever we have

configured over here in step seven, we

have created the forward zones here.

We've created a new file forward.zone

and created a new file reverse.zone. We

have to add the uh we have to add the

rules over here. So that's what you're

doing here. You create one and then you

open them and you will have a basic

template and you'll have to edit that

template and replace that template with

your host name and your IP address. In

the forward dot zone you would replace

the uh template the template with your

domain name and in the reverse dozone

you would replace your template with

your uh IP address. So these are the two

things that you have to do and when you

do this your uh DNS server is uh well

and good. Okay. But however, you might

also want to change your group ownership

of those two files. Okay, this is a

minor step that's needed. You're just

setting it root access full permissions

and uh yeah, that is the final step.

When you do that, you can just restart

your DMD service and uh your service

would be up and running, right? So,

these are the uh 10 different steps

which are needed. So, I can uh now get

started with my hands-on, right? So

let's see how to configure this uh binds

server in 10 simple steps through my

demonstration. And for uh my

demonstration, what I'm going to do is

I'm going to open my virtual machine.

Okay. So

uh this is my virtual machine. As you

can see, I've already set my domain name

here. It says dns1.ban.com.

This is my machine name. So let me just

open this up.

So uh first and foremost let me just

check what's my IP address that's uh

192.16846.2

two the IP address did not change

because I followed my step and I have

assigned a static IP address for this

right so

okay guys so I hope you can see the uh

VM clearly now right now uh the first

thing of course that you would have to

do is to install bind right so The

command for that is uh pseudo yum. Well,

what I'll do is I would uh enter as a

pseudo user. Okay. Yeah. The first

command is to do a yum install

bind. And uh I'm going to give aster

because there are multiple packages that

come with bind. So I would want to

install all those uh utilities

especially the one that's ch root and

utils package. So when you give asterk

all the associated uh packages would be

there and uh since I have already the

latest one installed I have nothing to

do. So the next step would be let's go

back to step number two would be to

assign a static IP address. So I've done

that and let me just verify that and

show it to you once.

Okay. So let me open this and show it to

you. So I'm going to do a cat command

here or let's do a VM itself.

Let's see sis

sis config

network scripts and I want to edit my f0

file. Okay.

Okay. So, one minute.

Oh, yeah.

F0 file. All right. So here we go. These

are the settings that uh I had told you

that I had already done. I've assigned

my IP address here. I've um mentioned

it's going to be static. Okay. I've also

added these two lines net mask and

gateway along with my IP address. So

this is something that you also have to

do. So let me just uh close this. Now

going to the step two is all about

assigning a of you know assigning a FQDN

uh DN for my server right fully

qualified domain name. So that we can do

by going to my

Okay. So as you can see my uh host name

of course uh it's dns1

var.com. You can again change the domain

name as per your wish. Right. So this is

the important thing. And uh the next

step

would be to configure the c/hosts file.

Okay. You have to add your uh uh

whatever domain name that you've

created. you have to add the IP address

uh along with that. Okay. So, let me

just uh

go to my host file and show you that

I've done the same thing here. I have my

IP address and I've also specified my

domain name for this particular IP

address.

Okay, that's done with step number four.

Now going to step number five. We have

to then go to our resolve.confer file.

Okay, so our uh resolve.confer file is

again present over here.

And as you can see uh I've said search

van.com.

Okay. Now I've mentioned my

I mentioned my uh domain name. But

however there's one problem over here.

The uh name server is wrong. So it's

pointing to 1.1. So let me just change

this to my IP address which uh I want to

set for my uh name server. And uh let me

also

Okay. So, I can also comment these two

lines. I don't really need these two

lines. Okay.

So, I'm going to comment them out. I'm

going to just uh save and quit.

All right.

So,

going back to my uh step number six. Now

is where the uh whole bind task starts.

So, bind like I told you, it's one of

the most popular uh DNS servers, right?

So, let's edit the named.conf conif file

which is given by bind.

So here we go

and uh this is the file here and uh this

was the line that I was talking about.

Okay, you would have local specified

over here and you'll have to change this

with the IP address of the server on

which you are uh of change it with the

IP address of the machine that you want

to make your server. Okay, DNS server in

my case it's my IP address and uh you

have to comment this line of yours and

then you'll have the allow query right

so here you have to specify any so these

are the three uh settings that you have

to do in your named dconif file okay

when you've done this you can just uh

quit

and then you can go to the next step

that is configuring the rsc 1912zones

okay you define the zones over here now.

Okay. So, this is the uh file, the RFC

file. And as you can see, this is my uh

this is the this is the thing which is

pointing to my forward zone. Okay. I've

said van.com is my domain and uh I've

said type master. It's going to be the

master. It's not going to be the slave.

It's going to be the master over here.

And I've said the file name is

forward.zone. Okay. uh when when we uh

say file forward.zone it basically means

the settings for uh the rules that you

need to follow that you need to return

would be present in the file called

forward.zone and uh this forward zone

would be present in the directory that

is uh where/named

okay uh that is a directory that you can

set in your named D.conf conf. So the

file that I opened previously in that we

have to set the path. So let me just uh

quickly open back that file and show you

what I'm talking about. So over here

along with specifying these three lines

I have something called as directory

right. So whatever uh uh files that my

DNS bind is going to create. So that it

would it would place it in the

/wware/named. So even the forward zone

and the reverse zones which I'm going to

uh configure in my RFC those would be

present inside inside this directory.

Okay. So that's why we have written

forward.zone which will be the name of

my file. And uh similarly explaining the

other lines uh dump file again over here

is where your uh uh cache and your logs

would be dumped. Okay. And then you have

a statistics file where you'll have

other details. But these are not uh we

don't need to really worry about these

details for now. Okay. Okay, we just

need to verify that it includes the RFC

912 dot zones because you are defining

your forward and reverse zones inside

this location. Okay, now

now going back to the RFC1912

zones, I explained uh this part. Okay.

Now what you have to do is

1 minute guys.

Yeah. Sorry for the delay guys. 1

minute. Okay. Yeah. So what I was uh

what I was talking about is uh setting

the forward zone. We've done that here.

Now we need to go down and you would see

the reverse zone right here. Okay. Uh as

you can see when someone queries me with

the IP address of my system that time uh

we are specifying the rules for that in

uh this file called reverse.zone. Okay.

And this again would be present in the

same directory. And one thing which you

would find strange is we've uh we have

the subnet in the reverse order. Okay.

Now that's because uh that's how rules

are defined. So you don't this is the

only thing that's going to be different.

Instead of giving 192.168.56

you would have to give it the other way.

You have to first specify the class C

then comes class B and then class A.

Okay. The subnetting order is a little

different over here when you specify the

reverse dot zone. Uh the reason for that

is in the reverse dot zone you specify

the number of your IP address. So in my

case it's two. So I've specified two and

I've followed that up with the uh rules.

So for that purpose we specified in this

order. Okay, you would understand this

better later. Okay, so right now you

might get a little confused. So just

hang around. So let me just uh quit and

exit this. Now going back to my slides.

The next step is to actually create the

forward zones and the reverse zones.

Okay. And then open them and use the

template to basically create a rough

forward and reverse zones and then edit

them. So

now those would be present. Okay. Let me

first clear the screen guys.

Okay. So

let me do um

/vr/named

and uh I can do an ls first. Okay. So as

you can see right now we have something

called as named.lohost. Okay. Now this

is the uh file that provides the default

template. Okay. Now the forward dotzone

and the reverse dozone is what I created

based out of this. So using this I

created these two files and uh let me

now show you what I have uh made changes

in these two files. Okay.

So this is my forward.zone which I am

first editing. And as you can see we

have in the first line it says TTL. So

TTL stands for time to live and we say

that as one day. Okay. And when we say

add rate it basically means uh rules for

all. Okay. And in specifi stands for

internet and SOA stands for state of

authority. Now these are a couple of

terms which you might not understand

when you get started with DNS right

away. Okay. So the state of authority we

giving complete when we say add rate in

S SOA we are giving complete authority

to this particular domain. Okay that's

what's happening and uh right after

specifying S SOA with the tab space I

have said DNS1.van.com

this is my fully qualified domain name

to I'm giving complete uh authority.

Okay along with that I'm giving root dot

the fully qualified domain name. Now the

one rule which you have to note is after

I give the fully qualified domain name I

finish it with append that with a dot

that the same thing goes over here and

over here. Okay. Uh this is basically to

indicate that your uh domain is ending.

Okay. This is a syntax so you cannot

play around over here. So just make sure

that you have a dot and if there's any

time if there's an error make sure that

you check this because most of the time

errors would be because of uh giving of

failing to give a dot somewhere here.

Okay. And these are again set of rules

which you don't need to really worry

about. These are the rules when

something goes down it it's it's about

the backup. Okay. So what you need to uh

just edit is these two lines in your

forward.zone when I have said again

which stands for internet I've said that

the forward.zone over here would act as

a name server. Okay. So I'm setting up

my bind as a name server which would

basically resolve IP addresses and host

names. Okay. So NS stands for name

server. If you want to configure a mail

service over here then you can replace

NS with MX and uh similarly other

options okay with bind of course you

have these two options and I've uh added

name servers name server and I've said

my server is DNS1.wan.com

okay and

the domain the DNS one I've given the IP

address of 192.160.2

two. Okay. So whenever this domain is uh

queried

then the address for that query over

here is the server. Okay. The server

address would be 192.168.56.2.

So that's what the forward zone does.

Now let me just uh quickly exit this and

open my

reverse zone. And here the only

difference that you would see is the

last line over here. Okay. So we the

other rules are the same. You're saying

complete state of authority to your uh

to your domain name here. And then these

rules are the same. And uh you're also

defining the name server for

dns1.ben.com which is my domain name.

But in instead of y we have ptr. So yay

over there stands for address, right? Uh

that's pointing to your address. But

when you say ptr, it's basically

pointing to your IP address. So because

it's a reverse lookup, right? So from

your IP address it's looking up to your

domain name. So that's why we replace

this with ptr. This all this is the

syntax. So you uh say ptr and then you

give the uh if it's 56.2 in my case. So

I've given two over here. Okay. Now some

of you might have had a doubt why I gave

that in reverse 192.168.56.

So that's because the rules start from

here. So it's 256 dot 168.12. So uh it

would look up in that fashion right so

now I hope now you would have understood

why I did that and uh yeah it's pretty

much it and this is all that's needed to

set up your DNS server okay

so let me just uh quit this again and uh

I'm going to clear the screen

so the ninth step that's uh that needs

to be done is that of changing the group

ownership of these two files. Okay, you

give them complete uh root access. Uh

this is something that I've already done

so I don't need to uh brush up on this.

And uh finally the 10th step is to

restart your named service. Okay. Now

let me just apply the command for that.

Okay. So

service namely restart. This is a

command to restart my service. And it

says uh it's stopping my service. Okay.

And it started my name service. Great.

Now uh to check if our uh connection is

up and running, we can do a dig command

which basically uh digs for our name

service. And as you can see, it says

that uh the status there's no error and

it's uh giving you all these uh details.

But to understand better, you need to

just look at this particular server. If

this is coming perfectly, right? So the

server that you set your DNS service for

is uh this one 192.168.56.2.

So that is coming up here. It's uh

perfect. And it also says it's it's

under port 53 uh as we suggested. Now

you can uh verify this in in another way

by supplying this command ns lookup

command and specify the domain name. Uh

in my case it's DNS1.

com. So when I hit enter, you can see

that uh it says the server is my IP

address. Uh the address where it's

hosted is the port number 53 inside the

same IP address and the domain name is

uh this and my IP address. Now similarly

when I do a reverse lookup

I can do a 192.168.56.2.

When I do this, it returns me my domain

name again. Right? So this is the

server. This is the port number and

where it's running and the uh lookup

done in reverse fashion.

Right? And uh it's pointing to my

correct domain name. So this is what uh

a DNS server does. So this is how you

set up a DNS server guys. Now some of

you might uh you know have a doubt as to

okay we've done we are doing the lookup

from the server that's why we are

getting to see the details uh the

correct details here now right so you're

not uh you know having a verification

you don't have a verification as to if

you can actually see this domain name

from other systems also now to answer

that question I can show it to you from

a different VM so this is one VM I can

go to my second VM here

Right.

And uh let me open up my terminal first

of all. Uh

okay, I'm going to do an if config

and yeah, this is my IP address of this

VM. Okay, now let's see if this uh from

this VM if I do a reverse uh lookup uh

sorry, if I do a lookup to my uh domain

name, let's see if it's pointing to the

correct address, right? You guys notice

that this has a different IP address.

Right? Now, let me supply the same

command nsookup and say my uh IP my my

domain name here

van.com.

Okay. And when I hit enter u okay so

it's giving an invalid address now

that's because we have not set the name

server right. So there was one uh point

number six which I told you that we had

to do even on your client side.

Now it is this point

this one right where you you will

configure the resolve. file you have to

set the name server which you want your

system to look up to. So that is what

you have to do over here. So at every

client if you want to resolve the domain

name you have to do that. And uh the

command for that is uh

resolve.conf. Okay.

And there goes the password. As you can

see, we have uh the default ones over

here. Now, let me replace, let me first

comment these two lines and

change the IP address over here and

point it to my name server. So, my name

server, my DNS name server is 36.2.

Save and exit. Now if I supply the same

command ns lookup command. Now you can

see that it's pointing to my IP address

and it says the port number where it's

hosted is 53 and it's resolving my

domain name and this is the address.

From here let's uh check even the

reverse lookup. Okay.

And when you do that the reverse lookup

also works exactly the way we want it.

Correct. So, it's pointing to my domain

name. And uh yeah, that's how this

works, guys. So, that's how you set up a

DNS server. And this is a simple 10-step

process.

[Music]

Now, let's talk about what is shell GPT.

Shell GPT is a command line tool that

harnesses the power of GPT models. It

enables Linux users to perform natural

language processing tasks directly from

the shell by integrating GPT models into

your terminal. Shell GPT allows you to

interact with AI in a familiar

environment, making it a powerful tool

for developers, system administrators,

and enthusiasts. Now, let's see how does

Shell GPT work. Shell GPT sends user

prompts to open AI's API from the

terminal and then returns responses

generated by GPT model. This interaction

occurs seamlessly allowing for quick

queries, code generation or task

automation within your shell. Here's a

simplified workflow of how Shell GPT

operates. Firstly, the user input. You

type a query or request in natural

language or code. Then, shell GPT

processing. Shell GPT sends your query

to open AI's GPT model. Next is the

model response. The GPT model generates

a response based on the input. Last is

the output. The result is displayed in

the terminal for further actions. Moving

forward, let's talk about why use shell

GPT on Linux. Shell GPT offers multiple

advantages for Linux users. First is the

efficiency. You can automate repetitive

tasks, generate scripts or troubleshoot

without leaving the terminal. Then is

the natural language. Instead of writing

complex code, you can describe tasks in

plain English. Next, customization.

Shell GPT can adapt to your specific

workflows offering personalized

responses over time. Last is the code

assistance. Whether you need quick

solution or code snippets, Shell GPT

assists in real time. Now let's see how

to install the Shell GPT on our Linux

system. Here I'm using the Kali Linux as

my base operating system, but you can

use your preferred Linux distribution.

Here we are at the official GitHub

repository of Shell GPT.

If we scroll down, we have the

installation guide as well. So, we will

follow this guide in our installation.

Now, let's head over to our terminal

and start with creating virtual

environment.

This helps keep your project organized

and avoids conflicts with other Python

packages. So, first up, let's start

creating a directory. For that, let's

type the command.

Now, let's click on enter. Now let's

move in to this directory.

So now we will set up the virtual

environment. For this we will use

Python. So now let's type the command

for it.

This creates a virtual environment in

the SGPT folder. Now let's activate the

virtual environment.

This activates the virtual environment

so that any packages you install are

isolated within this project. You'll

know it's activated because your

terminal will show sgptt at the

beginning of the line. With the virtual

environment ready, let's install shell

gpd. Now let's go to the web browser.

Now let's copy this command from the

GitHub repository and let's head back to

our terminal and paste it here

and click on enter.

This downloads and installs shell gpt.

So it's ready to use.

Next, you need to configure the API key

to connect Shell GPT with OpenAI.

Next, we'll go back to our browser.

We'll go to the Open AI platform and

create a new API key. For this, click on

new secret key that's seen on the

screen. You can enter any name

preferable here. I'll be entering it as

SGPT.

Let's keep the project as default

project itself. And then let's click on

create secret key.

Let's copy the secret key and store it

in our system. So let's copy this. Let's

go to a Kali Linux. So here let's go to

the text editor. Paste our secret key

and save this.

Let's just give the name as SGPT key for

our remembrance

and save it on our desktop

and press enter. Now let's minimize

this.

Now let's clear our terminal.

Now let's export the API key.

Now let's copy the API key that we have

stored it in the text editor and let's

paste it on our terminal.

This command temporarily sets the open

AI API key as an environment variable.

So shell GPT can use it. To avoid

setting it every time, make it permanent

by adding it to your bash rc file.

This will save your open AI API key in

the bash rc file which runs every time

you open a terminal to set environment

variables. To ensure everything is

working, check the version of the shell

gp installed.

So here you can see that our version of

shell gpt is 1.4.4.

Now let's test our shell GPT with a

simple command.

So here you can see there is an

authentication error. This is because I

have entered the API key two times.

Also you can see something like this.

It's because the open API key requires

an active subscription or credits to

process the request. Since we don't want

to buy credits right now, we'll move

forward with an alternative that is the

Olama, a free and open-source option to

use Shell GPT without these limitations.

Let's set it up next. So before

starting, let's clear all.

Now let's go to the web browser. In the

address bar, let's type. Click on enter.

Click on the very first link that you

can see.

Click on download option here.

So here you can see different download

options for different operating systems.

So as I am using the Linux. So now let's

copy this command and paste it on a

terminal.

Now let's enter the password

by clicking enter. This will start

getting downloaded. So be patient until

the download finishes.

If you see something like this, that

means the Olama has successfully

installed.

Now, let's go back to our browser. Click

on models.

Scroll down until you find Llama 3.2.

Choose the version as 1B.

Copy this command

and paste it onto your terminal.

So, there you go. The success message

shows that the Llama 3.2 model is

successfully installed. In order to test

this, let's type a message.

So this response indicates that it's

working perfectly. So for now, let's

exit this model

and let's clear our terminal.

Now let's go to our web browser again in

the GitHub repository. Here is a tip

given which says alternatively you can

use locally hosted open-source models

which are available for free. So now

let's click on the guide to get the

alarm installation.

So let's scroll down and let's copy this

command of pip install.

Go to our terminal and paste this

command.

After this we will be making some

changes in the sgbtrc file. So now let's

open it in our nano editor.

So now let's move down to our default

model and change it to

slash

llama.

Let's move down to our open AI use

functions. Let's set this to false.

Scroll down a bit. Now let's set use

light lm to true.

We will also change this open API key.

Let's just type a random string. I'll be

giving it as one six times. Now let's

save this

as our setup is completed. Now let's

test the shell GPT again. So now let's

ask for it what operating system are we

currently using.

So as you can see it has responded that

we are using the Kali Linux operating

system.

Let's try something else. Now we will

use the C flag to generate a Python code

which will list all the users on this

operating system.

As you can see, it has already started

generating the Python code that we have

asked for. So here you go. This is the

Python code to list all the users on the

system.

In order to exit the shell GPT, enter

deactivate.

Now let's conclude by saying that Shell

GPT is a powerful tool that brings AI

powered natural language processing into

the Linux command line. Whether you're a

developer, system administrator, or tech

enthusiast, Shell GPT can help you

automate tasks, generate code, and

streamline your workflow. By integrating

Shell GPT into your Linux environment,

you can leverage the power of AI to

simplify complex processes and boost

productivity.

[Music]

Now let's move on to our command line

essentials. For that I'm going to take

you to the terminal. Now because this is

a scripting video, we're going to spend

a lot of time on the command line

interface. Now this is important because

it saves you a ton of time. You can't

just keep switching from CLI to GUI in

any real life given scenario. So I am

using CentOS 7 the Fedora version and

I'm running it on a virtual machine. So

first of all what I'm going to do is I'm

going to increase the size of the text a

little bit. I think this should be fine.

And then let's start with making a list

of all the commands that we shall be

acquainting ourselves with. For that I'm

going to open the nano editor and I'm

going to name this CLI essentials. All

right. Now, nano editor is basically a

text editor like any other. I could have

used whim instead of it, but I like the

nano editor because it gives you a bunch

of options in the bottom and it's just

easier to use. So, let's start with our

list. So, we have our basics which are

cd which means change directory, pwd

which will show you the directory. Then

we have ls or list. Then we have the

next segment which is the copy, the move

and the remove. They pretty much do what

the name suggests. The copy, move and

remove respectively. Then you have echo

which is like Linux's version of print.

You have cat or concatenate. Then you

have less which by definition both of

them should sound pretty similar but in

a bit I'll tell you why they are

different. Then we have GP. We have

MKDIR which basically helps you make a

directory. And then we have touch which

basically helps you make files pretty

quickly. Then we have change mode which

is also pretty significant. I'll tell

you in a bit why. And then finally we

have man plus help which is basically

like a manual. Then if I had to save

this I just have to write out. So, Ctrl

O. Then it'll ask you whether this is

the name you want to save this with and

hit enter. And then it tells us that

we've written 14 lines. Now, all I want

to do is exit this. So, Ctrl X. And here

we are back on our basic terminal. So,

let's start change directory. Right now,

as you can see, we are at Edureka, our

current working directory. So, cd /home.

It's as simple as that. Now we are at

home. Then we can do a cd and back to

edureka. There you go. Then we have pwd

which will show you your current working

directory. As you can see it shows home/

edureka. It's the path of our current

working directory. Then we have ls. It

shows all these files that are there in

our current working directory. Not just

that you can also write ls and specify a

path name. So then it'll give you the

list of objects that is there in that

particular file. So at home you have

these two files called edureka and

vagrant. Now what else can we do with

ls? We can go ahead and look at the

flags that are available. For that all

you have to do is hyphen help. Now that

works universally through all

distributions of Linux. Now this may

look like a lot of text. Now but if you

go up you will realize that there are

flags and their descriptions given on

the left and right respectively. You

have your hyphen a which means do not

ignore entries starting with your dot.

Then you have capital A which means

almost all and then it has its

description right here. What I'm more

interested in comes all the way down

here, which is your L flag or the long

listing format. Let's use that and see.

Now, I had done ls before. Now if I go

on and do ls-

L, it's basically going to show me all

my objects the same as ls but it is

going to give me more information about

these objects like the date and time at

which this object was created, who is

the user, the user group and on the

extreme left if you see it basically

shows you the permissions which I'm

going to talk a little more about later

in this segment. Right now all I want to

tell you is R here stands for read, W

for write and X for execute. So when you

see RWX written on the left, it means

your user can read, write and execute

that particular file. Okay, with that

let's clear this. All right, let's move

on to our next set of command line

essential commands. So what else did we

have? We had copy. So for copying all

you have to do is type cp type the name

of your file and then put in a

destination path. In this case I've put

in pictures which is there in the

edureka directory and with that it is

copied. Now let's see if it is actually

present in pictures. So again let me

just use the list command

and you can see cli essentials is right

here. Now let's see how to use the move

command. For this I am going to be

moving to this pictures directory.

Oh, first up let's just see what other

file can we make the move to. All right,

we have downloads, we have project

public. All right, so first let's move

into pictures.

So now I'm at pictures. What I'm going

to do is I'm going to move

CLI essentials to let's say I'm going to

move it to public.

Okay. Now once the move is done, if we

see public, let's list out public. You

see there is just one file which is CLI

essentials. But then if I go back and

check pictures,

there is no CLI essentials file. Which

basically means what moving did was it

removed the file from the pictures

directory and put it in public. Now

let's remove that file from public with

which we can also cover the rm command.

So let's move into public. Now as you

can see we are at public. Let me clear

this. I'll keep clearing the screen for

which you can just type clear or use ctr

L. And let me remove CLI essentials. Now

if I do an ls you see there is nothing

there in the public directory. So with

that let me move back to edureka the

original working directory I was in.

Let's see what are the commands that we

were using.

Okay we've done cd pwd lscp mv and rm.

Next we have echo. Now as I had

mentioned echo is like the print command

in here. So, if I'm going to say echo

hello world, like we haven't used this

phrase a million times already, but I'm

going to stick to the cliche and I'm

going to still type that. It prints out

hello world. Surprise, surprise. And as

you might have seen what I previously

did, which was using the cat command.

I'm going to do it again. Basically,

what the cat command does is it

concatenates your text file to this

terminal of yours. So what is there in

that particular text file CLI

essentials? I can see it printed right

here. Now how is that different from the

less command? Now if I did the same

thing with less, it'll also show you the

contents of your text file, but it'll

open it on a brand new separate window

and just override the previous window

you were working on. Now this is a much

neater way and it helps you from not

cluttering the window that you're

currently working on. So that was all

about cat and less for GP. Let's move

back into our original window. For that

all you can do is press Q and then

you're back here. So the next command

we're going to do is grap. Basically

what it's going to do is it's going to

grab the data from a certain file or a

command that you are trying to pursue.

So you guys might remember I just used

the MV or the move command. So what I'm

going to do is MV and go to help because

if you remember your hyphen help would

basically bring out this entire manual

of the flags that are there for MV. Then

we're going to pipe and going to do this

thing called GP and we're going to type

out verbos. So basically what I'm trying

to find out is is the verbos flag

available for your move command or not.

So as you can see your hyphen v or the

verbos flag basically what it does is it

explains what is being done while you

move it. So if you use the hyphen v flag

with your move command it's going to

show you basically where you're moving

your file. And if suppose you're using a

big file suppose a 12 or 20 GB file it's

going to show you when it starts and

when it is finished with that let's move

on and let's see what else.

So we finished catless gp next we have

touch and mkdir.

Now touch will be easy to show. It is

basically going to help you create a few

files quickly in the current working

directory that you're working on. So

file 1 .txt. Then we have file 2.txt

and let's take file 3.txt.

Not very original, but just have to show

you how it works. And if I do an ls, you

can see you have file 1.txt, file 2.txt,

and file 3.txt right here. Next, we have

mkdir, which basically helps you make a

directory in your current working

directory. If I just type files and then

I'll do this ls again, you see we have

created a directory which it'll show you

in blue and we have created files. Then

we have chod or change mode. Now this

basically helps you play with or alter

the permissions that are associated with

a file. Now let me give you an example

by running a script. So what I'm going

to do is I'll open

script. So basically what I'm going to

do is that I'm going to write a little

script. Now this is in no means me

rushing into the next segment. That one

is separate. This is just for me so I

can demonstrate how you use chmod. So

I'm going to go with the shebang line

and I'm going to just go with hello

world or hello learner because we have

used hello world a lot. So I'm going to

write out of this controll and then

we're going to move out of here. Now let

me clear this out and let's try to run

that particular script. So this is how

you run it. You go dot slash and then

test.sh.

And as you see, it basically shows you

permission denied. Now, one thing you

should remember is any script that

you've just written isn't executable

from the get- go. Mostly, you only have

permissions to read it. Now, to change

that condition, we have something called

chod. So when you go ahead and type chod

and then your plus r or plus w or plus x

it means you're basically adding to

whatever permission that there is a

permission to execute that particular

file.

So with that plus x now let's try

running this and as you can see hello

learner. So what I could have done

instead of the plus X is I could have

done this 777

and then test

which would have meant the same thing.

But there is a difference from just

adding a permission to the user and

using the chod this way. For that let me

open another nano editor called

permissions so I can explain it to you

further. Now remember how I had said

when we were using long lists or the

extension hyphen L to ls that on the

leftmost column what you could see were

the permissions associated with a

certain file. Now chod basically helps

you alter that. Now if you might have

noticed the permissions were displayed

in the following fashion. suppose ABC

and then ABC and then one more ABC and

then the file name and then the date and

then whatever. Basically there are three

aspects to it. The first one being the

user or you. Second one being the user

group and finally there's a thing for

everybody else. So when you basically

type chmod and followed by three numbers

you're basically specifying the user the

group and others and then the file name

which is the basic syntax of chmod. Now

how does this work? Now these numbers

can be anything from 0 to 7 and all

those numbers mean something. Now let's

start with zero. We have zero which is

equal to zero which basically means

nobody gets any permission. Then we have

one which basically means only execute.

Then we have two which means you can

only write. Then you have three which is

basically the sum of 2 + 1 which means

you can write and execute. Then we have

four which is read. Then we have five

which is essentially 4 + 1

which as you all might have guessed

means read and execute.

Then we have six which is read and

write.

And finally you have seven which is 4 +

2 + 1 which means all three permissions

read, write and execute. Not going to be

saving this. So when you type something

such as chmod 777 and a certain file

name, your first seven basically means

your user has the permission to read,

write and execute. Your second seven

means your user group also has the

permission to read, write and execute

the file and so does everybody else

which you can see through the third

seven. With that I am closing this. So,

Ctrl X and then I'm not saving it.

And then finally I have man plus help

which is basically your general commands

manual. You can see the names of all

your general commands. You can see your

bash bulletin commands. It's basically

like your guide book before scripting.

You can press H and it'll open to a

summary of commands and then you can

press Q when you are done. Again Q.

Now let me head back to my presentation

for a little more on CLI. Now basically

before closing this segment I'm going to

talk a little bit about CLI and how it

compares to GUI. So firstly the first

point must be pretty clear. CLI actually

stands for command line interface. So it

basically means it's a textbased

interface. Now the GUI or the graphical

user interface is a visual based

interface pretty clearly. It features

the use of graphic images including

windows, icons and menus. Even if it

does that, it does require a mouse which

is the most common way to navigate

through a GUI. Which brings me to my

next point. I use because of the visual

representation. Most people can learn

and use GUI much faster and much easier.

But once you get used to the command

line, I don't personally think it is

that tough as well. But for a beginner,

yes, GUI can prove to be pretty optimum.

But there is also a downside. A GUI's OS

is slower because everything you remove

does not get permanently removed from

the system. It is going to stay there as

a copy of the file and going to clutter

your space and reduce the speed of your

whole system which is where CLI wins as

it has a faster OS which also brings me

to my final point. Command line

interface gives you way more control

than your GUI. With a CLI users have all

the control over a file system and their

operating systems and the tasks become

really simple. You can create a script

that contains a few lines of command and

it will do the work for you. Although

your graphical user interface can create

shortcuts, they do not readily support

scripting or automation. So for common

tasks, a user must repeat each action

within the GUI manually. Now, nothing is

better than the other. It's a personal

choice for everybody, but for scripting,

obviously, a command line interface is

most optimum. It helps you do thing at

scale. It helps you when you need to

script or automate something. You need

greater control over systems or

functions and it helps you with less

memory usage. With that, let's move on

to the shell script basics. So the most

logical question obviously is what is a

shell? As I had mentioned earlier, users

communicate with the kernel through a

program known as a shell. A shell is

basically a command line interpreter.

And basically what it does is that it

processes your requests. When you type

in a command at your terminal, the shell

interprets the command and calls the

program that you want. The shell uses

standard syntax for all commands. So

basically what it does is that it

translates commands entered by the user

and converts them into a language that

is understood by the kernel. From the

shell, the direct derivative is the

shell script. Now the basic concept of

the shell script is that there will be a

list of commands which are listed in the

order of execution. A good shell script

will have comments preceded by the hash

sign. Now it is not important for you to

have hash signed certain comments for

your script to be executed. It is only a

good practice to have your steps hashed

out so somebody else reading your script

can understand what you want to do with

it. Now there are several different

types of shells which can be broadly

classified into two types. First you

have the classic shell which is the bond

shell. A derivative which came later was

the sea shell. Now each of these types

have their own subtypes. A few examples

of the bond shell are the basic bond

shell, the corn shell, the bornag again

shell or the bash and the pix shell. In

Cshell, certain examples are your basic

Cshell, your 10x Cshell and the Zshell,

which has been picking up popularity in

the past few years. Now, to understand

how this works, let me move on to our

terminal. Now, what I'll be doing is

I'll be dividing the screen into two

parts. On my left, I'll have my nano

editor and on my right, I shall be

having your basic terminal where you can

see your commands being executed. So

kindly be patient. Okay. So let's start

with some basic shell scripting. Now

shell scripts have several required

constructs that tell the shell

environment what to do and when to do

it. Of course, most shell scripts are

more complex than the one I'm going to

show you. The shell is after all a real

programming language complete with

variables, control structures, so on and

so forth. No matter how complicated a

script gets, it still is just a list of

commands executed sequentially. So here

I'm going to open up my nano editor and

I'm going to put up let's say example

one and sh.

Now notice the extension sh. This is my

extension because I'm using the basic

bond shell or the shell. So I'll start

with the shebang line and it is nothing

but the absolute path to the interpreter

of your shell. So it has this hash and

this bang or the exclamatory followed by

the full path to your interpreter. Now

all scripts under Linux execute using

the interpreter specified on this first

line. So this could be sh or bondshell

bash or your ksh your zsh so on and so

forth. Now like we had given the advice

of hashing out comments. Let me just put

on a few comments. Make this look good.

Okay. And

then I'm going to put up try and print

this very simple print such as what is

your name? And then I am going to

read whatever you enter and then I am

going to print that out. We're going to

allocate whatever we read into this

variable called person and then we are

going to call that variable using the

dollar sign. So hello whatever person as

I had mentioned before your control O

for write out and then we're going to

exit this. Now this is to remind you one

more time that every file which has just

been made is not executable.

So if I try to execute it now, it would

tell me that permission is denied. This

is just a recap of what I had done say 2

minutes ago. So we going to change the

mode and I'm going to do this when I'm

executing any script at all. Going to

try and execute it now. It's going to

ask me what is your name? Edureka

employee. And then it's going to greet

me saying hello Edureka employee. And

that is the most basic of the shell

scripting that you can do. As we move

further, I'm going to keep bringing you

back here. I'm a firm believer in

practicing what we are learning in

theory. With that, let's go on and see

what we have next in this module. So the

next segment is about using variables.

So what is a variable? Most people might

be aware of this term, but for those who

are not, I'm going to explain it down to

the scratch for all of you. Now,

variable is nothing more than a pointer

to the actual data. It's nothing more,

nothing less. The shell enables you to

create, assign, and delete variables.

So, basically what it is is that a

variable is a character string to which

we assign a value. The value assigned

could be a number, text, file name,

device or any other type of data. The

shell enables you to create, assign and

delete variables which may contain

numbers, texts, file names, devices or

any other kind of data. Now variables

are of three kinds in the shell. You

have your local variables which as the

name suggests is the variable that is

present within the current instance of

the shell. It is not available to

programs that are started by the shell

and they are set at the command prompt.

Then you have your environmental

variable. An environmental variable is

available to any child process of the

shell. Now some programs need the

environmental variables in order to

function correctly. Usually a shell

script defines only those environmental

variables that are needed by the

programs that it runs. And finally, we

have the shell variables which can be

compared to the global variable if

you're into any other kind of

programming. A shell variable is a

special variable that is set by the

shell and is required by the shell in

order to function correctly. Now, some

of these variables are environment

variables while others are local

variables. It can be any of these. Now

to see how we can implement these

variables. We are going to move on to

the shell. But before that let's see

specifically what we are going to look

at. So first of all we are going to

learn how to define variables, how to

access the values. Then we're going to

see a little bit on readonly variables

and unsetting variables. Then we have

special variables. We're going to see

how you can work with them. We have

command line arguments. We have special

parameters and the exit status. Now to

see how all of these things work, let's

move on to our terminal. So again I'm

going to create another nano file called

variable.sh.

Now defining variables. Now any variable

that you are going to define should be

along the lines of this. You have your

variable name and then you have your

equal sign and your variable value. Now,

if you have done any sort of coding or

programming before, you would know this

is basically how you all lot a value to

a variable throughout all different

platforms. Now, the thing you have to

notice is that in shell scripting, it's

very particular about the syntax. So, no

spaces on either side of your equal to

sign. In that case, it is not going to

execute and it's going to throw an error

at you. So, let's take something simple.

So, your name

equals

this. Now this example defines the

variable name and assigns the value

adurea employed to it. Variables of this

type are called scalar variables. Now a

scalar variable basically means that it

can only hold one value at a time. So

let's turn this into a shell script

first. So I'm going to go up and put in

my shebang line and then I have my name

and then we just going to call that

particular variable. Pretty simple and

we've done it before. So then control O

here again we have to give it

permissions

and then when we execute it, it prints

out what we had asked for it to print

out. Okay, let's see what happens when I

use the readonly command

and then I try to change the value of

the variable. Suppose I put in my own

name into it. I'm going to go control O

and okay.

Basically, it's going to throw an error

at me saying that the variable name is a

readonly variable. So, I cannot change

the value of the variable once I put

read only in front of it. Now that was

all about readonly variables. Now let's

move on to see what else can we do with

this. Now there is also something called

unsetting variables. Now unsetting or

deleting a variable directs the shell to

remove the variable from the list of

variable that it tracks. You'll see in a

moment what I mean. So I did this and

then instead of read only I'm going to

put unset and then I'm going to call my

variable same old same old

and now we are going to try and call

this as you can see nothing. So

basically what it did was it took the

variable out of the list of other

variables. That is what unset does. Now

let's clean this out and we can look at

special variables.

Okay. So now let's discuss a little bit

about special variables. So in the

previous segment you understood how to

define a variable, how to read only and

unset a variable. Now these variables

are reserved for specific functions and

hence they are called special variables.

Now they're usually preceded by a dollar

sign and these are the special variables

that we are going to see.

You have your dollar zero which is the

file name of the script. Then you have

your dollar any number 1 to 9. Now these

variables correspond to the arguments

with which a script was invoked. Here

you can pick any n number which will be

a positive decimal number corresponding

to the position of the argument. You

shall understand when I demonstrate this

further in the segment. Then you have

your dollar hash sign. Now this will

basically return the number of arguments

applied to a script. Then you have your

dollar and asterisk. So this will return

you all the arguments that are double

quoted which again you shall see when I

demonstrate this. Now this will give you

all the arguments that are individually

double quoted. That is the only

difference between the dollar asterric

and the dollar at the rate sign. Then

you have this which is the exit status

of the last command that you have

executed. And finally you have the

dollar dollar dollar which will give you

the process number of the current shell

for the shell script. Now this is also

the process ID under which it is being

executed. Now let me try to script

something with which I can depict not

all but at least most of these special

variables. So let's just put on echo

dollar zero. Let me go ahead select it

and then copy it a bunch of times.

Okay. So let's go ahead and execute

this. So now that we have learned about

all of these special variables, let's

implement them using command line

arguments. Now command line arguments as

you can see on your left are these

dollar 1 2 3 to 9 they're actually

positional parameters with dollar 0

pointing to the actual command following

which your dollar one and your dollar

two are the arguments to that particular

command. If you see the script on your

left this is how it will run. So first

we are going to change the mode then

we're going to run it and pass a

parameter here. So if I pass Edureka

employee or I've typed that too many

times. So Edureka learner and enter it

shows you the file name dollar0 your

parameter number one which is edureka

your second parameter the quoted values

and the number of parameters all of

which are returned to us by our special

variables. Now as you might have noticed

your dollar address sign and your dollar

star sign returned pretty much the same

thing. These are the special parameters

that allow accessing all the command

line arguments at once which in our case

is edureka learner both of these

arguments. So both of them actually act

pretty much the same unless they are

enclosed in double quotes. Now let me

show you how. If I run the same thing

but I put them in double quotes,

you can see both of them again give the

same value. But if I put them in

individual quotes, it will treat them as

two separate parameters and give you two

separate values. Whereas in the first

one, it'll quote your number of

parameters as one. It'll consider it one

single string. Now let me try and

demonstrate it using another shell

script. How is it different? This does

not make a lot of sense to most of you

right now. So let's just hope the next

thing makes it better.

So I'll run a little for loop here which

again we are going to touch up on later.

But for now let me just do this to

demonstrate how this works.

Now, let me put this in perspective. So,

what I'm going to do is I'm going to run

this entire sentence. Edureka wishes you

happy learning. And you see what just

happened, right? What your special

parameter did here is that it took this

entire list and separated it into

separate arguments. And that is what

these two special parameters do. Now

once you're done with it, you can always

use the exit status.

So what I'm going to do now finally is I

am going to go and implement the exit

status and it is going to return a value

of zero. Now this is basically the exit

status of the previous command. It would

have given you a one if your previous

command was unsuccessful. Since your

command was successful, it gave you a

zero. So the exit status is basically a

numerical value returned by every

command upon its completion. As a rule,

most command return an exit status of

zero if successful and one if

unsuccessful. Now some commands also

return additional exit statuses for

particular reasons. For example, a few

commands will differentiate between

kinds of errors and will return various

exit statuses depending on the specific

type of failure. With that, we've come

to the end of this segment. Let me go

back to my presentation. Next, let's

take a look at our basic operators. Now,

there are various operators supported by

each shell. I'm not going to take a lot

of time with this segment. We will

discuss about the default shell in this

segment. And we are going to discuss the

following operators. We have the

arithmetic operators, relational

operators, boolean, string, and file

test operators. So this is the first

table and these are your arithmetic

operators. You have addition,

subtraction, multiplication, division,

modulus, assignment, equality and not

equality. It's very important to

understand that all these conditional

expressions should be inside of squared

braces with spaces around them. Now all

the arithmetic calculations are done

using long integers. Next we have

relational operators. Now the bond shell

supports these relational operators that

are specific to the numeric values. Now

these operators do not work for string

values unless their value is numeric. We

have again the equal operant not equal

to, greater than, less than, greater

than equal to or less than equal to.

Then we have the boolean operators which

are just three. There's the logical

negotiation, logical or and logical and.

And finally we have the string operators

which are equals, not equals, check if

operand is zero, not zero and check if

string is empty. And finally we have the

file test operators. Now we have a few

operators that can be used to test

various properties associated to a Unix

file. Now assume a variable file holds

an existing name of the size 100 bytes

and has to read, write and execute

permission on. So you have your hyphen B

which checks if the file is a block

special file. Then you have hyphen C

which checks if a file is a character

special file. If the file is a directory

which is hyphen D hyphen F is if a file

is an ordinary file as opposed to a

directory or a special file. Then you

have hyphen g which checks if the file

has its set group ID hyphen k which has

its sticky bit set hyphen p which is a

named pipe hyphen t which checks if it's

associated with a terminal hyphen u has

its set user ID r is readable w is

writable and x is executable which we

had discussed before then you have s

with a size greater than zero and e if

the file exists. Now these are specific

to the bond shell. There are other

operators that are available in the C

shell types but you shall find a lot of

content surrounding that. It's not

really crucial to discuss that in this

module. So let's move on. Next we have

shell loops. In this segment we going to

discuss shell loops in Linux. A loop is

basically a very powerful programming

tool that enables you to execute a set

of commands repeatedly. Here we shall

discuss the while loop, the for loop,

until loop, the nested loops and loop

control which will include the infinite

loop and how to get out of it with break

and continue commands. For that again as

most of you might have correctly guessed

let me head back to the terminal. So

first let's discuss the for loop. So the

for loop operates on lists of items. It

repeats a set of commands for every item

in the list. So let me open the nano

editor. Let's see. Let's call it edit.

All right. So basically this is how the

syntax of your for loop goes for your

certain variable in say your word one,

word two, so on and so forth till your

word n then you have a do statement.

whatever you want your for loop to do

and then done. And this is basically how

your for loop works. So here I'll give

you a simple example of how

the for loop works. It's basically going

to span through a given set of numbers

set 0 to 9 and upon execution it should

print all those numbers. It's basically

printing out this variable for all the

variables that are there in the set.

It's pretty simple. So again,

chod and then

and there we go. Now what if you had to

do the same thing using another way? We

have for you the while loop. Let's get

out of here. Let's open this and see how

the while loop is different from the for

loop. Now the Y loop what it does is

that it enables you to execute a set of

commands repeatedly until some condition

occurs. So it is usually used when you

need to manipulate the value of a

variable repeatedly. The syntax of a

while command looks something like this.

So you have a while and then you have a

command a condition if you will then you

do and then there's this statement what

you want to be done and then done. I'm

going to demonstrate the same example

using the while loop.

Now this is basically going to do what

we did with the for loop but using the y

loop. We start with assigning a value to

a which is our variable. Now we say

while a is less than 10, it's going to

print a and then increase the value of a

to a + 1. That's all that is there

inside the loop. Now let's try executing

this again. I'm going to change the

permissions

and it prints the same exact thing. Here

the shell command is evaluated if the

resulting value is true. So as long as a

is less than 10, it will keep printing a

and adding one to it. Once it reaches

10, your while loop breaks and you come

out of the loop. Each time the loop

executes, the variable A is checked.

Let's try doing this one more time using

the until loop. Let me clear this out.

Now, the while loop is perfect for a

situation where you need to execute a

set of commands while some condition is

true. Sometimes you need to execute a

set of commands until a condition is

true. And that is where you use the

until command.

I'm going to go back here and you'll

notice that the structure of until

command is pretty similar to that of

your while. Again, you have your until

statement, then the command or the

condition, then you have your loop

beginning, whatever you want to happen

in the loop, and then done. Here once

the shell command is evaluated if the

resulting value is false the given

statement is then executed. If the

command is true then no statement will

be executed and the program jumps to the

next line after the done statement. So

again because I'm lazy I am going to do

the exact same thing as I did twice

before but this time using the until

command.

Same thing here. Instead of while, it's

until. So until your a is not less than

zero, it's going to keep printing a and

then incrementing the value of a. So

even if what gets printed is the same,

you know for a fact that how the

procedure was gone about was different.

When you use the while command, your

statement is executed while your

condition is true. But when you use the

until command, your statement keeps

executing until your condition is true.

With that, let me clean this out and

then we shall move to nested loops. Let

me get out of here.

Okay. Now, next let's talk a little bit

about the nesting of loops. Now all the

loops support nesting concept in Linux

which means you can basically put one

loop inside another similar or different

loop. This nesting can go on up to

unlimited number of times based on what

you require. Now let me give you an

example of nesting using the while loop.

So remember the simple while loop that

you ran which went from 0 to 9. What

we're going to do is basically we're

just going to add another while inside

the previous one. So nano

okay remember till here it's pretty much

the same as the previous one that is

your first loop inside we are going to

assign the value of a to b and while

your b remains greater than zero it's

now going to go to a new line which is

this n flag print b and then increment b

once it comes out of the loop it's going

to increment a and so on and so forth

let Let me show you what this looks

like. Now the result here is not very

important but what you need to

understand is how the basic structure of

the loop is and how it works.

So again like you can see a starts with

zero. Now while a is less than 10 0

being less than 10 a is assigned to b.

Now while B is greater than equal to

zero which now B is it is zero. It's

going to go to a new line and print B.

It printed zero. Then it's going to

increment the value of B and turn it

into one. And now once B is incremented

it gets out of that loop followed by the

increment of A which now A becomes A + 1

that is 1. And it keeps going on and on

and on and on till finally your a is no

longer less than 10. So with that let's

move on to our next topic which is of

loop control. Here we are going to

discuss some very important concepts.

But before I introduce the concept of

loop control, first we need to

understand what infinite loop is. So let

me

create an infinite loop.

So let's start with a equ= suppose 10

and let's go saying as long as

a is greater than zero start your loop

and you're going to print a and then we

are going to

increment the value of a

and then done ctrl Oh.

And now what this is going to do is it's

just going to go on and on and on and on

and on because it will go on until a is

greater than zero. And it's always going

to be greater than zero. So let me just

put a stop to it. This by using Ctrl C I

can put a force stop to it. Now you can

also do that using something known as

the break statement. Now the break

statement is used to terminate the

execution of an entire loop after

completing the execution of all the

lines of code up to the break statement.

Now let's see how that works. So I am

going to exit this. And

now this is a simple example which shows

that the loop will terminate as soon as

a becomes equal to 5. So let's go ahead

and you go and 1 2 3 4 5. Now another

statement associated to it is the

continue statement which is similar to

the break statement except that it

causes the current iteration of the loop

to exit rather than the entire loop. So

this statement is useful when an error

has occurred but you want to try to

execute the next iteration of the loop.

Let's look at one of those.

So basically what you see in this script

is that this loop makes use of the

continuous statement to return from this

particular statement to the next one

which is the found odd number statement.

So if we try to run it,

you will receive this result. Found an

odd number. Even odd, even odd, even

odd. It's basically very similar to the

break command except for the fact that

your break command will exit the entire

loop while the continue statement will

only exit the current iteration. On your

left you see this little script where we

trying to see this numbers that we have

put in 1 to 7 which of them are even and

which of them are odd. Now what you'll

see here is that the script uses the

continue command to exit from this

particular statement to this particular

statement. So if I tried to run this,

it keeps exiting

this to produce this even number

statement. With that we come to the end

of shell loops. Let's go back to the

presentation to see what we have next.

So in this segment we will discuss in

detail about functions in the shell. Now

basically what functions enable you to

do is to break down the overall

functionality of a script into smaller

more logical subsections which can be

then called upon to perform their

individual tasks whenever needed. So in

this segment we are going to talk about

creating functions passing parameters

returning values nested functions and

calling from prompt. So here we are at

our terminal. Let's again open our nano

editor.

So to declare a function is very simple.

What you will have to do is type your

function name

and then go ahead with your list of

commands

and then close the bracket. This is all

that you have to do. Now let's start

with this very basic function. Start

with the shebang. Again, not to be

confused with the shebang in the pop

culture that we use.

So, what we're going to do first is that

we're going to define function. So,

again, this is my function name. It's

going to be hello. And then I am going

to just print hello learner. Nothing

very complicated. And then all I have to

do is just invoke my function or call my

function, whatever it is.

So hello. Then I'm going to save it. And

here

it basically called that function. And

that's how simple that is. Now using

functions to perform repetitive task is

an excellent way to create code reuse.

This is an important part of modern

object-oriented programming principles.

Now, shell functions are similar to sub

routines, procedures, and functions that

are present in your other software and

hardware coding languages. The idea here

is to break down a big program into

smaller, more logical subsections which

can then be called whenever they need

it. Now, you can define a function that

will accept parameters while calling the

function. Now these parameters can be

represented by dollar one and dollar two

as we had passed parameters early on if

you remember. Now here if I make some

minor changes to my function I think I

can make it accept parameters. So hello

and I can put two different parameters

and then what I can do is I can put

those parameters right here. Let's say

I'll put two names. Let's say I'll put

Priyanka Chopra because you know pretty

international. Let's just keep it that

way.

And that is what it called. Basically

these two parameters were captured and

printed in this function. What you can

also do is return values from functions.

If you execute the exit command from

inside a function, its effect is not

only to terminate execution of the

function but also the shell program that

called the function. If you instead want

to just terminate the execution of the

function, there is a way to come out of

the defined function. Now based on the

situation, you can return any value of

the function using the return command.

So

again, what we can do is make some

changes here.

Let me return

this. Another thing I'm going to do is

capture this 10 value that has been

returned from my previous command.

All right. So what I'm going to do is

I'm going to print this out by echo and

then

return value is.

So, I'm going to put this here.

So here as you can see the parameters

that we had passed and the value that

has been returned. Now one of the more

interesting features of functions is

that they can call themselves and also

other functions. A function that calls

itself is known as the recursive

function as most of you might know. Now,

I'll also give you an example

demonstrating the nesting of two

functions. So, let me just clear this

out. I could open a new nano editor, but

let's just say I am very lazy. So,

Okay, now let's execute this. Basically,

we have a function number two inside the

function number one function is saying

alpha online over and then calling

number two and number two here is

printing beta online and then we are

calling the function number one which is

our superset if you may in the function.

So if we execute this, we get the first

one, alpha online over and beta online.

I clearly watch a lot of movies as well.

And now you can put on definitions for

more commonly used functions inside your

profile. And these functions will be

available whenever you log in and you

can use them at the command prompt.

Alternatively, you can also group the

definitions in a file and then execute

the file in the current shell. With that

I come to the end of the segment as

well. Now we are going to move on to

some used cases on a small scale of

course to see how shell scripting is

used on a broader scale on a day-to-day

basis. So I am going to clear this and I

am going to clear this as well. So let's

run a few simple scripts to scan and

monitor network using the combination of

your shell script and your ping command.

Obviously these scripts are no match to

a full monitoring dedicated software

like Nagios, but they could be useful

for a small home brand networks where

implementing sophisticated monitoring

systems can become an overhead. Let's

look at something simple first. Okay,

let's look at a scan. So your dot slash.

Okay, so let me just show you the code

for this.

So right now we are going to run a few

simple scripts to scan and monitor the

network using a combination of bash and

ping. Now this is a disclaimer here.

These scripts are no match for a full

monitoring dedicated software, something

like your Nagios, but they could be very

useful for small home brand networks

where implementing sophisticated

monitoring systems can become an

overhead. So let's start with something

simple like scanning a network. So this

is the code. In this script, what we are

going to do is we going to scan the

network for hosts that are attached to

an IP address and the script will print

the message nodes with IP. So if your IP

address is up, then your ping command

was successful. Feel free to modify the

script to scan your host's range

whenever you try it. So as you can see

it starts with your basic shebang line.

Then we are using our ping and we are

basically checking for the exit status

for being zero. Now if your exit status

is equal to zero then it will print that

your IP address is up. Pretty simple. If

we go deeper into it now, we're going to

run this loop for IP addresses from 1 to

255 in the subnet 192.168.2.

Basically, what's going to do is it's

going to ping these many systems and

check if they are up and then disone

them. All right, let's try running the

script.

Now, as you can see, these many systems

are up in this particular subnet. We

have a bunch of different ones. One of

them should be mine.

This one seems like it's mine. And so on

and so forth. All right, let's move on

to our next script.

Basically, what I did just now is I for

stopped this script. All right. Okay.

Now what we're going to do is we will

try to send an email to my email address

when the ping cannot reach its

destination which probably means the

host is down. So system admins can

execute this in a script regularly with

the use of a chron scheduleuler. Now

this script uses ping command to ping

the host or IP that is supplied to an

argument and in case that destination is

unreachable a mail command will be used

to notify the system administration

about this event. So let's look at this.

So cat

all right now this is what the script

looks like. also a pretty small code.

Again, it starts with the shebang line

and it runs a for loop. Now, here you

can see there is a special variable used

which is your dollar at which basically

means that all the arguments are

individually double quoted. So inside

this for loop basically we are trying to

ping all the parameters that are passed

and if the set parameter is not equal to

zero then we are going to get a mail to

this particular email address that the

host is down. All right. So, previously

we had checked for an entire subnet.

That is why we didn't have to pass on

any arguments. But here since we are not

running it for an entire subnet, we are

going to try it on on some trusty

websites. So, before I call in this

code, I would like to show you that this

is what my Gmail tab looks like. There's

nothing in my inbox currently. So what

I'm expecting is that when I pass on an

argument which is not supposed to be up,

I'm supposed to be getting a mail in my

Gmail, right? So let's run this.

Let's put in google.com because we know

it's always running. Let's put

yahoo.com. Let's put in an imaginary IP,

which I'm sure Let's hope this does not

exist. Let's put on one more for safety.

Okay, now we've put in four. We know for

a fact that google.com is always up. So

has yahoo.com. Now we'll have to check

which of these two IP addresses is not

up.

Now let me open my Gmail and check. And

as you can see, I have two new messages.

And if you open the mail, you can see

the message that we had put in as input.

All right. Now that we've done these two

things, let us try an extended version

of the same thing. Now I for stopped

this particular script from running

because it will go on and on and on and

on. Now what we're going to do is that

we're going to create a monitoring log.

So the last example I'm going to show

you here is a modified version of the

previous two examples. Now this example

that I'm going to show you is a modified

version of what I just showed you. When

the mail is not configured on the

system, the script will create a log

file. Now the core of the script is

wrapped into this endless while loop

which is set to execute ping and check

every minute. Feel free to modify the

script according to your own needs. And

you can also go ahead and remove the

endless while loop when you intend to

use the script with the cron

scheduleuler. All right, so let's see

what our script looks like.

So this is our script. Let me break it

down for you a little bit. So first of

all, I have created this log file which

is going to save if your host is up or

down in a temporary log file. It

basically is a directory. Then I have

created another variable called seconds.

So this script is going to run every 60

seconds to check which host is up. The

email is my email which I had shown you

previously. Then the for loop begins.

Now this is very similar to the previous

code that we had just run. This is the

same part. And here we have an infinite

loop which is basically what we're going

to run to check if a host is up. So we

going to ping the various arguments that

we're going to pass and if the said

argument is not equal to zero then the

status gets logged into our monitor log

and if the status is down then again

like our previous code we get a mail

that our host is down else if the host

is up you just ping okay the host is up

and there is no mail now the reason why

I'm not sending a mail when the host is

up. If suppose somebody uses this code

to check a subnet of a lot of systems,

you do not want to spam yourself with a

bunch of different mail saying the host

is up. That is not important. We want to

know when a host is down. And then this

if condition closes with an F5 and your

argument being up is also sent to the

log. And then we have sleep for the

seconds variable which we have put up as

60 seconds. So as I had mentioned the

script is going to run every 60 seconds.

So let's run this. I'm going to check

for google.com and this imaginary IP

address which as we had previously seen

is not up. And then let's put in

yahoo.com and yahoo123.com

which I'm hoping is not an actual

website. Let's put in this 2.2.2. And

now let's run the script. This might

take some time. So kindly be patient.

Let the script run. So while it runs,

let me explain this to you. As you can

see, the core of the script is wrapped

into an endless loop which is set to

execute ping check every 60 seconds.

Whenever you try the script, feel free

to modify it according to your needs.

And if you intend to use the script with

a chron scheduleuler, feel free to

remove this endless loop because that's

what a chronuler will do on its own.

Okay, so I think that's enough time. Let

me just

stop this. And as you can see, I have

already gotten the new messages here.

Again, as you can see, this does not

exist. This does not exist. The hosts

are down. So our ping has failed. And so

we've gotten these mails. Now what else

can we do with it? Let's try to

understand a script to create a network

backup sort of a file. So let's see what

that code looks like.

So for this code, I'll have to go back

to root.

Let's check if our file is here. And it

is. So let me show you the code for

creating a backup of a file in your

network to your local system.

All right. Now this is what your code

should look like.

So first of all, you're going to mount

the shared directory, which basically

means you're not creating a copy of the

directory. But if you make any changes

in your local file, it will be reflected

in your shared file and vice versa. So

CIFS is basically used for sharing your

window file. This is the path of your

shared file and this is the path to the

local directory where you're going to

create your backup. We've had a username

edureka and we've set the password

edureka. That is what hyphen o does. So

again we've mentioned what are we going

to backup. This is the file that we're

going to back up and this is our

destination. Now basically we're going

to create a backup and save it in the

name of the day. So for example, today

is Thursday. So if I create this backup

today, then it's going to be saved in a

folder called Thursday. Our host name is

localhost and so our archive file is

going to be localhost hyphen the name of

the day which is Thursday.

TGZ is basically your tarball file

extension. And then we've put in a print

of the start status message which is

basically supposed to that we have

started creating the backup. What CZF

does here is it basically creates a zip

file because we're obviously going to

import files into the local system and

in the end it is going to show us a

message called backup finished. And

finally we are going to unmount our

shared directory. So first let me show

you I am trying to back up over here. So

now that we know what the code looks

like let's

give it a slash.

So as of now it's creating

a remember I had told you this is how

it's going to name it. Localhost

local host being our host name and

Thursday being today's day.

showing us that these are the folders

that are present in

our directory. So how are we going to

see it? Let's first head on home

change directory

to edurea.

So, let me clear the screen and let me

head

So here I'm home at Edurea

and this is the list of everything that

is there. So, as you can see, there is a

file called backup. And now we're going

to extract the files and see if the code

that we've run has actually worked or

not. So, let me go to that file.

And so now I'm going to unzip the file

and see if actually

now let's go in here and check if we

actually have our files in or not. Let's

go and unzip this file.

And here are all the files that are

present in that particular we have a

bunch of PNG images as you can see. Now

if the same thing I had to show you in

GUI so I'll go to home and this is my

backup file. This is

these are the PNG images that have been

imported into this folder.

Move on versus Windows. This might be

the reason most of you are still hooked

on to this session. So let's start up

with users. Now there are three Linux

you have regular, administrative and

service. Now a regular user account is

created for you when you install Ubuntu

on the system. All your files folders

are stored in SL home directory and as a

regular user you do not have access to

directories of other users. Next you

have the root user or the administrative

user other than your regular account.

Another user account is called root and

it is created at the time of

installation. The root account is a

super user account who can access

restricted file software and have

administrative privileges. Hence the

name administrative user. Whenever you

want to install software, make changes

to the system files or perform any

administrative tasks, you need to log in

as a root user. Otherwise for general

dicing and browsing the internet, you

can use your regular account. And the

third and final account is the service

user. Linux is a server operating system

and services such as Apache, Squid,

email etc

have service accounts having a service

account

of your computer. Now Linux can allow or

deny access to depending on the service.

Now in Windows there are four types of

user accounts. You have your

administrative,

child, and guest account.

Let's go ahead and look at usage. Now,

according to the market research data of

the September of 2007, 92% of the

world's PCs had Windows running while

only about a percent of PC users use

users. Multimedia enthusiasts mainly

used Windows whereas for serious use

server application corporation servers

were running on Linux irrespective of

the GUI. Many users found it use Linux

as compared to Windows obviously due to

the command line interface and so the

appeal of Linux was very limited to

common people. Also for licensing

agreement with Microsoft, various PC

vendors are entitled to bundle Windows

OS with their PC. And for this, Windows

gained the initial market popularity

over Linux. Though these days, many PC

vendors such as Dell and HP started to

give Linux as a pre-installed OS to cut

the cost of their PC system. According

to the latest IDC report, Windows server

market is gaining popularity over

Linuxbased server. The annual rate at

which Linux is growing in the x86 server

space has fallen from around 53% to 45%

globally. The main reason is that while

Linux servers are looking for high

performance computing and web serving,

Windows is apparently adopted on a much

broader basis. Next, let's move ahead

and look at what the kernels are like.

Now, Linux uses a monolithic kernel

which consumes more running space

whereas Windows uses the micro kernel as

of the latest versions which take less

space with the system running efficiency

is lower than Linux. Next, let's look at

file systems. In the Microsoft Windows,

files are stored in folders on different

data drives like CDE. But in Linux,

files are ordered in a treel like

structure starting with a root

directory. Now this root directory can

be considered as the start of a file

system and it further branches out

various subdirectories. Now the root is

denoted with a forward slash and a

general treel like system on your Unix

may look like something like this on

your screen. In Linux and Unix

everything is a file. Directories are

files, files are files and devices like

printer, mouse, keyboards are also files

which is not the case in your Microsoft

Windows. At number five, we have

security. Every Windows user has faced

security and stability issues. Since

Windows is the most widely consumed OS,

hackers, spammers, all target Windows

very frequently. Consumer versions of

Windows were originally designed for

ease of use of a single user PC without

a network connection and did not have

the security features built in. Now,

Microsoft releases security patches

through its Windows update service

approximately once a month. Although

critical updates are made available at

shorter intervals when necessary. Many a

times users of Windows OS face the blue

screen of death caused by the failure of

the system to respond and eventually the

user has to manually restart the PC.

This is super frustrating and it also

may cause you to lose valuable data. On

the other hand, Linux is a very stable

OS and is more secure than Windows. As

Linux is communitydriven, developed

through people collaboration and

monitored constantly by the developers

from every corner of the world. Any new

problem raised can be solved within just

a few hours and the necessary patch will

be ready at the same time. Also, Linux

is based on Unix architecture which is a

multi-user OS. So, it is much more

stable than a single user OS such as

Windows. Next, let's look at

compatibility of the two. Here, Windows

shoots and scores. Here is where the

Redmond offering wipes the floor with

Linux. Despite recent improvements in

software being ported or developed to

Linux, Windows is still the king. Users

of Windows can be certain that most

softwares will work and even obscure

outdated software will continue to work

even when it is abandoned by developers.

Windows has good legacy support plain

and simple. I know of commercial

software that still relies on

technologies like Silverite, ActiveX and

Internet Explorer 11. Linux on the other

hand can struggle with the basics that

Windows users take for granted. Adobe

Flash Player is something else that is

missing on Linux for a really long time.

And even when it did appear with

repositories, it was not as actively

developed as Windows versions. With

regard to file systems, Linux can also

read and write to NTFS and FAT formatted

devices and USB sticks, whereas Windows

will have no idea what extension 4 is.

At number seven, we have ease of use.

Now, this is a tough one to call. Linux

over the recent years has made huge

leaps in usability. Distributions like

Linux Mint have made installation and

setup pretty simple. Even non-technical

users can install and use software and

do normal day-to-day activities like web

browsing, answering emails, playing

music, and watching videos. Windows, due

to high market proliferation, is the

default OS of many devices. Now, think

of it. People like you and me, we grew

up on Windows, right? Buy a new laptop

or a PC, there is a very high chance

that it comes with Windows installed.

Users are used to clicking the toolbar,

opening their favorite programs, which

makes it good for power and non-power

users. Next, we have privacy. Linux

users have a private operating system

that does not spy on them and does not

phone home with any degree of

seriousness. period. Choosing Linux

means the system is yours and yours

alone. Add to the mix that most Linux

systems come with an option of a

built-in militarygrade encryption and

users can be sure that the device theft

poses no real problem to their own data.

As a contrast, increasingly over the

last few years, Windows has gotten more

advertriers

given the choice to opt out and there

are some clever registry hacks that can

help. But advertising is now a part of

Redbin's plan. Windows can also watch

what users do, offering syncing to

Microsoft One Drive service or to learn

behavior to make Cortana the Microsoft

personal assistant better. Personally, I

do not favor these kind of intrusive

tools, but some users do like these

features. Like who wouldn't want a

personal assistant in your laptop? You

already have your Google Assistant and

your series, right? Next, you have

source code. Now, this all of you might

know Linux is open-source whereas

Windows is commercial. So, users have

access to the source code of Linux and

can alter the code as per user need.

Whereas Windows users do not have any

access to their source code. Now this

has its own advantages in Linux like

bugs in OS will fix at a rapid pace and

disadvantages like developers may take

advantage of any weakness in the OS if

they are found. In Windows every user

would not have access to the source

code. Only members of a selected and

qualified group will have access to it.

Next you have license.

Now the Linux kernel and the GNU

utilities and libraries which accompany

it in most distributions are entirely

free and open- source. You can download

and install GNU Linux without any

purchase. Some companies offer paid

support for their Linux distributions,

but the underlying software is still

free to download and install. A funny

folklore here is that Lionus Orvilles

actually was an introvert and did not

want companies to communicate with him

through email. He did not want to be

spammed by all these big companies

running the industry to buy the source

code to his kernel. So basically what he

did was he made it open source for

everybody to access. Funny, isn't it?

Now, on the other hand, you have

Microsoft Windows, which usually costs

between $99 to $199

for each licensed copy. Now, Windows 10

was originally being offered as a free

upgrade to current owners of Windows 7

or 8.1. If they upgraded before the 29th

of July, 2016, but that offer is no

longer available. Then you have

reliability. Now, Windows as we know it

becomes sluggish day after day. You will

want to reinstall Windows after a while

when you encounter crashes or slowdowns

on your system. If you're using Linux,

you will not have to worry about

reinstalling it just to experience a

faster, smoother system. Linux helps

your system run smooth for a longer

period of time. In fact, much much

longer in my experience. Also, with

Windows, you will have to adapt to a

habit where you keep on rebooting the

system for just about everything. If you

just installed software, reboot. If you

recently uninstalled software, reboot.

If you just installed a Windows update,

reboot. And if the system seems to slow

down, you guessed it, reboot. However,

in the case of Linux, you will not have

to reboot for the situations previously

mentioned. You can comfortably continue

with your work and Linux will not will

bother you. Another fact that proves

Linux to be a reliable source are the

web servers. You could observe that most

of the internet giants like Google and

Facebook run on Linux. Even most of all

the supercomputers run on Linux. So why

isn't Windows preferred over Linux? It

is because Linux is far more reliable

than Windows. Period. No arguments.

Finally, we have support. Now, Windows

has a support which is easily accessible

online forums or websites and it has

paid support as well. In a Linux system,

you need not hire an expert to solve a

problem. You just need to search for a

familiar thread on the web for a

solution or post a thread to let others

know of the problem. Within minutes of

posting the thread on any Linux forum,

you may expect a reply along with a

detailed solution which would finally

help resolve your problem at no cost.

It's like Linux has its own Stack

Overflow community, doesn't it? Now

there are a lot of active Linux users

who are always ready to respond to a

relevant thread that might have created.

The number of community users active on

such forums is more than the number of

active members on any Windows focused

forum any day. However, the community

response might be depending on the Linux

distribution being used. With that, I

come to the end of my Linux versus

Windows segment. The last category is

distributions. Now before we begin, I

need to address one of the more

confusing aspects to the Linux platform.

While Windows has maintained a fairly

standard version structure with updates

and versions split into tiers, Linux is

far more complex. Originally designed by

the Finnish student line, the Linux

kernel today underpins all Linux OSS.

However, as it remains open- source, the

system can be tweaked and modified by

anyone for their own purposes. What we

have as a result are hundreds of bespoke

Linux- based operating systems known as

distributions or dros. This makes it

incredibly difficult to choose between

them. Far more complicated than simply

picking Windows 7, Windows 8 or Windows

10. Given the nature of open-source

software, these distros can vary widely

in functionality and sophistication and

many are constantly evolving. The choice

can seem overwhelming and particularly

the differences between them aren't

always immediately obvious. On the other

hand, this also has its own benefits.

The variety of different Linux distros

is so great that you can all find

something that suits your particular

taste. Do you prefer a Mac OS style

interface? you're in luck. Elementary OS

is a Linux distro built to mirror the

look and feel of an Apple interface.

Similarly, if you yearn for the days of

Windows XP, you can bring that back with

a Q4 OS, which darkens back to the

Microsoft's fan favorite. Now, there are

more specialized Linux flavors such as

distros designed to give ancient

lowowered computers a new lease of life

or super secure distros that can be

booted from a USB drive to keep you safe

when using an unfamiliar PC. Naturally,

there are also numerous Linux versions

for running servers and enterprisegrade

applications. For those who are new to

Linux, I'd like to recommend Ubuntu as a

great starting point. It is very

userfriendly even compared to Windows

while still being versatile and

featurerich enough to satisfy

experienced techies. It is the closest

thing Linux has to a default DRO.

Although we would urge everyone to come

and explore various distribution options

available and find out what is your

favorite.

Next, let's look at which OS is most

suitable for you. Now, this one depends

on what you need to do. Both Linux and

Windows are rich in multimedia

applications. Though setting up sound

and video options in the older versions

of Linux can be difficult for some

users. The main advantage of Linux is

that most of the multimedia applications

are freely available. While in the case

of Windows, users might have to pay a

hefty amount to get the software.

Although many open-source free versions

are often available. Moreever, if

anybody buys a copy of Windows on a CD

ROM, they do not get any application

software with it other than the bundled

Microsoft software. But if the same

person buys a copy of a Linux, it

typically comes with a lot of free

application software such as Open

Office, a complete free office suite,

including spreadsheets, presentation, so

on and so forth. A new computer with

Windows pre-installed may have

additional application software, but

that is totally up to the PC vendor, but

each Linux DRO comes with multiple

flavors. The more expensive versions

come up with more application software.

If you're a gamer and need 100%

compatibility with a particular software

or want a user-friendly system, hands

down, Windows wins. Steam amongst other

clients and options provides a huge

number of games for both AAA publishers

and small indie developers. While Steam

for Linux now allows you to install

Windows games, it is still in beta phase

and not all Windows games will work. It

can be a little frustrating for Linux

users like myself and no doubt the

situation will change in the future. But

as of now in 2019, many Linux users miss

out on the top games with their choice

of OS. The graphics card vendors also

tend to support Windows platforms rather

than Linux. They provide timely updates

and new features that don't always

filter to other oss. If you're an

advocate of open-source software or if

your device simply is too old or lower

spec to run Windows or just plain tired

of all the forced updates and reboots in

Windows, then Linux is a great option.

Linux supports almost all major

programming languages, Python, C, C++,

Java, Pearl, Ruby, etc. It offers a vast

range of applications useful for

programming purposes too. Now the Linux

terminal is superior to use over Windows

command line for developers. You would

find many libraries developed natively

for Linux. Also a lot of programmers

point out that the package manager on

Linux helps them get things done easily.

Interestingly the ability of bash

scripting is one of the most compelling

reasons why programmers prefer Linux OS.

Linux also brings in native support for

secure shell which would help you manage

your servers quickly. You could include

things like apt get commands which

further makes Linux one of the most

popular choices for programmers.

Let's move on to the differences between

both of these oss. So let's look at our

first basis of difference the use. Now

Unix is mostly used in internet servers,

workstations and PCs. While Linux is

used by everyone from home users to

developers and computer enthusiasts

alike because Linux OS can be installed

on various types of devices like mobile

phones, tablets and computers.

Development and distribution. Now Unix

systems have different versions and

these versions are primarily developed

by the AT&T as well as other commercial

vendors while Linux as most of us know

is open-source and thousands of

programmers collaborate online and

contribute to its development. It

features through forums etc and is

distributed by various vendors. Now

talking about the architecture, Unix is

available on PA Risk and Itanium

machines. Solaris is also available for

x86 or x64 based systems. Now Linux

originally was developed for Intel's 86

hardware. So the ports available are for

over two dozen CPU types including the

ERM.

Now let's talk a little bit about the

processors of the two. Now, Unix

supports your x86, x64,

spark, power attit

whereas the Linux has a wider variety of

processors that it supports which

include dozens of different kinds of

processors. File system support or the

supported file type. Now Unix supports

ZFS, HFX, GPS, XFS and VXFS systems.

Whereas the Linux is supported by file

types XFS, NFS, CRAM, FSM from 1 to 4,

UFS, DEF, PTS and NTFS which again is a

wider variety of file types. Next, let's

talk a little bit about something both

of these are very known for that is

their shell interface. Now the Unix was

originally made to work in bond shell or

the basic shell that we all know of.

However, it is now compatible with many

others softwares whereas in Linux bash

is the default shell. It offers supports

for multiple command interpreters. Now

that we've spoken about the shell

interface, the next logical question is

obviously about the graphical user

interface. Now the Unix has a common

desktop environment and also has genome

whereas Linux provides two GUIs which

are the KDE and genome though there are

many alternatives such as mate XFCS etc

which are just a few of the millions of

alternatives that it has next let's talk

a little bit about the portability of

each of these now Unix is not portable

period that's it but Linux is portable

and is booted from a USB stick which is

a big plus in the side of Linux. Now of

course this is the next question

security which is one of the most

important features when we move to a

certain OS. Now till date there are

between 80 to 120 viruses that have been

reported in Unix whereas Linux has had

about 60 to 100 viruses listed to date

which are currently not spreading. So

the next most logical question is the

thread detection and solution

procedures. While Unix users require

longer wait time to get the proper bug

fixing patch, thread detection and

solution is very fast in Linux because

Linux is mainly communitydriven. So if

Linux users post any kind of threat, a

team of qualified developers start

working to resolve this threat.

Now next let's talk a little bit about

the source code. Now this must be an

obvious to all of you. As we all know

the source code of Unix is not available

to anyone. Whereas Linux being an

open-source OS the source is available

to the general public. And finally the

license. This is something most of you

must be waiting for. Now in Unix

different flavors have different pricing

depending upon the type of vendor.

Whereas Linux is freely distributed,

downloaded through magazines, books,

websites, etc. There are priced versions

for Linux as well, but they are normally

cheaper than that of Windows. Now, let's

discuss a few limitations of each of

these OSS. Starting with Unix, shall we?

Now, the limitations of Unix. Firstly,

it has an unfriendly tur and

inconsistent and nonneimmonic user

interface. Apart from that, the Unix OS

is designed for a slow computer system.

So, you can't really expect a fast

performance. Versions on various

machines are slightly different in Unix.

So, it lacks consistency. And finally,

Unix does not provide any assured

hardware interrupt response time. So it

does not really support realtime

response time systems. Apart from this,

the shell interface can be treacherous

because a single typing mistake can

destroy a lot of files. With that, let's

move on to a few limitations that Linux

possesses. So here are a few limitations

in Linux. First of all, there is no

standard edition of Linux. Secondly,

Linux has a patchier support for drivers

which basically may result in the

misfunctioning of the whole entire

system. Many of the programs we are

using for Windows will only run on Linux

with the help of complicated emulators.

For example, the Microsoft Office. And

finally, Linux is really suitable for

only corporate users. It is way harder

to introduce in a home setting. Linux

for new users at least is not as easy to

use as Windows.

The first question, the basic question

would be what is Linux? Okay. So as a

layman, as a interviewer, if I ask this

question, what is Linux? The first

answer would be it is an operating

system. So before I get into Linux,

first of all, let me explain you like

what is an operating system. Every time

you switch on your computer, you see a

screen where you can perform different

activities like read and write or browse

the internet or watch a video. What is

it that makes the computer hardware work

like that? How does the processor on

your computer knows that you're asking

it to run a MP3 file? Well, it is the

operating system or the kernel which

does this work. A kernel is the program

at the heart of the operating system

that takes care of fundamental stuff

like letting hardware communicate with

software. So to work on your computer,

you need an operating system. In fact,

you're using one as you read this on

your computer. Now you may have used

popular oss like Windows, Apple OSX, but

here we will learn what Linux is and

what benefits it offers over other OS

choices. So Linux is an operating system

or a kernel which germinated as an idea

in the mind of young and bright Lionus

Torville when he was a computer science

student. Lionus Torbwells is considered

as father of Linux operating system. So

when he was as a computer science

student he took a Linux kernel and he

developed from the scratch. He used to

work on Unix operating system which in

those days called as a proprietary

software and thought that it needed

improvements.

However, when his suggestions were

rejected by the designers of Unix, he

thought of launching an operating system

which will be receptive to changes

modifications suggested by its users.

The benefits of using Linux operating

system. What are the main benefits and

why it gained more popularity compared

to other operating systems? The main

benefits are it offers a free operating

system. You do not have to shell

hundreds of dollars to get the OS like

Windows being open-source in modify it

source code. The Linux operating system

now offers millions of programs

applications to choose from. Most of

them are free. Now once you have Linux

installed you no longer needed an

antivirus because Linux is highly secure

system more so there is a global

development community constantly looking

at ways to enhance its security. With

each upgrade the OS becomes more secure

and robust. Linux is the OS of choice

for server environments due to its

stability and reliability. Mega

companies like Amazon, Facebook and

Google use Linux for their service. A

Linux-based server could run non-stop

without a reboot for years on end. Okay,

this is all about Linux. So, Linux is

just an operating system or a kernel.

Okay, which has been developed from Unix

operating system. So, this is what we

have discussed. And uh coming to the

next question, how different is Linux

when compared to Unix operating system?

You might face different types of

questions when you attend this type of

interviews in Linux operating system

like what is the comparison? What is the

differences did you find between like

Linux and Unix operating system? As I

said earlier, Linux is a Unix clone. But

if you considered according to the POSIX

standards, uh POSIX is nothing but a

portable operating system interface.

According to this standards, Linux can

be considered as Unix. Exactly. To quote

from official Linux kernel readme file,

Linux is a Unix clone written from the

scratch by Linux tobles with assistance

of hackers across the net. So I'll just

take some strategies here in terms of

cost, in terms of development and

distribution, in terms of manufacturer

like what are the differences between

Linux and Unix. In terms of cost, Linux

can be freely distributed, downloaded

freely, distributed through magazines,

books, etc. There are priced versions of

Linux also, but they are normally

cheaper than Windows operating system.

when you compare with Unix. In Unix, we

have different flavors of Unix have

different cost structures according to

the vendors. In terms of development and

distribution, Linux is developed by

open-source development that is through

sharing and collaboration of code and

features through forums and it is

distributed by various vendors. When

coming to Unix, Unix systems are divided

into various other flavors mostly

developed by AT&T as well as various

commercial vendors and nonprofit

organizations.

In terms of manufacturer, Linux kernel

is developed by the community by Linus

store. Linus store will oversee the

things. And when you talk about Unix,

three biggest distributions are Solaris

which is now acquired by Oracle, AIX by

IBM vendor, HPUX, it's by Heavlet packet

and Apple makes OSX which is also a Unix

based operating system. Okay. So I've

just taken three aspects here like cost

development and distribution and

manufacturer like this. We have many

such differences between Linux and Unix

operating system. Okay. So this is what

we have discussed. Okay. Coming to the

next question like what is the

importance of GNU project? GNU project

was launched in September 1983 by

Richard and Stalman to create a complete

operating system which is free software.

The main intention of GNU project is to

create an operating system which is

completely opensource which is

completely freely available for all

public users. The main licenses of the

GNU project are the GNU GPL which is

nothing but the general public licenses.

The name of the GNU project is derived

from the recursive acronym which is

nothing but GNU's not Unix. Okay, the

full form of GNU. It's a recursive term

GNU's not Unix. Unix was a very popular

operating system in the mid80s. So

Richard Tolman designed GNU to be mostly

compatible with Unix operating system so

that it would be convenient for people

to migrate to GNU. So the GNU project

was intended to create a Unix like

operating system but it should be freely

available for all the public users and

it should be a open-source operating

system. So this led to the birth of

Linux operating system. Okay. With the

help of Linux kernel and the GNU

utilities, the importance of the GNU

project, the free software movement

started by Richard M. Stallman.

Okay, you see the full form of GNU GNU's

not Unix. It's a recursive term. Okay.

And coming to the next question, the

question is like what is Linux kernel?

Okay, so this is an important question

would be asked in different types of

interviews and most of the people will

will get confused in answering this

question. What is Linux kernel? Let me

explain you in a simpler way. With over

13 million lines of code, the Linux

kernel is one of the largest open-source

projects in the world. But what is a

kernel and what it is used for? A kernel

is the lowest level of easily

replaceable software that interfaces

with the hardware in your computer. It

is responsible for interfacing all of

your applications that are running in

user mode down to the physical hardware

and allowing the processes which are

known as the services to get information

from each other using interprocess

communication. Technically speaking, a

kernel is nothing but the core of any

operating system and it is responsible

for translating the user commands into

equivalent language understood by the

computer hardware. Okay. So kernel it is

nothing but the heart of any operating

system. It's a core of any operating

system which is responsible for

translating the user commands into

equivalent language understood by the

computer hardware. Okay. So if you can

see this a pictorial representation on

the left pane okay you see applications

on top of kernel you see applications

and bottom of the kernel you see the

hardware devices the hardware devices

like CPU memory and the devices which

are attached to the computer okay so in

order to interact with the kernel okay

applications you see on top of operating

system you have applications so So in

order to interact with an operating

system, applications need to have some

kind of language, right? So kernel would

be acting as a mediator. Mediator

between applications and hardware

devices. It just translates the users

language to the machine language and

machines language to the users language.

It's a core. Kernel is nothing but the

core, the heart of any operating system.

Okay. And coming to the next question,

what is a shell? And in shell, what is

exactly called as a bash shell? Okay,

first let me explain you what is exactly

a shell. A shell is a user program or

its environment provided for user

interaction. A shell is an command

language interpreter that executes

commands read from the standard input

device which is called as a keyboard or

from a file. Shell is not part of system

kernel but uses system kernel to execute

programs like creating files, creating

directories etc. Okay. So please

remember shell is exactly called as a

user interface. In order to interact

with operating system we need one kind

of interface, right? That interface is

called as a shell. Okay. Shell is a

command language interpreter. Most of

the people often confuse between

interpreter and a compiler. Okay, please

remember interpreter is type of a

mechanism that executes commands which

are read from the standard input device

or from a file. Okay. So when you talk

about shell in shell we have different

types in Linux and Unix operating

system. We have bash shell, we have

single shell, we have con shell, we have

csh shell, we have public domain con

shell, we have different types of shells

used in Linux and Unix operating system.

But bash is the default shell. Bash has

been adopted as the default shell for

most Linux systems. Okay, bash is a

shell or a command language interpreter

for the GNU operating systems. Once

again, I'm using the term GNU. Okay, GNU

operating systems like Linux. In most

distributions of Linux operating system,

bash is incorporated as the default

shell. Okay, the name is an acronym for

the bornag again shell. Bash stands for

born again shell. Okay, it is named

after a person called Stephen Bourne.

Okay, he's the author for born again

shell. Now why bash has been

incorporated as a default shell because

in bash we have many such features.

Features like command aliasing, command

completion by using the tap keys and the

command history also. Okay. Like in

order to execute the commands like no

need to remember all the commands in

Linux operating system. Okay. With lot

of ease you can execute all the commands

by the features of bash shell. Okay.

command aliasing, command completion or

file completion by using the tap keys

and the command history. Okay, in order

to execute like previous commands, no

need to type the commands again and

again. You can recall those commands by

using the up and down arrow keys. Using

that you can recall all those commands.

Okay, if I show you practically one

particular example, we have one command

called clear in Linux. See this is the

terminal I'm using the command line

interface the terminal where we can gain

access to Linux operating system. I'm

just giving one particular example like

why bash has been incorporated as a

default shell. Okay let's see what is

exactly a command aliasing. I'm

executing a command called clear. The

command clear which is used to clear the

screen. So every time you want to clear

the screen you run the command clear.

Once you press enter the screen will be

cleared. Now instead for this lengthy

program and what I'll do here I'll just

make an alias C is equal to clear. Now

once you press enter for that particular

command clear I've been alias to C. Now

instead of running command clear I can

run the alias command called C. Once you

press enter the screen would be cleared

like this for any such programs or

applications. If you want to do aliyas

this is possible with bash shell. Now

these kind of features you cannot see in

other shells. Okay. In other shells

other shells like C shell con shell

public domain con shell you don't see

all the types of features in other

shells. In Unix operating system the

default shell was shell. Okay. And what

this person has done, Stephen Bourne has

incorporated some new features. Okay,

some features has been incorporated in

single shell and this has been renamed

as the bash shell. Okay, bash is nothing

but the born again shell. It is named

after an inventor called Stephen born.

Okay, in Linux, if you want to see the

types of shells which are supported, you

can check this configuration file. the

configuration file called /c/shells.

Okay, this is a configuration file where

you can see the number of shells

supported by Linux or Unix operating

system. If you want to see what is the

default shell, you can just recall the

environment variable called shell. This

will tell you what is the default shell

used in the operating system. You see

/bin / bash. Okay. So that is the

importance of bash shell and you must

have got an idea like what is shell and

what is the importance of bash shell?

Okay. And coming to the next question

what are demons? So this would be a

tricky question asked in interviews like

what are demons? If I put it in a

simpler format, uh, demon according to

my readings, demons are services that

provide several functions that may not

be available under the base operating

system. Its main task is to listen for

service request and at the same time to

act on these request. After the service

is done, it is then disconnected and

waits for further request. A demon

process has no controlling terminal. It

cannot open the terminal. For example,

/dev/tty.

If you do ps- ef and look at the ppt

ttty field, all demons will have

question mark for the tty terminal.

Okay, I'll give one practical example

here. If I run a command ps efmens,

usually in Linux and Unix operating

system, a demon would end with d. Okay,

you see for example, let's take this

particular demon here K thread D. Okay,

at the end you see see the character

here D which is nothing but a demon.

Okay, as I told you a demon process has

no controlling terminal. If you check

TTY field here for this particular

demon, you see a question mark. Okay, a

demon process is essentially a program

that runs in the background and is

usually started when the operating

system starts up. Okay, if you want me

to take one more example, a typical

demon process in a mail demon that runs

in the background checking to see if you

have received a new mail when you do it

notifies you. Okay, so most demons tend

to last a long time, be owned by root or

do something useful. But this is a very

tricky question. Okay, what is the

difference between a demon and a

process? Okay, so please don't get

confused between this. A demon is a

service that provides several functions

that may not be available under the base

operating system. Okay, the main

advantage, the main task is to listen

for service request and at the same time

it will be act on these request. So that

is about the demands. Okay, one good

example you can always run ps- ef and

you check all the demens in the tty

field you see the question mark that

means we have not initiated this system

the operating system has initiated all

these demens okay and coming to the next

question what is a lielo a lielo is a

Linux loader it's a bootloadader for

Linux operating system it is used to

load Linux into the memory and start the

operating system. Uh, Lilo can be

configured to boot other operating

systems as well. Lilo is customizable

which means that if the default

configuration is not correct, it can be

changed. The main configuration file for

Lilo would be /etc/lo.com.

Okay, as I said, Lilo stands for Linux

loader, which is just a bootstrap

program. Lilo is the code snippet which

loads PC BIOS into the main memory at

the time of starting the computer

system. Okay. And uh the main task it

handles is locating Linux kernel,

identifying other supporting programs

and loading them into the memory and

starting the kernel. Okay. So, Lilo is

not used nowadays. The default

bootloadader for Linux operating system

is now is grub which is called a grand

unified bootloader. Okay. When you talk

about the latest version of Linux

operating system, it has been replaced

with grub 2. Okay. Some more features

has been added in grub and they have

released the new version that is called

grub 2. Okay. So this is all about Lilo.

It is just a Linux loader. It is called

as a bootstrap program. It's a

bootloader which loads Linux operating

system into the main memory. Coming to

the next question, what are the

advantages of Linux being open-source?

Okay. So, we have been discussed in the

earlier questions also the advantages of

opensource operating system. Linux was

one of the first open-source

technologies, but many programmers have

contributed and added software that's

completely open-source for any user.

This means that you can download the

source code and change it at any way you

like. Some developers have restrictions

on how you can distribute the code. For

instance, some developers allows you to

change the code, but you cannot

distribute it for money. One main

advantage of opensource technologies

such as Linux is a wide range of options

available to users and the increased

security. With Linux being open-source,

several distributions are available to

the end user. For example, distributions

such as Debian, Fedora, Ubuntu, and Mint

are just a few of the distributions

available to end users. And these

distributions are completely free to

download. Security is the other main

advantage. Several white hat hackers

have contributed to the overall security

of Linux and by making the source

available to anyone, security experts

can help identify any main security

flaws in the operating system. Coming to

the next question like what are the

basic components of Linux operating

system? Okay, this is a general question

which would be asked in the interviews.

Linux operating system has primarily

three components. What we have discussed

already is kernel. A kernel is the core

part of Linux which is responsible for

all major activities of this operating

system. It consists of various modules

and it interacts directly with the

underlying hardware. Kernel provides a

required abstraction to hide low-level

hardware details to system or

application programs. Okay, we have

already discussed what is kernel. Next

comes the second part is system library

and system utility. Okay, system

libraries are special functions or

programs using which application

programs or system utilities accesses

kernel features. These libraries

implements most of the functionalities

of the operating system and do not

require kernel modules code access

rights. Like when you compare with

Windows, in Windows we have DLL which is

nothing but dynamic link libraries. In

Linux we have something all the

libraries which are there to read the

file write the file all this coding part

okay implementation of the most of the

functionalities will be there in the /

usr/lib directory or /lib directory okay

and coming to the next question how to

check memory stats and CPU stats as a

Linux admin okay so in interviews as I

said earlier the questions would be

always in tricky format like can expect

questions in theoretical ical or you can

expect questions in practical also. So

you should be well advanced, you should

be well prepared for the interview in

the practical part also. So according to

this question being a Linux

administrator how you can check the

memory stats and the CPU stats. So there

are various commands in Linux here one

such command would be free. If you want

to check memory statistics, you can run

the command called free - m if you want

to see the size in megabytes or free - g

if you want to see the size in

megabytes. And if you want to see the

virtual memory statistics, you have a

command called VM stat. Uh Linux VM

start command used to display statistics

of a virtual memory. You can also see

the kernel threats, the disks, system

processes, IO blocks, interrupts, CPU

activity and much more. Okay, let me

explain you this practically here. As I

said, if you want to see the memory

statistics, you can run the command

called free-m. According to my system, I

just got approximately some 10 GB of RAM

because by default, I'm seeing in

megabytes here. 9,838

MB out of which 651 is used 8,714 is

free or if you want to see that in

gigabytes you can run the command free-

G if you want to see that in gigabytes

and when you talk about virtual memory

statistics you have a command called VM

stat a okay so in this example there are

six columns here the significant of the

columns are explained okay in details

here As you can see the first is the

processes the memory swap IO system and

CPU. Okay, you can just find out with

the VM stat command. You can also check

the dynamic activity of your system.

Like for example, you see I'm running

the command here VMAT 2 space 6. With

this command, VM start execute every 2

seconds and stops automatically after

executing six intervals. See this

practically see the interval here. Okay,

interval is every 2 seconds and it will

stop automatically after six intervals.

Here you can monitor like this virtual

memory statistics. Okay, if you want to

see along with the time format here, you

run the command VM stat

okay 1, 5 for example. Once you press

enter you can see along with the time

format. Okay. So like this we have many

such options in VM stat the based on the

requirement the based on the performance

and monitoring you can execute those and

coming to the CPU you have a command

called SAR the system activity report.

Okay with SAR - U you can display the

CPU usage. See exactly you can see the

CPU usage. Okay. S - U displays the CPU

usage for the current day that was

collected until that point. Okay. If you

want to see the realtime CPU usage, it's

the same like VM stat

U 1 space 3. Okay. Every 1 second but

three intervals here you can see. Okay.

SAR is very very very important command.

It is used by uh every administrator to

monitor the day-to-day activity. Okay.

In SAR also we have many such arguments

here. If you want me to discuss more SAR

- R to see the memory free and used I'll

give 1 comma 3. You can also see with

the SAR you see the KB memory free KB

memory used and memory used in

percentage. You can see all that with

the SAR command also. Okay. This is all

about the system monitoring and the

performance.

So coming to the slide. So these are

some programs we have just given in the

slide here. We have discussed about the

free VM stat to see the virtual memory

statistics. And uh when you talk about

CPU statistics, you can always use the

program star which is nothing but system

activity report. Okay. So I just gave

you some basic examples. But if you dig

more into this commands, you have many

such options. Okay. And the frequently

asked questions in interviews would be

how to reduce or shrink the size of an

LVM partition. Okay. This is a

frequently asked question in interview.

See the main advantage if you just

compare between a partition and a

logical volume. Okay. The storage

management can be created like whenever

you want to create a partition,

partitions can be created by using a

tool called FDK. But if you create a

partition using FD, it is the fixed

partition size. Later it is not possible

for us to modify or resize or shrink the

partition size. That flexibility is not

available using fisk partitioning tools.

Now using advanced partitioning tool

like LVM which is called as a logical

volume manager we have a flexibility of

either resizing a logical volume or

reducing or shrinking the size of a

logical volume. So let's see practically

how you can do that in Linux operating

system. I'm talking about advanced

partitioning tool called LVM which is

nothing but the logical volume manager.

Okay. So I've already created a logical

volume manager here as you can see with

the command dfh capital T. You can see

for example there is a logical volume

here. The logical volume is zoom Linux

and the type of the file system is ext4.

The size is 4.8GB and currently this

logical volume is mounted on the mount

point called / LVM. So now I got a

requirement of reducing this logical

volume size. Okay, in other file systems

I'm running out of space. I would like

to reduce this logical volume and I want

to increase the logical volume for other

file systems. So let's see how exactly

we can do that. Okay. So let me take one

example here. There is a logical volume

which is of 5GB currently. I would like

to reduce to 3GB now. Okay. So that that

2GB I can accommodate to other file

systems. The first thing is online

shrinking is not possible. So first you

need to unmount a logical volume. The

command is u mount and specify either

the device name or the mount point and

then you can check whether you have any

problem with this particular file

system. You run the command e2fck - f

and specify the device name. Okay. So

this is must and should before you

reduce the logical volume. You just need

to scan your file system. Okay. E2 FSK

is the command to check the particular

file system whether you have any

problems or not. Now once you press

enter so exactly you should find this.

Okay. So we have no problems with this

particular file system. Now we can

reduce by using the command resize to

FS. Specify the logical volume name. I

would like to reduce from 5GB to 3GB.

The current size is 5GB. I would like to

reduce to 3GB and the remaining 2GB I

would like to accommodate to other file

systems. Enter. Now you see the logical

volume size has been reduced. Okay. So

now we can run the command lV reduce

capital L 3GB and specify your logical

volume name. Now once you press enter it

will be reduced to 3GB. Now from 5GB to

3GB. As you can see some information

here and then you can mount your logical

volume to the mount point called LVM.

Now you can see the logical volume size.

Now it has been reduced from 5GB to 3GB.

Okay. This is a you can reduce or you

can shrink the size of a logical volume.

Okay. So this flexibility is not

available in fixed disk partitions. Once

you create partition that's it. Now you

don't have a flexibility of modifying

the partition size or shrinking the

partition size. So this is possible only

by using advanced partitioning tool

called LVM which is nothing but the

logical volume manager. So let's get

back to the slides here. So we were

discussing about like how to reduce or

shrink the size of a LVM partition or a

logical volume. It's a five-step

process. First you have to unmount run

fsdk run the resize to fs to 3GB or

whatever required size you want and then

you run the command lv reduce to reduce

the logical volume then you can mount

that particular file system. Okay the

next question being explain the

functionality of a root user. Okay. So

in computing world the super user is a

special user account used for system

administration. Depending on the

operating system the actual name of this

account might be root or if you talk

about Windows we call as an

administrator or admin or supervisor. In

Unix like computer operating system root

is the conventional name of the user who

has all the rights or permissions to all

the files and programs in all modes.

Okay. The root user can do many things

which an ordinary user cannot such as

changing the ownerships of files binding

to network ports numbered below,024. So

root is the default account every time

Linux is installed. Okay, so there comes

your question again. What is CLI and

what is GUI? Okay, CLI is nothing but

the command line interface is a console

or textbased representation in which the

user types the commands to operate the

software or devices. The main advantage

of CLI is multiple steps can be executed

by specifying a single command which is

not possible in graphical mode. Okay. So

a GUI which is nothing but the graphical

user interface is a graphical

representation in which the users can

interact with software or devices

through graphical icons. Okay simple

definition what is CLI and what is GUI.

So how can you find out how much memory

used in Linux operating system? So again

uh same question here.

So how exactly you can find out? There

are many such programs here. The command

would be free. Okay, the free command is

the most simple and easy to use command

to check memory usage on Linux operating

system. So here is an example free n or

free- g or you can also cap the contents

of /pro/me info. This will also give you

the complete information about your

memory. You can see here the total

memory. Okay, memory in free and memory

available. And you see the used and

everything here. Okay, you can use this

command also. You can just cap the

contents of /pro/mefo.

Okay, or better the simple command would

be free - g. Okay. What is swap space

and what is the typical size for a swap

partition under Linux operating system?

So this is also one of the most

frequently asked questions in

interviews. So what is a swap space?

Swap space in Linux is used when the

amount of physical RAM physical memory

which is also called as RAM okay is

full. If the system needs more memory

resources and the RAM is full inactive

pages in memory are move to the swap

space. While swap space can help

machines with a small amount of RAM it

should not be considered as a

replacement for more RAM. Okay. So

people often get confused between main

memory and swap memory. Okay. So if the

CPU doesn't find free space in the

physical RAM. So what CPU does is it

just moves all inactive processes, all

inactive pages from the main memory to

the swap space. The swap space which is

created onto the disk. Okay. To ensure

it improves your system performance.

Okay. So the preferred size for spap

partition is twice the amount of

physical memory. Okay, amount of

physical memory available on the system.

If this is not possible then the minimum

size should be the same as the amount of

memory installed. Okay, swap is used in

normally desktops and laptops. Okay, not

in service because in service we have

equipped with more RAM. We have 32GB,

64GB, 128GB. On those systems, there is

no need to create a swap space. Okay,

swap space only for low-end machines

where we don't have enough RAM

available. Okay, so swap is just to

improve the performance of the computer,

nothing more. Okay. And uh how do you

access partitions under Linux? What is

the naming convention for devices in

Linux operating system? Okay, as you can

see here, I'm running the program foc.

And you see the first device, I got two

drives connected to my Linux system. The

first drive is /dev/ SDA and the second

driver is /dev/ SDB. See the naming

conventions here, the conventions used

for sky drives. In case you have ID hard

drives, the first convention would be

/dev/ HDA, HDB, something like that. If

you got scissy drives or SAS drives, the

naming conventions would be SDA and SDB.

And under this first hard drive here, if

you see, you have the partition starting

from SDA1 to SDA13. The first partition

/dev/ SDA1 and the second partition SDA2

like that. Okay. So these are the naming

conventions used for your storage

devices. And this is how exactly you can

access partitions under Linux operating

system. Okay, you see here ID hard drive

starts with H in case you got SAS and

scissy starts with S, SDA, SDB go on.

How are hard drives and floppy drives

referred in Linux? Just now I told you

right SDA, SDB and for floppy drives it

would be FD0, FD1. Nowadays nobody

accessing floppy drives but it would be

a question in interviews how floppy

drives would be referred in Linux

/dev/fd0/dev/fd1

based on the number of connections you

have in your system in case of hard

drives HDA HDB in case of IDE if you

have scissy or SAS drives SDA SDB

something like that okay these are the

naming conventions used for floppy

drives and hard drives. Similarly, in

Linux, how are names assigned to

different serial ports? What we also

called as communication ports. The

communication ports are identified as

/dev/T

S0 to TTW S1. You see practically here

ls-l/dev/ttar.

You see here the communication ports.

Okay. TT5 S0, TT5 S1. Okay. what we

normally called as communication ports

in Windows. Communication one,

communication two like that. Okay.

Coming to the next question asking about

printer ports. How exactly you can

identify the printer ports in Linux?

Same thing /dev/lpstar,

LP0, LP1, LP2. These are the names to

use for printer ports. Okay.

And the very basic question asked in

interviews is what are the kind of

permissions available in Linux? Okay,

what are the basic file permissions or

the directory permissions available in

Linux? So there are basically three

levels of file and directory permissions

in Linux. One is read. Read like users

only read the files or list the

directory contents. And the second

permission would be write. As the name

suggest, users can write information to

the file or create files inside the

directories of a subdirectory. And the

third permission would be execute. The

users can run the file or look up a

specific file within a directory. Okay.

So besides these you can have a

combination of all these three levels of

permissions and two of them or one of

them some combinations read write

execute or read write or read execute

the based on the requirement as an

administrator I can change permissions.

Okay basically there are three

permissions. The three permissions what

we see here that is read, write and

execute. Okay, coming to the next

question like how do you change

permissions under Linux? So there is a

command called chod. chod is a command

to change permissions for files and

directories. And the permissions can be

changed in two formats. One is symbolic

mode and other one would be absolute

mode. Symbolic mode is nothing but using

numbers and absolute mode is nothing but

like using characters. Okay. Like rwx

or 755 or 644 with help of ch mode you

can change permissions. Okay, in order

to change ownerships, you have a command

like chown and chp in order to change

ownerships for files and directories.

Okay, see here the command ch mode is to

change permissions and if you would like

to change the ownerships, you can use

the command ch and chp.

Okay, on the left pane you can see some

representation here. User groups others

and the permissions are read, write and

execute. Okay, plus is to add

permission. Minus is to rework

permission and is equal to to override

the existing permissions. Okay, the

permissions can be changed in two

different modes. Symbolic mode and

absolute mode. Symbolic using like

characters are wx. Absolute is using

numbers. Okay, combination of numbers.

The read value is four. Write value is

two. Execute value is one. You can

either use characters or you can use

numbers. Okay. Symbolic mode or absolute

mode. Yes. CH mode 7 0 0. What is seven?

Read, write, execute applicable for

owner. Zero means none permissions

applicable for group. Zero again none.

And this is applicable for others. Okay.

And coming to the next question. What

are symbolic links? Very interesting

question. Okay, symbolic links. So in

Linux basically we have two types of

links. One is symbolic link which is

also called as the soft link. So

symbolic link you can always compare. If

you take an example like in Windows we

have shortcuts. Okay, we always create a

desktop shortcuts. Now instead of going

to the lengthy part or navigating into

directories into directories and

directories we can better create a

shortcut on the desktop okay for easy

accessing and easy way of interacting

with the operating system. Similarly in

Linux it is called as a symbolic links

or soft links. So this is one special

kind of file that points to another file

like I've compared with Windows right we

have shortcuts but please remember

symbolic link does not contain the data

okay symbolic link will not have the

data all the data we have in the target

file but not in the shortcut okay and

what are the benefits of using symbolic

link it just allows instant access easy

of access of application or a program

okay without having to navigate to

multiple directories here. Let me show

you one practical example here. For

example, I just want to see the

configuration file of my LAN card,

network interface card. The command

would be cat/etc/sis

config network scripts and the

configuration file would be starting

like this. This is my configuration file

for my LAN card03.

See the path here etc sysconfig network

scripts. Under this directory we have a

file called if cfg - np0 s3. Now instead

what I'll do here I'll create a symbolic

link. See ln - s is the command. ln

stands for link. Now what type of link

I'm creating here? I'm creating a

symbolic link. The path would be etc

sysconfig network scripts if ccfgen

emp3. For this particular file, I'm

creating a shortcut under my root

directory with the name called ifcfg.

Enter. The link has been established.

Now, instead of viewing the LAN

information, instead of going to this

lengthy path better, I can read from the

shortcut. Now, which one is easy to

access? Either this one or the from the

shortcut. I know it is from the

shortcut. See the properties here ls-l/

ifcfg because this is exactly pointing

to the original file the target file

this is a link file the symbolic link

file which is pointing to the target

file now instead of using this lengthy

part here I can better use my shortcut

okay so these are called symbolic links

please remember symbolic link does not

contain the data all the data we have in

the target file we don't have anything

over here Okay. What are the qualities

of symbolic link? Now, both the files

will have different iode numbers. We'll

discuss about iodes. Both files, the

source file and the target file will

have different iode numbers. Will have

different permissions and the different

size also. Okay. Soft link will always

have different name. Same content both

will be having same content but the

different name. Okay. And remember soft

links can be created only for files and

directories. When you compare with hard

link, hard link can be created only for

files but not for directories. But soft

links can be created for files and

directories. And soft link can cross the

file systems also. You can establish a

link between file systems whereas hard

link you cannot span across file

systems. Okay, I hope you got me about

symbolic links here. See the qualities

of soft links what we have discussed.

Okay. Both files will have different

iode numbers, different permissions,

different size but the same content but

with a different name. Okay. What are

hard links? Now in computing a hard link

is a directory entry that associates a

name with a file on a file system. All

directory based file systems must have

at least one hard link giving the

original file for each directory. Okay.

The hard link is usually only used in

the file system that allows more than

one hard link for the same file. Okay.

Hard links can be created only for files

but not for directories. And hard link

you cannot span across partitions. It

should be created within the file

system. Okay. So these are some of the

differences between the symbolic links

and hard links here. Okay. And coming to

the next question like what is the

maximum length of a file name under

Linux. This is also one of the important

question which is frequently asked in

Linux interviews. Linux has the maximum

file length of 255 characters. Okay. For

most file systems like ext3, ext4. In

those file systems you can have a file

up to length of 255 characters. Okay.

And a maximum path of 4096 characters.

Okay, what we have discussed here the

maximum path you can have up to 4096

characters and one particular file name

you can have up to 255 characters. Okay,

coming to the next question. Which type

of files are prefixed with a dot? So

generally in Linux and Unix operating

system if any objects starts with dot or

prefixed with dot those are called

hidden files. I'm under super user home

directory. If I want to see all the

files here, you can run a command ls- a

including all the files. You see one

particular file prefixed with dot. So

this is exactly a hidden file. This is a

regular file which is not starting with

dot. And this is a file which is

prefixed with dot. This is the hidden

file. Okay. And you see a directory also

which is prefixed with dot. And you see

the regular directory. Public is the

regular directory. dot cache is the

hidden directory. So these files can be

sometimes called as the configuration

files also which holds some important

data. If you see one example here cat

bash rc some aliases has been mentioned

here for that particular environment.

Right? So mostly in Linux and Unix

operating system if any objects begins

with dot those are called hidden files

and hidden directories.

Coming to the next question like what is

a virtual desktop? Virtual desktop like

whenever a user's desktop environment

when you talk about users desktop

environment like icons, wallpapers,

windows like folders, toolbars, okay, is

stored in a remote server rather than on

a local PC then it's exactly called as a

virtual desktop. Okay. The desktop

virtualization software separates the

physical machine from the software and

presents an isolated operating system

for users. Desktop virtualization tools

include like Microsoft virtual PC,

VMware Workstation and Parallel Desktop

for Mac operating system.

The main benefits of desktop

virtualization, it just includes like

cost savings because resources can be

shared and allocated as a needed basis

and more efficient use of resources and

energy. Improved data integrity because

backup is centralized and centralized

administration. Okay, this is about the

virtual desktop. What we have discussed

the benefits of virtual desktops. Okay.

And uh what does a nameless empty

directory represents? Empty directory as

you know empty directory name serves as

a nameless base for the Linux file

system. This serves as a attachment for

other directories, files, drives and

devices. Okay, empty directory. How can

you create folders and files using the

terminal? So in Linux operating system

if you want to create a directory you

can use the command mkdir and to create

files we have many such programs for

example like vi cat command or you can

use graphical based editors like gedit

nedit pico nano you have many such

programs to create files okay you even

have line editors screen based editors

graphical based editors to create files

in Linux and Unix operating system.

Okay. But if you want to create a

directory, you want to create a folder,

use the command mkdir. Okay. And uh next

question would be what are the different

ways to view the contents of a file.

Okay. To view the contents of a file,

once again we have many such programs

here. We have many such inbuilt Linux

programs. You can either use graphical

based editors or textbased editors.

Something like cat, vi, vim, gedit. You

have pico nano. you have many such

programs. Okay. What are environment

variables? One important and interesting

question. What are environment

variables? Environment variables are

global settings that control the

behavior of a shell. Okay. Software

packages installed in Linux and other

processes. The path where the various

softares are installed will be stored as

a environment variables. Environment

variables are used to pass information

into processes that are spawned from the

shell. Shell variables and variables

that are contained exclusively within

the shell in which they were set or

defined while interacting with your

server through a shell session. There

are many pieces of information that a

shell compiles to determine its behavior

and access to resources. Some examples

if you want to see in environment

variables also we have different types.

We have system variables and we have

userdefined variables. In the case if

you want to see the system variables,

you can run the command env. ENV is a

command to display all the environment

variables which are set by default with

the operating system. Okay, one good

example of an environment variable would

be path. Okay, this is a system variable

which has the information about the path

of all your binaries, all your

executables. Okay, if you take one more

example, you see the environment

variable called home. What is the super

user home directory which is /root?

Okay, these are some examples here.

Environment variables. Okay, system

variables and userdefined variables.

What is the functionality of a tap key

in CLI? We were discussing about the

features of bash shell, right? I was

talking about command aliasing, command

completion by using tap keys and command

history. Let me show you practically

here in the current working directory

called /root. I have a file called

anaconda case. Cfg. Let's take one

example here. There is a file called

anaconda case. CFG. If I want to see the

contents of this file, I can run a

program called less or more or cat. You

can do anything here. But I have to type

the complete file name case.cfg. Rather

what I'll do here? I'll simply type few

letters. I'll use the tab key here.

Automatically the file name would be

completed. See cat anaconda case. CFG.

I'm not typing the complete file name.

I'm just using a few letters and then

I'm using the tap keys. Enter to see the

contents of this particular file.

Similarly, there are many programs in

Linux starts with the character C. I'll

type C here. I'll use the tap key. I can

see with the C letter, I have 162

possibilities. That means I have 162

programs here. You see one such program

called CAT. If you want to see CA, use

the tap key here with the CA. We have

this many possibilities here. One good

example is cat. One good example would

be calendar. Okay. So these are the

features of the bash shell. Okay. To

complete a command or to complete a file

name or the directory name.

Okay. What is redirection in Linux? This

is also one of the frequently asked

questions in Linux share. Okay. So what

is exactly a redirection? So in Linux

redirection is used to pass the output

of one operation as input to another

operation in the same command. If you

see one example here as an administrator

I would like to find out like the users

who logged in with my operating system

who currently using my operating system.

I can run the command called W. With the

W I can have all this information. Okay.

Since when my PC is up and running,

okay, for how long a PC is up and

running, how many users are connected

and what is the load average of my

computer? And you see the remaining

information here, the users, the

terminal they logged in, from which

system they logged in, you see the login

time, you see the idle, the JCPU, PCPU,

and what exactly they're doing, what

commands they're executing. Okay, I just

want to send this report to one of my

lead manager so that he can have this

information here. W and I would like to

save this particular information in one

particular file. So this is exactly

called as a redirection. Okay. So

redirection is nothing but which is used

to pass the output of W command. Okay.

Output of one operation will be the

input for another operation. Okay. W

will display all this information and

this will pass to this particular file.

See cat log all this information has

been passed here. This is exactly called

as a redirector. The greater than

symbol. Okay. It is called as the

redirector. The redirector symbol. The

greater than symbol. Okay. They give one

more examples here. The cat files file

one file two. The contents of file one

file two will be in file three. Okay, if

file three already exist, the file 3

would be overwritten. And if you don't

want to overwritten, if you want to

append, you use double redirecting to.

Okay. And uh what is gp? So this command

is used for searching for a particular

string or you can also call as a word

searching for particular word in a text

file. Okay. It also supports

patternbased searching. The pattern

based searching is done by including

options and parameters in the command.

Okay. One such example is the command is

grab. I have one file here. The file

called testing. In this particular file,

I have some words and characters and

numbers here. I would like to grab this

word. The command is g. The word you

want to search for from the file called

testing. see gp the string or the word

you want to search for from the file

called testing here. Okay, if you want

to see with the line numbers, you can

pass an argument called hyphen n. At

line number 17, I have the word called

sd. If you want to see the count of the

word, you can use an argument called

hyphen c. I just have only one word

called sd in the file called testing.

the count like this. We have many such

arguments in GP. Okay. The pattern based

searching is also possible in GP

command. Okay. And coming to the next

question like how to terminate on

ongoing process in Linux here. So in

Linux every process in Linux operating

system is identified by a Unix process

which is called as a P ID number. Okay.

P ID is nothing but the process ID. To

terminate any process, we can use the

command kill. You can either use the

process name or you can use the process

ID. Okay, you see the command kill. And

if you want to terminate all process at

once, you can use the command kill zero.

Okay, it shouldn't be executed on

production environments. Kill zero. Not

recommended command but only for

information sake. And how to insert

comments in command prompt? So this is a

very basic question. Comments are

inserted by using the hash symbol before

the comment text. You see any such

configuration file for example if you

take /c/grub.com

or /c/profile

for example. Okay you see the comments

here. The comments can be provided by

using the hash symbols. So these are the

commented lines and these are called

unccommented lines. Okay. So, can you

insert several commands in a single

command line entry? If so, then how?

It's a very good question. So, this is

also called as a command chaining. Like

you can execute multiple commands one by

one. Okay. By using a semicolon. Okay.

If I give you one practical example

here, the first thing is I would like to

create a directory called directory 1.

And then I want to go to this directory.

Then under this directory I would like

to create all these files. So this is

called command chaining. One after the

other the commands would be executed.

The first command is to create a

directory and the second command to

execute a directory. Under this

directory I'm creating all these files

with the names called J, K and L. Okay,

this is exactly called the series of

commands in a single entry. You go to

this directory. See the files has been

created here. Okay. Write a command that

will display all the txt files along

with its permissions.

Okay. Write a command that will display

all the txt files. Means we have to use

the regular expressions. And the common

extension we have to use is txt. So I'll

use the command ls-

al.txt.

Okay. So in this particular directory I

don't have anything here with start.txt

but this would be the command. The

command is ls- alt

txt. It would display all the files

including hidden files with the

properties. Okay see here I got gita.txt

report.txt along with the properties

here. Okay. And the next question would

you write a command that will look for

files with .txt extension and has the

occurrence of the string edurea in it.

Okay. So we have to use combination of

commands here and that combination would

be I'll give an example here of find

forward slash search from the complete

directory. Here I would like to search

the txt files here. From the txt files I

would like to search for a word pattern

called edureka. Okay, the combination of

commands here. First, it would find all

the files which has the extension txt

and then using the advanced command

called x arguments, I'm running a

command called gre.

I'm searching for the word pattern

called edureka. Okay, find will list all

the files with extension.xt and gp is

used to search for the string edurea.

This is how you can do it. Same thing

how to find the status of a process. If

you want to find the status of a process

in Linux operating system, you can run

the command called ps- aux.

Okay. So you see the status here the

status of a process. If it is s it is

interruptible sleep state. That means it

is waiting for an event to complete.

Okay. If you find D somewhere here D

that is uninterruptible sleep state

usually it is waiting for IO operation

to complete. If it is R that is a

running state. If it is Z that is

nothing but the defunct process which is

also called as a zombie process. Okay.

The process which is terminated but not

reaped by its parent. If it is T all of

you that is it is a stopped state either

by a job control signal or anything it

can be okay you can also see some code

meaning here you have the greater than

symbol and you have n you have l there a

greater than symbol is nothing but the

process which is of high priority you

see here okay interruptible sleep state

which is of high priority if it is n

here somewhere you see n here n is

nothing But the low priority if it is L

means the process where the pages has

been logged into memory. Okay. Like this

you can find out the process states by

using the command ps a ux the status of

a process. You should look into this

column the status of a process.

Okay. And uh what is the command to

calculate the size of a folder?

This is also one of the important

question and you can find out with the

command du which is nothing but the

directory usage and with the arguments

hyphen sh of the directory boot. You see

for the directory boot it is occupied

135 MB. Okay. The command du is to find

out the directory usage of a particular

directory. Okay. How to check the memory

status of the system? The command is

free m or free- g. Okay. same thing and

uh how to login as root in Linux from

the terminal. I've already logged in as

a root here. Let's say for example I

have a user called Edureka.

This is a user logged in with the user

Edureka. I want to gain access to super

user. Okay. I want to login as root.

Simple. I can run the command pseudo

su-en and uh I think I don't have sudos

configured here. I'll simply run the

command su-en and then I need to provide

a super user password. Then I can login

as a root. See here the prompt has been

changed from the dollar sign to the hash

prompt. Dollar sign is the prompt

provided for all users and the hash

prompt is the prompt only provided for

super user. Okay. The command su su

stands for substitute user with the user

edureka. I gained access to the

operating system as root user. Okay,

like this you can do the command su. And

the next question is how can you run a

Linux program in the background

simultaneously when you start your Linux

server? This is a very very important

question and this is frequently asked in

interviews and the command would be no

hub. Okay, the command is no hub. By

using the nohub command, the process

will run in the background. Okay, any

process which receives the NOHUB signal,

okay, will be terminated when you log

out the program. Okay, until then the

process would be running in the

background all the time. Okay, please

remember the command would be no hub.

Okay, by default it just plays the

process in the background. Which demon

tracks events on your computer? Events

on a Linux system. Okay, we have the

demons like cyst log D. We have demons

like R sys log. We have so many tracking

events in Linux and Unix operating

system. Okay, the answer should be cyst

log D or R sys log. Okay, so what is

partial backup? So partial backup is

nothing but a type of backup where the

complete operating system is not taken

as a backup. Okay, only certain files,

certain folders have been backed up but

not the complete file system. That is

exactly called as a partial backup.

Okay. So when you select only some

portion of a directory okay in a single

partition that is exactly called as a

partial backup. Partial backup is not

the complete backup only certain files

and folders have been backed up. Okay.

So in Linux we have many such backup

programs like tar cpio dump restore.

Okay. Using this you can take a backup

either complete file system backup or

the selected files and folders based on

the requirement. And next question would

be I note very very important one. Ide

is nothing but uh the contents of any

file will be stored in data blocks.

Whereas information about that file will

be stored in iode. So when we talk about

data data has two parts. The contents

the contents will be stored in the data

blocks and information about the file

what we called as metadata. That

metadata will be there in the iode.

Okay. So information what type of

information is stored in iode like the

file size the permissions the user

ownership the group ownership the link

count when exactly the file was last

accessed or last modified. Okay all that

you can see in iode. So an iode number

points to an iode table which is a data

structure that stores all that

information. the size of the file, the

device ID, the user ID, group ID, the

file mode permissions, everything. Okay.

So, which command is used to set a

processor inensive job to execute less

CPU time? Very very important question

and the answer would be the command nice

and reice. Okay, these are the programs

which are used to set a priority. Okay,

you can change the process priority

using nice and renice programs. So nice

command will launch a process with an

userdefined scheduling priority. Reise

command will modify the scheduling

priority of a running process. Okay. So

the process scheduling priority ranges

from minus20 to 19. Keep this in mind.

This is very important. Okay. The

process scheduling priority range from

minus20 to 19. We also call this as a

nice value. Okay, a nice value of

minus20 represents the highest priority

and the nice value of 19 represents the

least priority of a process. Okay, if I

show you one practical example here, let

me just create one particular file. Cat

redirecting file one. I'm creating a

file. Okay. So in the back end one

process would be invoked because I'm

creating a file here. Let me open

another session here. Let me show you by

just running the command psl

and the process name called cat. Okay.

See this particular process by default

you see the nice value the nice value is

zero. Whenever you submit a process by

default every process will have a nice

value zero. Okay. See here similarly if

I submit a program with the less

priority for example minus 10 okay minus

10 cat redirecting file one here now you

see the nice value let me open the other

other this one let me recall the same

command now you see the nice value for

cat command the nice value is 10 okay

the nice value ranges from minus 20 to

19 minus 20 being the highest priority

and 19 being the least priority see I

launched a program with the nice value

with the least value called 10. Okay, if

you want to launch a program with the

highest priority, I'll give minus 10.

Okay, do not get confused here. It is

not hyphen. It is minus 10. Now you see

now it is minus 10. Okay, that means

this command requires more CPU time.

Okay. Similarly, unlike nice, if there

is already a running process, that can

be changed by using the command called

renise. Okay, the command is renice

hyphen n the priority you want. Okay,

and you can give the process name or the

process ID, you can do with the renise.

Reise can be used if the program is

already in used. Okay, very important

programs. See here the priority ranges

from minus20 to 19. Minus20 being the

highest and 19 being the lowest

priority. And the last question is like

what are shadow passwords and how they

are enabled. So shadow passwords are

given for better system security. Every

user's passwords will be stored in

/c/pass

file. And by implementing shadow

passwords, all passwords will be stored

in encrypted format in a new file called

/c/

shadow. Okay. The passwords in the

original file will then be replaced with

X. In multi-user environments, it is

very important to use a shadow

passwords. Okay. If I give one small

example, like in Linux, we have two such

database files here. One database file

will have information about users and

other database file will have

information about users passwords /c/

shadow. Okay, we have two such database

files here which keeps information about

users and users passwords. Okay, so this

is to improve the security. In earlier

days, in earlier versions of Linux and

Unix operating system, there used to be

only one particular file which has

everything user and the users file. See

an example here. Example called password

convert

cat/et/

password used to have everything like

this in one particular file. You have

users, the users passwords and

everything. But the problem is this

particular file is readable by everyone.

See here /c/ password is owned by root.

He got full permissions here. Even

others got read permissions. Okay. Which

does not impose security on this

particular file. Okay. So that is the

reason there are two database files

maintained. One is etc password and etc

shadow files. Now you see the shadow

file is only has read permissions for

root. For others you see we have none

permissions. Okay. So this is our we

have two database files here. ETC

password which has information about

users and etc shadow which has

information about users passwords. Okay.

Not only passwords you also have

information about the password age also

for how long we can use this password

when password would be expired. All this

information can be used in etc shadow

file.

>> And with this we have come to an end to

this full course on Linux. If you

enjoyed listening to this full course,

please be kind enough to like it and you

can comment on any of your doubts and

queries. We will reply to them at the

earliest. And do look up for more videos

and playlist and subscribe to Idora's

YouTube channel to learn more. Thank you

for watching and happy learning.

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.