Instructor: File system structure and its description.
We have a 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 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 /boot.
/boot is the file or is a directory
that contains files used for boot loader
or the file that is in there is a grub.cfg
or configuration file.
What happen is every time your system boots up,
the first thing the operating system that needs to boot up,
the system looks for /boot
and that is somehow hard coded in the disk
that you start up, go into /boot and you will find
what operating system you need to start,
whether it's an old operating system
or a new one or upgraded version.
So it goes into the /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 /root.
It is the root user home directory.
Please remember it is not the same as /,
a lot of time people confuse /,
which is also known as root,
but it is not actually /root.
So root, when you log into a system,
a Linux System as root and you do PWD,
you will see you'll be in /root, not just /.
Then, we have /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 /dev directory.
Going and moving forward is the next one is /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 the Linux system,
all those configuration files are located in /etc.
If I wanted to modify something on let's say DNS,
I will go into /etc name.com file.
If I wanted to modify something in the sendmail,
I will go into etc, mail and sendmail.cf
or that type of configuration file.
So, just remember that anytime you're making change
in /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 /bin, /bin in the newer version
has been changed to /user/bin.
It is like linked to /user/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 commands,
all of them are in /user/bin directory.
Then we have another directory called /sbin,
which is pointing or linked to /user/bin.
This is a system/filesystem commands.
Those are the type of commands that you really need
for system type of purposes.
If you wanted to extend your file system
or configure your file system,
that will take a look again in our,
when I bring up a Linux machine.
/opt,
/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 /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 SAP,
those are applications usually
and most of the time are installed in /opt.
/proc is the directory that is used
and create files for all the running processes.
Please remember when you shut down
your Linux operating system,
there will be nothing in /proc.
It will be empty.
So the kernel,
which I will explain to 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 the system shuts down, all those files go away.
Lib, which is now pointing to user/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 libraries attached to it
that they could go and look for
and that's how these programs are run,
because they're written in C and C plus plus.
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 minus E open,
like PWD is the command.
The next one we have /temp directory.
The directory that is used for temporary files,
it has no significance whatsoever,
but you could just, if you wanted to create a file,
a temporary file that you think you would delete it later,
you could create that /temp directory.
/home directory is used for regular users.
If I creating a regular account,
an analytics file system, let's say Absol.
My home directory will be created in /home.
The next one we have is /var.
/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 /var.
So, if you are troubleshooting issues,
you could always go into /var log and other directories
where you could find information about
a specific application or if something going wrong with it.
Then we have /run,
this is where the system's daemons starts up
on very early stages.
For example, systemd and udev
to store temporary runtime files like PIDs
or process IDs files
and again this will go away if the system is shut down
is just to store those process ID
and keep track of it.
/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 /mount
to create another a subdirectory
and mount an external NFS file system to it.
/media is used for CD-ROMs.
If your system has a CD-ROM drive
and you put it a CD-ROM inside of it,
then you close the tray,
that CD-ROM will be mounted under /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 /media CD-ROM.
So, that's the list of all the directories that we have.
That's the file system structure and its 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 who am I.
I'll do root and I'll CD into /
and I will do LS minus LTR
or LS minus 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 boot there is these two directors,
grub and grub2.
If I go into grub or grub2,
let's go to grub2 and do LS minus LTR.
You'll see there is grub configuration file.
This is the file that's telling the system
of which operating systems to start
or which version of operating systems to start.
Let's go to /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 /etc.
This is the directory which has all the configuration file.
Most of the files that you're gonna see
in this directory or the sub directories,
all of them would have .conf.
So, it means it has configuration file.
Going to /bin, which is pointing to user 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,
whether your file system, disks
and extending the file systems.
Then we have opt, you do LS minus L
and you'll 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 was 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 /temp
and /temp you see all these are temporary files.
You delete them, you create new files.
It doesn't really matter,
it's just a a scratch space
that you could put your files on.
Then you have /home,
/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 /var.
/var is used for all the logs
that are created in your system.
So if you, primarily the main log is /var/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 its directories
and all the commands that I'm running on.
Then the next one we have /run.
This is the one that runs the system daemons very early
in the stages and these are temporary files.
The next one we have MNT.
This has probably nothing,
because I do not have any external file system mounted
on my this computer.
So if I mount it,
I will use a command mount to file it
and usually it gets mounted in /mounted,
because you have to specify it and that's where it goes.
The last one is we have /media
is this where if you had a CD-ROM attached to your system,
this is where it will go.
Anyway, this is what I wanted 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.
Alright, thank you.