File System Structure and its Description, we have
file system in Linux that is divided into
different directories, and that's something that
we have seen previously as well. So, now I am
going to take some time in this lecture to go over
each file system partition or the folder or a
directory that is set up in Linux, and I will
explain you every directory in Linux file system
and what is it used for. So, I have listed down
all the directories and I will go over them,
one by one based on how important they are. So
the first one and the most important one that we
have in the list is slash boot. Slash boot is the
file or is the directory that contains files used
for boot loader or the file that is in there is a
grub.cfg, your configuration file. What
happenes is every time your system boots up, the
first thing the operating system that needs to
boot up the system looks for slash boot and that
is somehow hard coded in the disk, that you start
up, go into slash boot, and you will find what you
what operating system you need to start. There is
old operating system or a new one or upgraded
version. So it goes into the slash boot file, and
it looks into it. By the way I will go over each
one of the directory in my Linux system and I'll
show you exactly what inside of each directory.
Second one we have slash root, it is the root user
home directory. Please remember it is not the same
as slash. A lot of times people confuse slash
which is also known as a root, but it is not
actually slash root. So root when you log into a
system or Linux system as root, and you do pwd, you
will see you will be in a slash root, not just
slash. Then we have slash dev directory. This is a
systems device such as a disk, a CD ROM, speakers,
flash drive, keyboard, any of those peripheral
devices that are attached to your Linux system.
They are created as a file as well and they will
show up in a slash dev directory. Going and moving
forward is the next one is slash etc, it is
also one of the most important directory in Linux
file system. It has all the configuration file. If
you are running Sendmail, NFS, NTP, or any
kind of application that actually runs on top of
your Linux system, or that comes with a Linux
system. All those configuration files are located
in slash etc. If I wanted to modify something on
let's say DNS, I will go into slash etc slash name.conf
file. If I want to modify something in the Sendmail,
I will go into etc, the mail, and sendmal.cnf,
or that type of configuration file. So just
remember that anytime you're making change in
slash etc to any file inside of this directory
please make sure you make a backup first of that
file before you modify the configuration file.
Then we have slash bin, slash bin in the newer
version has been changed to slash user slash bin.
It is like a linked to slash user slash bin and it
is actually the directory where we have the
commands that are used by everyday user commands
like ls, pwd, these type of command, all of them
are in slash user slash bin directory. Then we
have another directory called slash sbin which is
pointing or linked to slash user slash bin. This
is a system slash file system commands. Those are
the type of commands that you really need for
system type of purposes. If you want to extend
your file system or configure your file system
that will take a look again, in our when I bring
up my Linux machine, slash opt. slash opt is used
for optional add-on application. It is not the
application for operating system apps like NTP,
DNS, those are the application that is actually
come with the operating system. This slash opt is
not used for those type of application that is
used for third party application. Let's say if you
are installing, let's say Oracle or some other kind
of application or SCP, those are applications
usually and most of the time are installed in
slash opt.
slash proc is the directory that is used
in create files for all the running processes.
Please remember when you shut down your Linux
operating system there will be nothing in slash
proc it will be empty. So, the kernel, which I
will explain you later on what kernel is, but
there is a program kernel in Linux that
actually creates all these files for all the
running programs in that directory once system
shuts down, all those files go away. lib, which is
now pointing to usr/lib, it's
a location where all the C programming library
files, and those files are needed for commands and
applications. Meaning if you are running a
command, let's say pwd or ls, all those commands
actually do have a libraries attached to it that
they could go and look for. And that's how these
programs are run because they are written in C and
C++. If you wanted to know which
command is used, and sorry, which library file
is used for which command, you could use this
command strace -e open, like pwd is the
command. That next one we have slash tmp
directory, the directory that is used for
temporary files. It has no significance
whatsoever. But you could just if you want to
create a file, a temporary file that you think you
will delete later, you could create that slash
tmp directory. Slash home directory is used for
regular users while creating a regular account on a
Linux file system, let's say iafzal, my home
directory will be created in slash home. The next
one we have is slash var. slash var is used for
system logs. Every time your your operating system
writes some output or some logs, all those logs or
its application logs will always go into slash
var. So if you are troubleshooting issues, you can
always go into slash war log and other directories
where you will find information about a specific
application or if something going wrong with it.
Then we have slash run, this is where the
system's daemon starts up on very early stages. For
example, systemd and udev to store temporary
runtime files like pid, or process id files, and
again, this will go away if the system is shut
down, it just stores those process id and keeps
track of it. Slash mount is used to mount external
file system. If there is nothing, if nothing is
mounted on your existing file system, then you
could use that slash mount to create another
subdirectory and mount any external NFS file
system to it. Slash media is used for CD ROMs. If
your system has a CD ROM drive and you put a CD
ROM inside of it, then you close the tray. That CD
ROM will be mounted under slash media. If you're
using a virtual machine, you map the virtual drive
to your virtual machine, that virtual ISO image
will be shown under slash media CD ROM. So that's
the list of all the directories that we have that
support system structure and his description. And
now I'm quickly gonna go into my Linux system and
I'll show you exactly each one of them and how it
is set up. So I am logged in as whoami, I'll do
root, and I'll cd into slash, and I will do ls
-ltr or ls -l, and you'll see all these
directories that I have just covered. So first one
I have is boot ,and if you notice in the boot there
is these two directories grub and grub2. If I go
into grub or grub2, let's go to grub2 and do
ls -ltr, you'll see there is grub
configuration file. This is the file that's
telling the system which operating systems to
start, or which version of operating systems to
start. Let's go to slash root.
This is the root home directory. If I just hit cd,
and hit enter, and do pwd, this is the root home
directory. There's nothing much in there. It's
just its own Desktop, Document probably it has all
of them are empty, nothing is in there. Then I
will go to slash etc. This is the directory
which has all the configuration file, most of the
files that you're going to see in the in this
directory or the subdirectories all of them will
have conf. So it means it has configuration file
going to slash bin which is pointing to use a bin.
It has all the commands that we use, everyday
command to actually talk to the operating system.
Same thing with sbin This one has all the ones
that deals primarily within your file system,
disks, and extending the file systems. Then we have
opt, you do ls -l. And you will see this is
the one that is used for third party application.
right now it only had like rh, which stands for
Red Hat, nothing else. Then we have proc is the
one that runs all the running programs
temporarily, it is not the actual file that will
stay on the disk. We have next one library, and
library has all the library files that are needed
to run a simple command. Next one, we have slash
tmp, and slash tmp, you see all these are
temporary files, you delete them, you create new
files, it doesn't really matter. It's just a
scratch space that you could put your files on.
Then you have slash home. Slash home is for the
users like I have my user here, I have another user
called seinfeld, this is the home directory. Then
the next one is slash var. Slash var is used for
all the logs that are created in your system. So
if you, primarily the main log is slash var slash
log, and this is where all the logs are created,
if something goes wrong with the system, this is
where you have to come in. By the way, every one
of these that I'm going through, I will go through again
later on, and you will get more and more familiar
with these file systems and it's directories, and
all the commands that I'm running on. Then the
next one we have slash run, this is the one that
that runs the system daemons very early in the
stages and is a temporary files. The next one we
have mnt, this has probably nothing because I do
not have any external file system mounted on my
disk file, on my this computer. So if I mount it, I
will use a command mount to file it and usually it
gets mounted in slash mnt, because you have to
specify it and that's where it goes. The last one
is, we have slash media is, this is where if you had a
CD Mount, CD ROM attached to your system, this is
where it will go. Anyway, this is what I want to
cover in the file system structure and
description. I really hope that this lecture
covers everything in terms of the file system and
structure. Thank you.
[No audio]