4:47:02
2025-02-19 09:20:08
2:39
2025-02-19 21:55:33
1:15:07
2025-02-20 09:31:43
1:28:23
2025-02-20 11:13:37
1:16:38
2025-02-20 13:43:10
Visit the Network Engineers Programme course recordings page
WEBVTT
-->
I don't have the permission to do that. I'm not sure if you understand.
-->
Yeah, I get it. So what can I do to help you out?
-->
It's possible to give you those permissions or just make me...
-->
I just want to see once you have a terminal on my campus a bit.
-->
I can see it's a bit more now that that is...
-->
You want to make it a full screen?
-->
I just want to make it a full screen.
-->
If you go to your far on the right, far right on the bottom,
-->
there's some icons there.
-->
This one that I put out...
-->
Others do that?
-->
I managed to maximize my screen.
-->
So do you want to see yours now?
-->
You'll probably have to switch between mine and yours.
-->
I'm just wondering.
-->
No, it's fine. I'll give it a try.
-->
Okay. Just let me know if there's something I can do.
-->
No problem.
-->
Alright. So we've got three terminals opened up.
-->
Can I request you to do the same on your desktop?
-->
Just open three terminals, please.
-->
Whichever way you like.
-->
Quick one. It's Control-Alt-T.
-->
Yes.
-->
Like it.
-->
Terminal.
-->
And then it's a menu.
-->
From the menu. Just search for it.
-->
Oh my God. Just search for terminal.
-->
I should be able to find it.
-->
Terminal. Is that the one?
-->
Yeah, yeah. That's the one.
-->
It's just a graphical environment.
-->
So probably question number one,
-->
before we do anything on this environment,
-->
just looking at the terminal,
-->
there is a little bit of a prompt.
-->
This prompt is very friendly.
-->
It tells you the current logged in username,
-->
at the host that you're on,
-->
and the current directory you are in.
-->
That's kind of nice.
-->
Just to know who you are
-->
and what kind of location you happen to be.
-->
What is the first thing that should stand out to you
-->
when you see that dollar sign?
-->
What does that typically indicate?
-->
And please don't mind.
-->
I will take you through some fundamentals.
-->
I know you're all comfortable with Linux,
-->
but there are certain things
-->
I just don't want to take a chance.
-->
So now go over the concepts,
-->
making sure that we're all on the same page.
-->
So what does that dollar indicate
-->
when you're working on the terminal?
-->
You can always take a guess.
-->
If you're not so sure, you can say you're not so sure.
-->
Oh yes, it's not for money, eh?
-->
It's not a prompt.
-->
Maybe just to show you,
-->
you are working as, I don't know,
-->
as a user name. I don't know. Just kidding.
-->
Okay. So that dollar indicates
-->
you are not the super user.
-->
You are a normal user into that system.
-->
But that's your privilege.
-->
We can very quickly try something
-->
on any of the terminals.
-->
Let's do a quick sudo bash.
-->
We'll talk about sudo a bit more in depth maybe later on,
-->
but just a quick sudo bash.
-->
Switch and start the shell as root.
-->
What changes into the prompt?
-->
Last character.
-->
So that's your hash.
-->
And what does that indicate?
-->
You have all the privileges.
-->
You are a super user.
-->
And we have another name for a terminal
-->
which has the super user.
-->
Do you know the name for a terminal
-->
which is running as super user?
-->
We call it as the CV updater.
-->
This is where one mistake
-->
can wipe your system clean,
-->
forcing you to look for a new job.
-->
What's the command?
-->
Sudo bash.
-->
Yeah, we used to actually kill
-->
Unix machines in 10 different ways.
-->
When we were doing clustering
-->
and we wanted to kill one node
-->
to show that the other node can sustain the cluster.
-->
And we used to come up with creative ways
-->
of killing a Unix machine.
-->
I'm definitely not doing that here.
-->
The bottom line is you work under root privileges
-->
when some system administration is absolutely necessary.
-->
You do that and then you exit back to save time.
-->
I would request you to do the same.
-->
Let's just exit back
-->
and be a normal user.
-->
But then just very quickly,
-->
first thing to know about the terminal
-->
which is what are my privileges.
-->
Are you still going to explain this sudo bash?
-->
Yeah, I will have a look at the sudo later on.
-->
Yeah, because the way we switch to root,
-->
the first time I see it is sudo bash.
-->
Just use sudo su like that.
-->
There are many ways to get things done
-->
in these kind of operating systems
-->
and they are set up in a certain way.
-->
In most enterprises,
-->
there might be some differences
-->
in the way they are set up.
-->
So question number one is
-->
what distribution are we working on?
-->
We have to check it.
-->
Right, and how do we check?
-->
By the way, if you are working on a terminal,
-->
you can zoom in a bit with the control and plus.
-->
I'm just going to do that.
-->
Just making your life a little bit easier.
-->
You can do the same from view.
-->
I'm sure it is asking chat.
-->
Of course, that's the answer to everything.
-->
There are a few things to consider.
-->
Anyway, the first thing we probably want to do
-->
is this command lsb underscore release minus a.
-->
Let's give that a quick try.
-->
Yeah, because I was about to say
-->
the command will depend on the twister that you are using.
-->
Yes, so since we are currently on Ubuntu,
-->
that's one way of doing this.
-->
And different distributions
-->
will also have multiple commands.
-->
And there are some core commands
-->
that you can always use
-->
across even Linux and Unix environments.
-->
Not just Linux distribution,
-->
but all the way to different kinds of Unix environments.
-->
How do we know
-->
what kernel we are running?
-->
I just said I used your name,
-->
and that's it.
-->
Now keep in mind many commands,
-->
especially commands like uname
-->
might provide a lot of output.
-->
You may not need all of it.
-->
You may have very specific things
-->
that you want to know.
-->
Oh, this is running on Intel platform.
-->
Obviously, you can look into the help
-->
to see the details.
-->
Let's try some simple commands.
-->
Let's see how long the system has been up and running.
-->
It's going uptime.
-->
So I've worked on systems
-->
where the uptime is in years.
-->
So,
-->
there was a funny command
-->
back in the day
-->
which uses a lot in
-->
I'm not sure if it was finger or fingers.
-->
Does it ring?
-->
It does not ring.
-->
It does not ring.
-->
Yeah, it's more of like
-->
on a remote system,
-->
it used
-->
the finger
-->
tool
-->
to get the answer.
-->
So,
-->
there's a couple of different ways to do that.
-->
Maybe
-->
the command who
-->
and who
-->
minus a
-->
might answer that question.
-->
What does w do?
-->
So, w
-->
Yes.
-->
No,
-->
Google did
-->
W.
-->
Look, when we are working on
-->
live environments, we stick to
-->
one thing that has worked, and that's good enough
-->
because it works everywhere.
-->
We're not going around
-->
experimenting with this.
-->
We don't have time to kind of do that
-->
all the time.
-->
So, if I don't want to see everything with
-->
uname, maybe I can just do
-->
uname minus r.
-->
So,
-->
we have commands
-->
and options and arguments. We're going to come
-->
to that, but this is just getting to know
-->
your system a little bit.
-->
By the way, running commands is not
-->
a difficult part. For many commands,
-->
understanding the output is.
-->
Classic example for that
-->
is running the command top.
-->
Kind of like
-->
the performance monitor
-->
and task manager
-->
combined in the
-->
next world.
-->
It has 10 million options.
-->
Well, if I just run top,
-->
it kind of gives
-->
me a summary
-->
overall percentage
-->
of CPU utilization,
-->
memory utilization,
-->
which
-->
processes at this point
-->
in time are eating up most
-->
of your resources,
-->
what
-->
processes are running in the system.
-->
Top, when you run it, obviously, keeps
-->
in this case your terminal
-->
running and it is
-->
showing you these statistics live.
-->
So,
-->
I'll come back to the terminal
-->
if you see my screen. I have just
-->
come out of top with the command
-->
Q to quit.
-->
Frankly, this is your
-->
new generation shell
-->
which allow
-->
customization of the prompt.
-->
And right now
-->
it is your user
-->
name at the date.
-->
Let's find out
-->
your hostname.
-->
See if that works.
-->
Is your prompt a combination of these
-->
two things?
-->
And this
-->
third thing.
-->
What's your hostname?
-->
Who you are currently as
-->
in this terminal?
-->
Which user?
-->
And what's the current location in the file
-->
system that you are at?
-->
It's a friendly prompt. I remember when
-->
we first saw this 10-15 years
-->
ago, we were like, wow, that's amazing.
-->
So,
-->
you want to enjoy a lot
-->
is a command like which and
-->
where is.
-->
Because it has a lot of system
-->
admin.
-->
Yes, of course.
-->
No, no, no.
-->
It's what which and
-->
where is.
-->
For instance, you look for Java,
-->
which Java C or
-->
which Java
-->
which you have to animate.
-->
It is installed.
-->
You need to put it in the file.
-->
It's useful if you're
-->
updating Java for instance.
-->
If you're updating any application.
-->
It's very critical to figure out
-->
the path of what we're at.
-->
That's a big part of
-->
system administration.
-->
Frankly, it's mostly about
-->
the most common errors
-->
in the Linux index world is doing the right
-->
thing but in the wrong place.
-->
Yes, yes.
-->
I have been told sometimes that
-->
the applications are telling us
-->
to turn off the system.
-->
Don't give it all away.
-->
Again, just getting to know the system
-->
a little bit. How long the system has been
-->
up and running. What's my distribution?
-->
What's my kernel?
-->
Who am I currently logged in as?
-->
Who else is
-->
on the system?
-->
What's my host name?
-->
Maybe we can add to that fundamental
-->
like what's my IP address.
-->
Quickly try that.
-->
Sorry.
-->
You can see IP itself
-->
as a command can be used
-->
to configure a lot of layer
-->
2, layer 3 and in this case
-->
A is short for address.
-->
So it's printing out
-->
your network configuration. So you can see
-->
I have a loopback configuration.
-->
You have the V4 loopback.
-->
All network guys.
-->
This is your V6 loopback.
-->
Here is my internet.
-->
This is a VM at the end of the day.
-->
But I can see my
-->
physical addresses.
-->
I can see my V4.
-->
Are we in the same segment?
-->
Yes, I only just
-->
know there is it
-->
ifconfig.
-->
Yeah, so classic
-->
ifconfig.
-->
You might have to add. Again, depending on
-->
the distribution. This is where the
-->
difference in the distribution comes into picture.
-->
So I come from
-->
the historic Unix
-->
background. I always
-->
natively start writing
-->
ifconfig and the Linux machine
-->
says what's that? So changes in
-->
distributions can make a difference there as well.
-->
So,
-->
also the user sometimes
-->
I'm not mistaken
-->
if you are not a super user
-->
there are other commands that you can find.
-->
Yes, of course.
-->
Very true.
-->
Just give me a second.
-->
Now I understand
-->
why you've got pajamas in your corner.
-->
What?
-->
Lightning.
-->
I'm comfortable with
-->
my stage here.
-->
Expensive coffee.
-->
Coffee.
-->
Coffee.
-->
Coffee.
-->
I'm not coffee.
-->
You are not coffee.
-->
I'm not coffee.
-->
Hey, Ivan.
-->
Yes, guys.
-->
How are you?
-->
I'm fine.
-->
The tour is breaking too.
-->
Now you're out of touch.
-->
So guys, how do you zoom in your terminal
-->
for the signal?
-->
Yeah.
-->
How do you zoom in
-->
the terminal?
-->
I remember you
-->
showing us
-->
the other thing.
-->
What is you?
-->
Can you ask God?
-->
No, he did it very simple, guys.
-->
Okay, I'm going to zoom in.
-->
Control plus control.
-->
No, yeah.
-->
Alright.
-->
Control plus and minus.
-->
I thought you were talking about parts there.
-->
No, that was cleaning.
-->
No, no, no.
-->
So you don't have
-->
a double clip?
-->
I'm sorry.
-->
I don't know how to do some work.
-->
Alright.
-->
So, very quickly,
-->
some
-->
fundamentals.
-->
Let's have a quick look at those as well.
-->
So, yes,
-->
we looked at
-->
different distributions.
-->
There are many
-->
different applications that you guys
-->
are already familiar with.
-->
And, of course, these tools depend on
-->
the platform as well.
-->
There are all kinds of different shells.
-->
There are many different
-->
graphical environments that you can
-->
work on. There are plenty
-->
of different system tools.
-->
And some of these
-->
are
-->
basically
-->
for super user, basically
-->
system administration tools.
-->
And many of these are common
-->
tools that anybody can work on
-->
the system. I want to focus on
-->
this first.
-->
Basic principles of Linux.
-->
And the first one is very important.
-->
When you come from
-->
Windows, what is a file?
-->
If you come from
-->
the Windows operating system and
-->
somebody talks about a file, what do we
-->
think about?
-->
No, I hate Windows.
-->
What's the question?
-->
Oh,
-->
what do you mean?
-->
I can still ask the question
-->
in a different way. What is a file?
-->
A file can be text file.
-->
It can be Excel file.
-->
Word file.
-->
And most of the time, sometimes
-->
coming from Windows
-->
to Linux, there will be
-->
I don't know if it's
-->
a coding or
-->
what it is, but
-->
sometimes you
-->
kind of open the other
-->
somebody. But I don't
-->
text file from Windows
-->
because there are other files that you can't open.
-->
I'll take that one.
-->
Now the very basic
-->
fundamental question is still there.
-->
Which is, what
-->
is a file?
-->
Well, the answer
-->
is the right thing from Toria.
-->
Everything is a file.
-->
Yeah.
-->
Like storage of
-->
the
-->
data.
-->
Because now
-->
you can stretch it to say
-->
it doesn't have to be text, you know.
-->
No, so
-->
I think that as Vintu
-->
said, a file is everything and everything
-->
is a file.
-->
Because now I think what is the best
-->
type of file?
-->
And the answer to that question is
-->
in the Linux Unix world, when you
-->
describe a file,
-->
don't think about storage
-->
and don't think about a
-->
file is a pointer
-->
to a resource.
-->
It's a very broad
-->
definition. It's not just about
-->
data, it's not just about
-->
storage, it's not about your volume
-->
and it's not just about your file system.
-->
Here is an example.
-->
So we have
-->
we can
-->
try this right away. Just bring
-->
two terminals side
-->
by side. And
-->
as I'm demonstrating this, we will
-->
try to answer a question
-->
which is what are
-->
the different types of files
-->
in Linux?
-->
And the answer is not
-->
text files and PDFs
-->
and PowerPoint. So let's try and answer that fundamental
-->
question. The first thing we're going to do is
-->
we are on a terminal here
-->
Remember the command we wrote
-->
earlier, who
-->
is in the system?
-->
Right now it shows me
-->
on a terminal.
-->
If I do
-->
who minus a who is
-->
basically everybody.
-->
I can see there is
-->
student and student
-->
is on many
-->
terminals.
-->
1, 3,
-->
4.
-->
So if I write the command TTY,
-->
what is this
-->
terminal that I am in?
-->
It gives you a path
-->
slash dev
-->
slash bts slash
-->
true. Well that
-->
is a file.
-->
It's a location.
-->
But it's not data stored on
-->
the system. This terminal is
-->
represented by a file.
-->
Let me go
-->
to the other
-->
terminal. Do TTY
-->
and it says
-->
slash dev slash
-->
bts one. So that terminal
-->
is represented by this.
-->
Let's try a very simple command.
-->
echo hello
-->
If I do that, what's going to happen?
-->
Then I press it.
-->
And it's going to say hello
-->
on the same
-->
terminal. Correct? What happens
-->
when I do
-->
that?
-->
What am I saying?
-->
I'm literally saying
-->
put hello, send
-->
it into that file.
-->
Before I do
-->
that, I can just
-->
say like this.
-->
I want to create a hello file.
-->
What is that going to do?
-->
In this current
-->
directory,
-->
it's going to create
-->
a hello file.
-->
And I can read
-->
that file.
-->
So all I've done here with any direction
-->
is take this
-->
text and put it into a new
-->
file.
-->
What does the dash in front
-->
of this output indicate?
-->
That first dash means
-->
it is just an
-->
ordinary file. It's a file that
-->
contains data. What I'm going to do right
-->
now, I'm going to send
-->
hello
-->
there.
-->
Can you please try the same?
-->
From one terminal, send hello to another
-->
terminal.
-->
Find out the identity
-->
of that terminal
-->
with the command ppy
-->
and send it from one to the other.
-->
Terminal send
-->
by send.
-->
Everything I do, I would recommend
-->
obviously that you try it out as well.
-->
So what
-->
of your
-->
your last
-->
thing for the
-->
going hello into
-->
dts2.
-->
How come when I do that
-->
I get a hello
-->
back?
-->
Well, which terminal are you sending
-->
into? Please first write
-->
ppy on both the terminals.
-->
Check that I did.
-->
Hello.
-->
Where are you sending it to?
-->
We have two terminals opened up
-->
side by side.
-->
Just look at my
-->
screen if you can.
-->
That's fine. At least
-->
two.
-->
Is everyone okay with this?
-->
Everything is
-->
a file.
-->
So with that in mind, coming back
-->
to my screen share.
-->
Let's have a look.
-->
ls minus
-->
l
-->
del pts
-->
What is the
-->
first character in the output of
-->
ls minus l?
-->
Compare it
-->
to
-->
the ls minus
-->
l I did for a file I created
-->
which contains some text
-->
that was started
-->
with a dash.
-->
This one says c.
-->
Any idea?
-->
This is
-->
what we will call as a device
-->
file. Device files can start
-->
with a c, start with a b depending
-->
on the read character
-->
by character or these are blocks.
-->
So it's a special file.
-->
This file represents
-->
a device.
-->
A device is not a hardware.
-->
A device is
-->
something that needs drivers.
-->
In Linux, your terminology is completely different.
-->
Third,
-->
let's have a look at
-->
the root file system.
-->
So
-->
we're going to do ls
-->
minus l
-->
and let's put a forward slash
-->
to say we want to look at the root
-->
file system. I want to see
-->
the top of the tree or the bottom
-->
however you want to say it.
-->
Notice something here.
-->
Bin
-->
points to
-->
usr slash bin
-->
and look at the first
-->
character.
-->
That is
-->
l which
-->
means
-->
what type of file is this?
-->
That's l.
-->
l here would mean
-->
this is a link like a shortcut.
-->
This is the third type
-->
of file. I repeat
-->
there are ordinary files
-->
that begin with a dash.
-->
There are device
-->
files that begin with a c
-->
or a b.
-->
There are links like
-->
shortcuts. They begin with
-->
an l and what does the d
-->
indicate here?
-->
Directly.
-->
So a directory is
-->
also a file.
-->
So l
-->
is a link.
-->
I've never seen l.
-->
Is it a matter of
-->
connection?
-->
Just symbolic?
-->
Yes, a symbolic link.
-->
Is it a matter of
-->
do you need
-->
certain permissions to say it or
-->
is it just normal like t?
-->
Nothing special for you to see it.
-->
Majority of the links
-->
in the system are just to maintain
-->
backward compatibility.
-->
So scripts
-->
that were written 20-30 years ago
-->
sorry lucky scripts
-->
that were written 20-30 years ago
-->
they pointed to slash bin.
-->
Will continue to
-->
work even if the binaries
-->
have now moved to a different location
-->
in the new Linux Unix systems.
-->
But a script that still says
-->
slash bin will continue
-->
to work 30-40 years
-->
later. So majority
-->
of the links are system
-->
built. You will see later on
-->
how to make them and how to use them.
-->
Lucky, go ahead.
-->
No, I was just saying it's like
-->
a short cut. Yes, it is.
-->
It is and it isn't. We'll look at
-->
symbolic links and see how it is slightly
-->
different. We have soft links, hard
-->
links.
-->
Okay.
-->
So a very
-->
fundamental question
-->
we would like to answer
-->
which I hope that we have
-->
is this.
-->
These commands are exposing me.
-->
I thought I know Linux.
-->
Do you know Linux?
-->
Yes.
-->
Linux
-->
full commands.
-->
Very difficult.
-->
As I said, it's not so difficult
-->
to get started, but to truly
-->
understand what you're looking at. And
-->
then in Linux, there are three
-->
levels. You have users,
-->
you have administrators
-->
and you have engineers.
-->
So engineers
-->
are above administrators
-->
in the sense that they understand
-->
under the hood, behind
-->
the scene, how the system functions.
-->
And administrators can do the admin
-->
work and set up a platform and
-->
set up the user and services and all that.
-->
So there is a third and the fourth
-->
level in this
-->
which I totally
-->
understand.
-->
I don't do a lot of that these days,
-->
but we used to spend a lot of time
-->
with high-end
-->
systems.
-->
I spent 20 years
-->
on Solaris as an OS.
-->
And we used to do
-->
kernel tweaking and tuning and we'll
-->
have people coming in 10 years of experience
-->
with a lot of
-->
confidence saying, I know Unix.
-->
And then after five days they said, I
-->
don't know Unix.
-->
I thought I knew I don't.
-->
And that thing is true for everything.
-->
There is a next level for everything.
-->
That's just how it goes.
-->
And these systems can be complicated.
-->
A quick look at what I'm sharing on the
-->
slide.
-->
There are four
-->
types of files.
-->
Files that contain data.
-->
Remember they have a dash
-->
in front of them when you do ls-l.
-->
We have
-->
directories. Directories are also
-->
considered as files.
-->
We have devices.
-->
This slide is incorrect.
-->
Devices are not for accessing the hardware.
-->
Devices for accessing anything that
-->
needs a driver.
-->
Including hardware.
-->
And we have links.
-->
We're going to see more of the links
-->
later on. But on the
-->
OS we can
-->
understand the different file types
-->
by looking at the
-->
output of ls-l.
-->
ls-l
-->
slash
-->
ETC password.
-->
This is what kind of file.
-->
So when it doesn't have
-->
a normal
-->
file, it's a data file.
-->
So remember this could be
-->
an image.
-->
This could be a PDF.
-->
This could be a document.
-->
Please understand that in Linux there is
-->
nothing called as extensions
-->
for the files.
-->
We
-->
put the dots
-->
and the three characters at the end.
-->
A, because it makes us feel
-->
better.
-->
B, because certain
-->
applications
-->
will make some assumptions.
-->
But technically in the
-->
Linux unit there is nothing called as
-->
extensions. So when you look at a
-->
file
-->
with a dash in front of it.
-->
With nothing
-->
at the end as a dot text
-->
or whatever.
-->
How do I know what is in it?
-->
Is it an image? Is it a PDF?
-->
Is it an executable
-->
file? Is it a binary?
-->
Is it a script?
-->
How do I know?
-->
That just tells you
-->
it's a file. But what type
-->
of file? Is it PDF?
-->
Is it a document?
-->
We
-->
use this.
-->
Okay.
-->
Oh, okay.
-->
Take note.
-->
Take note.
-->
It's recording.
-->
It's recording.
-->
It's recording.
-->
It's recording.
-->
Can I please
-->
request you to try exactly what
-->
you see on my screen?
-->
It's a lot of info.
-->
It's a binary. So what kind of binary
-->
it is?
-->
Okay. So is it
-->
more like...
-->
You always expect an extension.
-->
You don't have an extension.
-->
So here it's more like
-->
basically a file
-->
is almost
-->
is it
-->
an object that contains information
-->
about the resource, like name, size
-->
and link, the file type
-->
and all that.
-->
The logic is very simple.
-->
By changing an extension, you're not changing
-->
anything.
-->
Almost in...
-->
Because
-->
there is nothing called an extension
-->
in the file system.
-->
It's just a file name.
-->
Okay.
-->
So how do we see the metadata
-->
of the file?
-->
More like when was it created?
-->
typically will print everything about that.
-->
As you can already see with LS
-->
minus L.
-->
Permissions,
-->
UID, GID, sizes,
-->
date, time. So typically
-->
LS command will do all kinds of things for you.
-->
So this
-->
is why
-->
Unix does not suffer a lot from
-->
ISA.
-->
Not really.
-->
That's not the reason for it.
-->
It's the kernel architecture itself
-->
which is
-->
slightly different.
-->
Anyways, I don't want to get into this.
-->
But
-->
each OS has its own vulnerabilities.
-->
So
-->
architectures make a big difference as well.
-->
So I would again
-->
request all of you to please try this out.
-->
I can
-->
guarantee you Linux is very
-->
easy to watch, very difficult
-->
to do.
-->
Sometimes when you see something, it looks
-->
very straightforward. When we try
-->
things may not always work out.
-->
So I hope we have at least answered
-->
some core fundamental
-->
questions. What's a file?
-->
What are the different types of files?
-->
How do I know what type of file
-->
I am working on?
-->
Or I
-->
should be working on as well.
-->
We'll get into the
-->
commands a little bit
-->
as we go through this.
-->
But this is also
-->
where
-->
we would like to
-->
just get comfortable with
-->
the file system.
-->
And that's another bit.
-->
Which is
-->
depending on the
-->
Linux distribution
-->
that you're working on, some things might be
-->
different. But generally speaking,
-->
if I would
-->
compare it to Windows, you have
-->
the Windows folder and you have the
-->
programs file folder. There are certain locations
-->
where we expect
-->
certain configurations
-->
to be.
-->
In the Linux Unix world,
-->
half the battle is trying to figure out
-->
or remembering
-->
what is in which folder.
-->
These don't matter
-->
too much for an end user
-->
working on the command line.
-->
But they probably do better
-->
if you're a sys admin.
-->
Then you need to familiarize yourself
-->
with many different locations.
-->
The starting point,
-->
the top of the tree,
-->
is what we call as the root.
-->
And under that, there are
-->
plenty of different folders,
-->
each containing
-->
some specific type
-->
of files or configurations
-->
to be found. So for instance,
-->
under the root, the
-->
ETC folder contains
-->
a whole lot of
-->
hundreds of files where
-->
all kinds of configuration
-->
exist. For instance,
-->
let's say
-->
again as network
-->
engineers, I would like
-->
to
-->
check this out.
-->
Cat to read
-->
a file and I want to read the host
-->
file.
-->
And all this is
-->
well, it's the host file. In Windows
-->
you find it and see Windows
-->
System32 drivers
-->
ETC
-->
Guess where the ETC
-->
folder on Windows came from.
-->
So a lot of
-->
the Windows hierarchy
-->
as well that you see
-->
also comes from
-->
Linux
-->
and Unix more or less.
-->
So the host file for instance
-->
in Windows is in
-->
System32 drivers ETC
-->
folder.
-->
Same place I see the host file here
-->
as well.
-->
So different
-->
locations
-->
matter in the file system.
-->
For instance,
-->
if we have a look at the root of the
-->
file system very quickly,
-->
I see boot,
-->
MNT,
-->
proc,
-->
run, there is a temp
-->
space, there is bin,
-->
sbin,
-->
opt where software packages
-->
are found, home which is the
-->
location of the
-->
user home
-->
directory which is currently
-->
as the student.
-->
So my home directory is
-->
center slash home student
-->
desktop
-->
as you get more into system administration
-->
then you spend more and more time
-->
on or in this particular
-->
folder what exists
-->
in that particular folder and you become
-->
familiar frankly with a bit of time.
-->
There could be
-->
small differences
-->
between different
-->
I would say
-->
distributions at time but on
-->
a high level it's kind of something like
-->
sorry GP there is another question
-->
I think I should have asked you when
-->
we were doing the echo
-->
hello
-->
but if for example
-->
I am an
-->
admin and I want
-->
to see your
-->
into which
-->
terminal is using
-->
why do that and then
-->
I can send that
-->
message if I just want to
-->
say hey if you stop watching this
-->
so
-->
first of all who minus
-->
A will answer that question for you
-->
who minus A will
-->
also lucky show you remote
-->
users who have
-->
telneted or SSH into the
-->
system.
-->
You will see everybody local as well as
-->
remote logged in users.
-->
Even as a normal user
-->
or as root only
-->
or as super user.
-->
No we can do both. Who typically imprints
-->
out all information?
-->
It should be.
-->
Some binaries
-->
are limited if they are not
-->
running under super user
-->
account.
-->
Some binaries are for everybody
-->
to use and
-->
lucky what happens is in many
-->
organizations they
-->
want to strictly limit the
-->
privileges of even a normal user
-->
account.
-->
For example why does a normal user
-->
account need to see all the running
-->
system process.
-->
That's a classic example.
-->
So what we normally do is we then harden
-->
these systems and there are different mechanisms
-->
by which we do system hardening.
-->
Creating restricted
-->
shell and so on and so forth.
-->
Limiting what commands you
-->
can execute. So then
-->
like I think what I'm trying to say
-->
is so that an operator
-->
who has specific
-->
tasks doesn't do anything
-->
beyond those very specific
-->
tasks. But it takes some work to do that
-->
kind of hardening. So in many cases
-->
an end user might
-->
be able to do a lot more than
-->
maybe we really wanted them to do.
-->
Hopefully that kind of answers the question.
-->
Yes, yes, yes.
-->
Alright any other question
-->
from anyone else at this point in time?
-->
We have it all good.
-->
How about the others? I know when we started
-->
everyone said you guys are intermediate
-->
on Linux. So I hope this is not super
-->
basic. But as I mentioned
-->
I just don't want to take a chance.
-->
Yes, no,
-->
don't take a chance. Now we can see
-->
where
-->
at least I didn't say I'm in TBL.
-->
What is that word that I really used?
-->
Comfortable.
-->
Comfortable.
-->
Super comfortable.
-->
Intermediate.
-->
So hopefully we are making you
-->
uncomfortable with your comfort
-->
level.
-->
Yes.
-->
So that's the reason
-->
I'm just going through some basics
-->
that I think
-->
I don't want to take any
-->
chances here as well. We'll work on
-->
the file system in a little
-->
bit. Maybe good time for a short
-->
break. 15-odd minutes
-->
and then we resume.
-->
Yes.
-->
We'll come back at 10.30.
-->
All right.
-->
The guy who
-->
tells me to break for our group.
-->
any question about taking
-->
a break, going to lunch,
-->
I'm going to answer that one.
-->
Anything about recording
-->
and something
-->
that we need to take, not like
-->
it will
-->
normally end there.
-->
All right.
-->
Good to have a point person. We like
-->
outsourcing anyways and having a conference.
-->
All right. See you guys in
-->
15-odd minutes.
-->
Enjoy your lunch.
-->
Thanks.
-->
Thank you.
-->
.
-->
.
-->
.
-->
.
-->
.
-->
.
-->
.
-->
.
-->
.
-->
.
-->
.
-->
I'm going to ask where in the world you are.
-->
Apologies if I haven't mentioned, I'm based in Dubai, just like Kubey, so we are
-->
colleagues. I've known him maybe 10 years now. I'm from India, I've been in the
-->
I haven't. I mean, you know, Manla is there and every time there is a client
-->
engagement that physically requires me to be there, the clients change their
-->
mind at the last moment. You are too expensive, let's do this online.
-->
It's definitely on my mind. There are some parts of the world I don't really
-->
go out of the way on my own, since I know that as part of some engagement I'll end up there
-->
someday. So I think SA is one of those places where I know I want to be there
-->
but I know I'll end up there one way or the other. I had a couple of my family
-->
friends with recently and they went to some beautiful and gorgeous places and it was just
-->
very tempting when I saw that I said I need to go there. Beautiful coastal locations, they look really nice.
-->
Everyone here is in Cape Town, Joburg, where are you guys at?
-->
We are in Joburg, half of it is in Joburg and some of it is in Pretoria.
-->
I work with people all over the place.
-->
Lesotho as well, physically I've been in Africa, I've been to Egypt, Ethiopia, Kenya, Tanzania, Zanzibar, but that's about it.
-->
I just need to go down a little bit more. It's almost in that order that I have traveled.
-->
How about the others, are you back? Winnie, you've been very quiet in the first half.
-->
Yes, I'm back. I'm the quietest in the entire group.
-->
You've been outed, Winnie.
-->
Saki, how about you, are you with us?
-->
Yes, I'm here. I'm just listening to Ivan. He likes Cape Town. I don't know why he didn't tell you he likes Cape Town.
-->
He's bad, he's bad.
-->
I'm calling him back, I'm sure now it's not long I'll have him picture myself.
-->
I think we're all in.
-->
He is bad.
-->
Good to have you back with me. Let's soldier on.
-->
So that was frankly the first half, just getting to know some fundamentals of the Linux.
-->
What we want to do next is just get a bit more comfortable with the file system in terms of the structure.
-->
How do you move around, some tips and tricks on this.
-->
As I said, partly the challenge is doing the right thing, but just in the wrong place.
-->
So we're going to focus a little bit on just moving around the file system.
-->
We spent a bit of time just knowing that there are different types of files.
-->
That was the starting point for us.
-->
Ordinary files and links and directories and so on and so forth.
-->
The first thing probably on any table, as I mentioned, is just figuring out where you are at.
-->
And that would be a quick PWD, print my working directory.
-->
And that will just very quickly tell you where currently in the file system you are.
-->
As I did mention, we have the root and everything under the system.
-->
All the resources are available under the root.
-->
So we can just do this CD forward slash.
-->
And that means I'm on the top of the tree or at the bottom, however you want to look at it.
-->
But all system resources are available under the root in terms of the file system.
-->
And here we can again validate that with a quick print working directory.
-->
Yep, I am absolutely at the root of the file system and all the resources are under that.
-->
What happens if I just write CD and press enter into the directory to what?
-->
Would it accept that?
-->
Does it not go to root?
-->
No, it takes you to your home directory.
-->
Quick shortcut to go to your home directory is that.
-->
Just write CD and press enter.
-->
Can you see what character represents your home directory?
-->
That's the tilde.
-->
Tilde represents your home directory.
-->
It's what tilde?
-->
Yeah, tilde.
-->
Yeah, Linux makes you reacquaint yourself with the keyboard a little bit.
-->
So tilde simply represents your home directory.
-->
So what is my home directory?
-->
Right now it is slash student slash, sorry, slash home slash student, correct?
-->
Let me change my current directory now.
-->
Now I am in the root of the system.
-->
Let's say I want to create a file in my home directory.
-->
Do I have to go into the directory first?
-->
Not necessary, I can just mention the path.
-->
Yes, but before you can go there, I see up there the first three lines.
-->
You see there's that tilde and then slash desktop.
-->
What is happening here?
-->
Under my home directory, there are many folders.
-->
Oh, OK.
-->
One of them is the desktop.
-->
Desktop, OK.
-->
How did I start this particular terminal?
-->
Most likely by right-clicking the desktop and saying open in terminal.
-->
So then it opens a terminal and the current location in the terminal is the desktop.
-->
So the desktop is just a folder under my home directory.
-->
I have documents downloaded because it's a normal user account and all kinds of other things.
-->
Are we OK with this?
-->
Tilde represents your home directory.
-->
As a shortcut, it can be used for the same.
-->
Now, when you're working on the file system, we mentioned that there are two ways to move around.
-->
There is something called as the absolute path and there is something called as the relative path.
-->
Let's just look at that with a quick diagram.
-->
I'll just share a quick whiteboard to represent that idea.
-->
Give me a second.
-->
And then we will use that to move around the file system a little bit.
-->
So in terms of how do we move around and how do we mention the path?
-->
Let's say we've got the root and then under the root, I have the folder home.
-->
Under home, I have the folder student.
-->
The root, I also have the folder who are here.
-->
So the first thing is, what's your current directory?
-->
So let's say my current directory.
-->
Happens to be slash home.
-->
Absolute path means.
-->
Anytime I mentioned the path and I begin with the forward slash, the moment you start a path with slash,
-->
you are referring to the top or the root of the file system.
-->
And then you have to give the path according to that.
-->
If you're not starting with this, then you're starting from the current.
-->
What do I mean by that?
-->
If I'm in the home directory and I want to go into the student folder, there are many ways I can do this.
-->
One is I can just say CD student.
-->
It assumes that student folder is relative to my current location.
-->
It will work.
-->
What happens if I say CD slash?
-->
The moment I say slash, it doesn't care where I am anymore.
-->
I need to provide the complete path in the file system.
-->
Slash home slash student.
-->
So you can use relative or absolute path in many cases like scripts and all.
-->
We want to give the exact path where something is.
-->
Sometimes relative is just faster.
-->
I don't want to start from the root every single time.
-->
All right, let's give some of these things just a quick try.
-->
I'm going to just share my screen and do exactly that.
-->
First, I'm going to go into the home folder.
-->
You can not find this out as well after you have a quick look.
-->
I'm in slash home.
-->
Will this work?
-->
No, because you started with a slash and you are already at home.
-->
There is no such folder under the root.
-->
If I start from the slash, then I must say slash home slash student in the full path.
-->
Don't forget the shell is a little bit friendly, so you can use tab to autocomplete.
-->
Tab is your friend.
-->
It helps us eliminate typical typing errors that we can have.
-->
More productive and less errors.
-->
The less we type, the better it is.
-->
Now from slash home, how do I go to slash what?
-->
What's the question from slash home?
-->
How do I go to slash bar, which is another folder under the root?
-->
You have to say these.
-->
So if I start with slash means I'm giving absolute path.
-->
How do I do this relatively?
-->
So what will this do?
-->
Level up.
-->
So what is that?
-->
That is the root, isn't it?
-->
Under over home.
-->
Then I can say slash what?
-->
I climbed up and then climbed down.
-->
Now I have a question for you.
-->
Please watch my terminal carefully and look at my current folder.
-->
Carefully.
-->
I am under home.
-->
Under home, I am in student folder.
-->
From here, how do I go what?
-->
Relatively.
-->
I know absolute path is simple.
-->
CD slash what?
-->
Please give it a try.
-->
Then if you are here, because I see you are on the slash bar,
-->
if you want to go to that path that you are coming from,
-->
that is the path that we are looking for.
-->
CD dash.
-->
Oh, I thought this thing,
-->
why do you call it that thing?
-->
That will represent your home.
-->
Oh, till death.
-->
Till death.
-->
I thought it was till death.
-->
No, CD dash is simply a way to quickly jump between two locations.
-->
Current location, last location.
-->
Glad we have answered that.
-->
Yes, thank you very much.
-->
So.
-->
I will help you baby.
-->
So CD dash is just a quick way of jumping between two locations.
-->
You can obviously use dollar, sorry, tilde,
-->
if you want to specifically refer your home directory.
-->
It might be faster, of course.
-->
What's that going to do?
-->
It's going to create a file on the home directory.
-->
So that's just much faster.
-->
Oh, till death.
-->
Vinny, I don't see you trying things out.
-->
OK, I can see you're doing things in the terminal.
-->
Brilliant.
-->
Akun, are you trying things out?
-->
Hi, sorry, sorry, sorry, I got stuck there a little bit.
-->
I'm doing that now at 12 o'clock.
-->
All right, when you come back, I can see Lucky is doing the same.
-->
OK, so creating a file.
-->
So creating a file called your file.
-->
Yeah, just and in terms of what's happening, look at my terminal.
-->
Start from the top.
-->
We are just trying to navigate the file system.
-->
Using absolute path and relative path.
-->
Absolute path.
-->
We are starting with the slash and relative path is from where we are at.
-->
We are using something like dot dot to go up or tilde to refer to our home directory.
-->
It's moving around the file system.
-->
No, no, no, that's fine.
-->
That's fine.
-->
I appreciate that.
-->
And just writing cd with nothing takes you to your home directory.
-->
Yes, yes, that's right.
-->
And cd space dash.
-->
Helps you hop back into the directory you came from.
-->
Previous location.
-->
So cd dash will help you hop between two folders, one and the other.
-->
Back and forth.
-->
That's OK.
-->
That's OK.
-->
You can just touch dash that tilde new file.
-->
This is just to show you that tilde refers to your home directory.
-->
OK.
-->
OK.
-->
OK.
-->
Can I request everyone come back to their home directory please?
-->
So dot dot was the parent directory.
-->
Now let's look at this command.
-->
Just for instance.
-->
I want to copy this file.
-->
Copy is a command.
-->
And it needs some argument.
-->
Have argument.
-->
How many arguments are needed for the copy command to work?
-->
I'll say two.
-->
Because we need to copy to the destination.
-->
So we need a source and a destination, isn't it?
-->
So if I just write copy slash etc hosts, it's not assuming the destination.
-->
It's not enough.
-->
Where?
-->
Where is it going to go?
-->
How do I say here?
-->
Copy the file where I am right now.
-->
Dot.
-->
Hopefully that makes sense.
-->
Dot means here.
-->
Dot dot means in the parent location.
-->
Bring me the file where I am at right now.
-->
OK.
-->
So there's no default.
-->
For instance.
-->
The parent doesn't provide the default.
-->
If you leave it blank.
-->
There's no assumption.
-->
It doesn't default to anything.
-->
I thought it was going to default to the current.
-->
Yeah.
-->
So if you can also use the tilde.
-->
Yes, of course.
-->
But maybe it's just not in the home directory.
-->
I am somewhere else.
-->
Dot simply means in my current directory.
-->
Dot does not mean my home directory.
-->
OK.
-->
I get you.
-->
So dot is here.
-->
Yes.
-->
Wherever that here happens to be.
-->
Are we a little bit more comfortable with the file system?
-->
Dot dot dot slash.
-->
We are starting from the root of the file system.
-->
Yeah.
-->
Yes.
-->
Yes.
-->
I'm becoming comfortable.
-->
I think while we're here.
-->
I'm not sure if we're still getting to it.
-->
One thing that took me.
-->
When using the CPU command and the tilde.
-->
Was copying from one server to another.
-->
Ah.
-->
Then you need SCP.
-->
Which is very useful.
-->
So.
-->
Yes.
-->
So secure copy between hosts.
-->
Secure copy between hosts.
-->
The colon and tilde at the end.
-->
Then you continue with the actual path if you want.
-->
Yes.
-->
Or just use the tilde for the home directory.
-->
For the home directory.
-->
Yeah.
-->
So hopefully this adds a bit more clarity to it.
-->
Yes.
-->
Alright.
-->
So that's again.
-->
The basics of the file system.
-->
Other things to note.
-->
About the file system.
-->
Is.
-->
If you want to just see.
-->
What are the different.
-->
I don't want to say partitions.
-->
But what are the different file systems.
-->
We can do this command.
-->
DF minus H.
-->
H is for human readable.
-->
Very kind of them.
-->
Because.
-->
Otherwise.
-->
Good luck with the calculations.
-->
On how many.
-->
Blocks.
-->
So someone somewhere said well actually.
-->
Humans need to understand it.
-->
So we have DF minus H.
-->
And it's kind of.
-->
Tells me a little bit about.
-->
My partitions on my mouth.
-->
On the file system.
-->
How much space is there.
-->
How much is used.
-->
That's kind of a little bit handy.
-->
What is a little bit tricky sometimes.
-->
Is.
-->
Understanding.
-->
The folder size.
-->
Let me explain.
-->
If I do.
-->
LS minus L.
-->
To start listing.
-->
The file system.
-->
First up I am in my home directory.
-->
If I do LS minus L.
-->
You can see like.
-->
I see some folders.
-->
I see some files.
-->
If I do.
-->
LS minus L.
-->
Now.
-->
You know that.
-->
Let's start with home directory.
-->
You know that under slash home.
-->
We have home directories.
-->
Of many other users.
-->
So we start from here.
-->
I do LS minus L home.
-->
And it tells me that there is.
-->
Now the question is.
-->
What is the size of this folder.
-->
Right now what does it say.
-->
But.
-->
Let me do one thing.
-->
Let me go.
-->
This is just a demonstration.
-->
You don't have to do this.
-->
I am in my home directory.
-->
And if I just look at.
-->
Some of the files that I have.
-->
That should be more than four.
-->
These are all directories.
-->
Directories just show 4K.
-->
So.
-->
So what might be difficult.
-->
At first it's just to figure out.
-->
Well actually what's the.
-->
The size of the folder.
-->
There is a tool.
-->
Called as DU.
-->
And typically most commands.
-->
If not all support the.
-->
Argument dash dash help.
-->
To give you some help.
-->
Sometimes.
-->
The help is so big that we simply.
-->
Google these things but.
-->
I have this DU.
-->
Summarizes the use.
-->
Of the set of files.
-->
And we have this one minus.
-->
H print.
-->
And I have summarized minus.
-->
S give me a total.
-->
So what I'm going to try now.
-->
Is DU.
-->
Minus SH.
-->
Slash home.
-->
That is better.
-->
Slash home.
-->
Slash student.
-->
That's nice.
-->
What about the.
-->
ETC folder which contains.
-->
Configuration files.
-->
Ignore any permissions denied.
-->
Because we are a normal user.
-->
So some files we can't.
-->
Get to.
-->
That's around 18 MB.
-->
So this is a.
-->
Quick command.
-->
To understand the folders.
-->
Because this doesn't show up in.
-->
LS minus L for a folder.
-->
In Unix we used to have.
-->
MK file.
-->
I wonder if it's here.
-->
Yeah it's not here.
-->
Can I do.
-->
This is just for me.
-->
To try things out.
-->
Or we do.
-->
Equals to.
-->
Big file.
-->
At the current location.
-->
Block size five.
-->
Count.
-->
50.
-->
Nice.
-->
By the way.
-->
I've just created a file.
-->
Of a certain size.
-->
This is for the.
-->
Advanced.
-->
People.
-->
DD is literally.
-->
Copy.
-->
Guess what that device does.
-->
What do you think that device does.
-->
They have zero.
-->
Gives you no price for guessing.
-->
And gives you zeros.
-->
I'm actually reading.
-->
From a device that gives zeros.
-->
I'm putting them in.
-->
Output file.
-->
In the block size.
-->
Of 500.
-->
And I'm repeating that 50 times.
-->
Please be careful with this command.
-->
I have now created a 26 KB file.
-->
What if I repeat the same thing.
-->
Make it 500.