Welcome to section 4 in this section. You will learn about
Linux Administration using your newly created ec2 instance. We
will discuss topics such as files and directories users and
groups service and package management and running
containers.
In this video you jump back into the terminal and explore
the Linux file system.
Our plan is explore the Linux file system hierarchy standard
or FHS. So please make sure you're
still SSH into your host. If not, please just
so now.
We will learn about some commands that will help you to verse the
Linux file system.
Next you will spelunk your way through the file system
starting with a top level and work your way down to the
most common ones. You should know. Okay, let's get started.
Okay. So here we are back in the terminal and we're
gonna discuss. Like I said in the intro that we're going
to discuss the file system hierarchy and these
are basically all the directories and files that make up your Linux
operating system.
So there are quite a bit to go over. So I've
simplified this a little bit by choosing nine
that we could talk to one being
the top level and then eight subdirectories that
that I think will be enough foundational for you to be up and
running.
If you wanted to learn more though, however, there's a
great way you could do that actually rate here on your computer. Radon your
ec2 instance or on any Linux computer for that matter. There's a
command called man and what man stands for
is manual and what that is is it
basically is documentation or manual pages right
here on your Linux host and what we're looking for is a
command as a manual entry called hire. So in
your terminal if you type the word man space
and then hire what this should
give us is the hierarchy file system.
And if you I hit enter you can see here. This gives us
all the directories inside your Linux file
system and what they're used for and so
this is the FHS guidelines that are set that
this directory should be used for this and these files and this creates
a standard amongst all the Linux distributions.
So I'd like I said, I'm not gonna go through all of them here, but I want you to know
this is here. So if you did want to actually look through all
these you could and learn more so I'm gonna hit cue to
quit to get out of here. Okay, so there's two commands
that we're gonna need to Traverse our Linux file
system. So the first command is LS which basically lists
the contents of a directory and the
other command is CD which allows you to change directory to
another directory in your
file system. Let's get started with there. The first
thing we're gonna do is we're gonna change directory into our root file
system.
Which is the top level of all the five of
all the directories and so to do that you're going to type the command
CD space and then a forward slash. And so
this is gonna change our current directory into
the root file system directory.
And so we know where there because you be is denoted by
after the ec2. User prompt is a slash
now rate before the dollar sign. So there we are.
The next thing I'm going to do is use LS to list the contents of
this Direct.
And here we are in the root file
system. There are a whole bunch of other directories
as you would think, you know, you could think of the file system
as a tree and they're all connected here. So like I
said earlier, we're just gonna go over a few that I've
picked we've talked about the root file system hierarchy and
how it's the top level and where everything is Branched from
beneath this the next one I want
to talk about is the boot Direct.
And so the boot directory contains static files
that needed to help boot the OS you'll find stuff like the
initram file system and possibly the kernel.
So to inspect the contents
of the boot directory, we're going to once again type the ls
command.
With the space and then we're gonna use the we
type in the name of the directory. We want to look in which
is boot here with a slash. We want to look in
the contents of the boot subdirector.
Okay. So here we are. We see
the contents of the boot directory. You can see there's The Inn at
Ram file system. There's the grub to directory which is our bootloader and
there's a few other files here. Don't worry
about what these files do it's not important for this course, but
just know that the boot directory is what makes your OS
possible to boot into all the files
and information are here so I'm gonna clear the screen.
So it's easy to keep following along I will list
the contents of the high level directory again,
so you can just have a visual there as we go through these
the next directory we want to talk about is the bin director the
bin directory contains executables that are used by both administrators
and standard users alike. For example,
the ls command that we're using right now is actually located in
the in this bin Direct.
So while once again, we're gonna go
ahead and we're gonna look in the directory. I'm gonna type LS space and
the directory. I want to look at which is been
And hit enter so as you can see a whole bunch
of files when past the screen and this is
because there's a lot of executables inside the bin directory. We're
not going to go over all of them. There's quite a
bit in here.
The ls is in here python 3.7 command
is in here and and another commands like that. So obviously
if you're running any commands
in your spelunking 3 system, you want
to be able to have access to the bin directory? Okay, so let me
clear the screen here.
I'm gonna list the higher the top level again.
So it's just easy to visualize and the next director we're gonna
go to is the Espin directory.
So I'm going to go ahead and Espen
LS. So before I
assure the contents the this directory holds
executables that are meant for restoring repairing or
recovering the file system. You'll find commands in here
like reboot in fdisk if this is used to work
with local disks, so let's go ahead and we'll
list the contents of the s-spin directory. So as
you can see a lot of binaries just
like we saw on the bin directory.
You know, the only difference is these are more used for the system
and system administrators. Whereas the bin directory
is a little bit of mixture of Administrators and standard uses alike.
Okay, so let me go ahead and clear the screen. I will
once again print the top level so you
can follow along easier and the next directory we're gonna discuss
is the ETC directory or the
ETC directory. You may hear it called
Etsy as well.
It doesn't seem to be any real
guide on which one to use.
I kind of use them interchangeably where I use it. Sometimes I say Etsy
and sometimes I say Etc but the original meaning of
the directory is ETC and so the ETC directory
contains configuration files for all your application and
system apps and you'll find stuff and
you're like the user file the Quran configuration
file and a host.com file.
So let's go ahead and list the contents like
we have before LS space the directory
we want to and then hit return.
Okay. So this is all the
basic configuration files right now on this ec2 instance.
So if you ever install an application most likely
to configuration file end up here. So if you ever need to make
any change and configuration you want to come inside this directory and the
format is like Etc slash application name
slash and then whatever the config file is.
But as you see I mentioned cron earlier.
You can see here. They have The Chronic configuration
files.
You all this over here. You have the user
the password file. There's a group file in here.
Those are files will touch in later videos, but just know that
this is where they're at.
All right. Let me clear the screen.
List the top level and the next one we're gonna look
at is the proc direct. So the proc directory is a
little different than the other ones. The proc directory is a pseudo virtual directory
where the other ones actually have files on disk. This one is
is like I said is virtual and so the proc
directory contains information about all the
running processes in kernel settings that are
on your computer. So some of the things you can look at in the proc file
or CPU information or memory. So let's
go ahead and let's list the contents of the proc file.
So LS and the proc directory and then enter
And here you can see all the way to the left you see the
in the digit directory the digit named
entities right there. Those are actually process IDs.
And so if you wanted to look inside of
you those each process has a specific set
of files in other sub directors you go to you can see
up there. The one process ID one is actually
the first process that get started when your Linux boots, but for
example, you can see that there's a CPU info file
right there. And I'm gonna use the cat command here.
What I want to do is I want to print the contents of this file
out to standard out and you can use the cat command for that and
the cat is just cat and then the file you want to
in this case. It's gonna be proc slash CPU info.
And so here we can see we print out the
contents of the CPU and file and it
basically it just the metadata around the CPU using
you can see here that we're using an Intel Xeon. It is
2 point, you know, 2300 megahertz
and processes zero which basically means that
this is only one core. If there was two cores you
would see multiple entries of the same thing and the next
one be processor one.
Okay, so let's get out of the proc file system.
We'll go back to the root top here.
The next director we're going to talk about is home. So home is
basically what it sounds like. It's where all the users home directories are
kept. So we're gonna do LS.
Home and we'll go look inside the home directory.
So in here you see a sub directory called ec2 user
and this is because
Amazon Linux default user as you recall is the ec2 user
and so this is just the ec2 users home directory.
We will explore more about users directories and
stuff when we create users in later video.
Okay, so let's clear the screen.
Print the top level again since we're
in route. Okay, and so the next director we're going to talk about is
the VAR directory.
So the vardo directory contains variable data, like
logs temporary files and spools. So
this is where you're gonna find like your male spool
or your system logs or application logs. So let's
go ahead and let's peek inside the VAR directory
here LS VAR and then return so
this other sub directories
in here.
But the One You're Gonna use the most out of all these
is the log directory. So I'm gonna go ahead
and hit the up arrow and reuse my last command and we're
gonna go ahead and look in the VAR log sub directory.
And so as you can see in here, we have a
whole bunch of other logs and you can
see one messages mail log. There's
the cron log from the cron Damon running. And
so if you are troubleshooting or
you need to find a log, this is probably one of the first places
you go look,
So let me go ahead and we'll close this out. I will clear the
screen.
Print the top hierarchy again. And so this is
the last director we're gonna talk about and this is the Libra so the
lib directory contains any Library needed to boot the system
and help binaries.
That are located in the bin and Espin director that we saw earlier.
So let's go ahead and look at the lib directory.
And so here is you could see there's a whole bunch
of other.
Fold or directories in here as well. And so
these will also have libraries underneath them. But I to make
this probably easier to to follow let's
go ahead and look in the python 3.7 directory. So
you're gonna do LS.
Going to do Libs / and then we're gonna
do python 3.7 directory. It
is another one another subdirectory called site packages. So
just go ahead and you can tab if you hit tab. It'll
actually complete some of these for you.
So here I'll just show you really quick. So if I just type S and
then tap it out, it'll actually autocomplete for
me. So I don't have to click on all site packet.
So let's look in there and here you can see this is a
bunch of this other software and libraries in here that allow the
python3.7 binary that was in the bin
director. We saw earlier it allows that to run.
So these are like dependencies of that binary.
Okay, so let me clear this up.
So we talked about the file system
hierarchy standard.
We went through nying of the most popular
directories inside your file system. So let's
jump back over and let's recap of what
we did in this video.
Okay, so
What we did in this video is we first we explore what
FHS is and how it governs in
in sets some standards of what directory structure and
files look like inside a Linux host. You also introduced
a commands like LS and CD that may
traversing the Lennox file system extremely easy.
Finally you explored important directories like
root proc Etc
in bin.
In the next video, we'll go over the basics of
files and directories inside Linux. See you
soon.