So to start with, why are files so important on Linux?
Well, it's easy to understand. On Linux everything is a
file configuration is stored in mostly ASCII text configuration files.
Devices are addressed by using device files, programs are started through files, and so much more.
Files are organized in directories, also known as folders, where each directory has its own purp.
And to start with, it's a good idea to know which directories exist on Linux.
Now, if a directory needs to be separated from other files, a specific storage device can be mounted on it.
That's also what you want to do. If you connect a USB thumb drive,
for instance, you mount it on a specific directory in the file system hierarchy.
Directories on Linux are highly standardized and that means that on all
Linux distributions you will find USR for program files or VAR for
files dynamically created by the operating system or etc for configuration files.
Now this standardization is coming from the File System Hierarchy
Standard or fhs that happens to be a Linux Foundation
Standard Linux foundation is a standardization organization behind Linux and
they provide recommendations and most distributions are adopting these recommendations.
If you are a regular user. As a regular user you have write access to two directories only.
And these are the home directory in home and the TMP directory.
If ever you are wondering if you have write access, an easy way to find out is
by using touch followed by a file name that will verify write access to a specific location.
Let me show you what this default file system hierarchy looks like.
So to start with, I'm using CD slash to go to the root directory
and there I'm typing tree. And tree is showing the default directories that exist.
Now, they are highly standardized and that means that most Linux distributions will look more or less the same.
But sometimes, up to the discretion of a distribution, they might add the directories that you don't find anywhere else.
Now let's have a look at these directories using LS link because we can see
a couple of them are pointing to something else. These are the so called symlinks.
These are symbolic links and they make sure that directory can be accessed in two different ways.
First thing I want to show you is the boot directory.
In the boot directory you find everything that your Linux system needs to
boot, including the Linux kernel, which is the name VM Linus 6.12.
Now these directories have specific colors and the colors in fact don't mean too much. They
depend on the rest of your terminal settings. So I would say don't focus on colors
too much. Focus on output of vals as displayed using the LS L command.
We don't do that. Now I would like to show you the dev directory.
The dev directory is for device files and these device valves
are files that allow you to communicate with your hardware.
My hard disk for instance is NVME 0n1 and like that there
are more device valves that you are going to work with.
We'll discover some of these valves as we move on in the later lessons in this course.
Next we have the Etc directory. Etc directory is for configuration files.
Just pick out any of these configuration files. Like hey, OS release. I like OS release.
The OS release file is in fact a standard file on Linux
that is printing information about your current distribution. As you can see.
What else do we have? We have the home directory. In the home directory,
users have their own environment and that's what they are allowed to write.
Skipping a few and then we get to the proc directory. The proc directory is a very interesting directory.
It's a direct view on what is going on in the Linux kernel.
There are some valves giving information about the current state of your system.
Like for instance the CPU info file which is
giving me information about my current CPU configuration.
The next directory that we need to talk about is the USR directory because the USR
directory is about program files and the content of the USR directory is highly standardized.
In USR you find bin and you'll find sbin.
Bin is for non root binaries which are program files
and sbin is for program files that require root access.
Another important subdirectory here is local.
In user local you'll also find bin and sbin. Now what is the difference? Well, the difference
according to the FHS is that files that are installed from operating system packages should be in
USR bin and in usersbin and files that you've created yourself should be in user local bin.
We'll work out some examples about that later. Last directory I want to talk about is the var directory.
The var directory contains a lot of stuff that is dynamically created by the
operating system, like var log, for instance, in which you will find log files.
You want to know which one is important. Well, use LS L that will show you the size of
your files. And there you can see that definitely the messages file is the biggest of all of them.
And that is because this var log messages on CentOS system is the main system
log file apart from systemd journal D. But you will learn more about that later.