YTread Logo
YTread Logo

Linux File System/Structure Explained!

Mar 27, 2020
most people who have used Linux have seen the root directory, but not everyone understands what directories are used for - a Windows user opening the

file

manager is a lot like opening the home folder in Windows and everything looks very familiar. You have your documents. your downloads your images your videos the same until they scan the tree looking for the C drive where is Program Files where is the directory where Linux is installed - how do you find something? Let me explain you. I'll take a minute here to New Linux users coming from Windows Windows and Linux evolved in very different ways.
linux file system structure explained
Once upon a time there was something called ms-dos. The drive's operating

system

was command-line only, but it could still run programs, games, and WordPerfect, but it didn't. you need Windows Windows was added to PCs and you can install it on top of DOS, you would start your computer and type win to start Windows. It used letters to assign drives, with a and B being removable disks, since early PCs only had floppy drives with the addition of hard drives, the letter C became the letter of its internal disk, additional disks were given the next letter available, I could install things in Doss wherever I wanted, Windows was installed in its own directory called pretty funny, Windows later, Microsoft changed the way it booted. by evolving its kernel to be less and less dependent on DOS and finally allowing Windows to boot directly without DOS, Microsoft's

file

directory

structure

stayed the same now, Linux is different and so is its file

structure

, it also doesn't install Applications like Windows, starting with Windows 95, Microsoft created the Program Files directory, which was the default installation directory for most applications.
linux file system structure explained

More Interesting Facts About,

linux file system structure explained...

For the most part, Linux follows UNIX traditions, so it uses the forward slash instead of the backslash like Windows. Linux also cares about capitalization so you can have things like this file file file file file as you can see even though they are all named file they all use different capitalization so Linux will allow this because technically they are not named exactly the same Mac users who have scanned their hard drives. Linux may look a little more familiar to you, this is because the Mac also evolved from an ancestor of UNIX, more specifically BSD, so let's take a look at the path and review how this all works.
linux file system structure explained
This design is for the most part described in the File System Hierarchy Standard or FHS. which defines the structure and design and is maintained by the Linux Foundation. I want a note here that not all distros follow this, some do something special and various ways of structuring folders have changed over the years, but most of what follows still applies in most cases. , so let's go from one end to the other starting with bin which is short for binaries, these are the most basic binaries which is another word for programs or applications, things like LS to list your directory cat to display the output of a file and other basics.
linux file system structure explained
The functions are stored here jumping forward a bit. I also want to point out that s bin are

system

binaries that a system administrator would use and that a standard user would not have access to without permission. Both folders contain files that need to be accessible when running in single-user mode, as opposed to the usual multi-user mode. Single user mode is a special mode that starts you as the root user to allow you to perform system repairs and updates or test the network, it is usually disabled in this mode. Due to security concerns, when you install a program on Linux, it is generally not placed in these folders.
Next is the start. This is a folder you don't want to play in. It contains everything your operating system needs to start. In other words, your bootloaders live here. Next we have the cd-rom, which I'm going to skip because it's not on all distributions and is more of a legacy mount point for your cd-rom, so let's move on to development, this is where your devices live. Linux again after UNIX has a standard where it was decided that everything is a file here you will find your hardware, a disk for example would be dev slash SDA here and a partition on that disk would be for example dev SD a1 SD a2, etc., you can also find everything else. here, from your webcam to your keyboard, this is usually an area that will be accessed by applications and drivers and is rarely something a user should dabble in, so going back to the root, the next folder is, etc It has been argued that the name of this folder represents etc., the edit settings are stored;
However, when I talk about settings, I mean things that affect the entire system, like apt, in this folder for example, you will find the list of all your sources that your system connects to. as well as its various settings, so if you are looking for something that is a system-wide application and not a per-user setting, for example, Libre Office would have settings in each user's folder and it would not be system-wide because each user can have different settings and this takes me to the next folder which is home, however, I'm going to save this for last because there are a few things I want to discuss about that, so we'll come back to that later.
The Lib folders are this. includes Lib Lib 32 and lip' 64, this is where the libraries are stored. Libraries are files that applications can use to perform various functions that require the binaries in bin and s bin, for example continuing we have media and MNT or mount these. Directories are where you will find your other mounted drives, it can be a floppy disk, USB stick, external hard drive, network drive or even a second hard drive, so if you are looking for a B or D drive this is where must search. Now this media folder wasn't always available, it was usually just MNT and that's where you mounted your storage devices.
Nowadays, most distributions automatically mount devices in the media directory, so the USB stick you inserted would be in the media username, device name. Why are there two directories? If you're mounting things manually, use the MNT directory and leave the media directory to the operating system to handle most distributions and file managers like Nautilus for example, what I'm using here, and Dolphin and PC Man FM will do. I have something on the side here, for example in Nautilus. I can click on other locations and here I can access my other devices. If you had a USB stick plugged in right now, it would appear here and you could simply click on it and access it below. the line is opt, this is the optional folder which is generally where software installed manually by vendors resides, although some software packages found in the repository may also end up here.
VirtualBox guest additions are an example, so here, for example, is a VPN software that I installed. and drivers for the brother printer bar scanner, this is also where you can install the software you created yourself. This folder is where I put all the applications that I first wrote in Linux, then we have prop rock, it is where you will find pseudo files that contain information about the processes and system resources, for example each process will have a directory here that contains all kinds of information about that process. An example I can show you here. If I open the system monitor, I can see the process ID of Dasia monitors or hid is two three four four, so if I navigate to proc two three four four, which is the well for Dasia dupe monitor, I can see everything kind of pseudo files here, this is a lot like dev, where they aren't actually files on the system.
Does the kernel translate other information to appear as files? So, for example, here I can open the status file and it will show me all kinds of information about that process. There are tons more here but this is not something you want to mess around with if you are a developer, if you are writing applications this is very useful here, you can also find information about the CPU for example this will give you all kinds of information about CPU and you can also do uptime which will print your uptime. for your system, next is root root is the home folder of the root user, unlike a user's home folder, it does not contain the typical directories inside it and does not reside in the home directory.
You can store files here if you want, but you need root permissions to access. Placing this directory also ensures that root always has access to your home folder in case you have the regular users home directory stored on another drive that you can't access next. This fairly new distribution runs and different distributions use it in slightly different ways. It is a temporary FS file system, which means it runs in RAM. This also means that everything in it disappears when you reboot or shut down the system. It is used for processes that start early in the startup procedure to store runtime information that they use to function.
We've already covered s bin, so next in line is snap. This is a folder where snap packages are stored and are primarily used by Ubuntu. Snap packages are completely independent applications that run differently than normal packages and applications. This will be covered in the future. video on its own as it will take more time to explain SRV, this is the services directory where the service data is stored, it will probably be empty for you, but if you run a server like a web server or an FTP server it will store the files which will be accessed by external users here, this allows for greater security as it is at the root of the drive and also allows you to easily mount this folder from another hard drive next down the line is sis, the system folder has been around for a long time.
Instead, it is a way to interact with the kernel. A previous example is writing to a file using a VGA switch and changing the settings of the graphics cards in a hybrid system. This directory is similar to the run directory and is not physically written to the disk that is created each time. the system boots, so it won't store anything here and nothing will be installed here. TMP is of course a temporary or temporary directory, this is where applications temporarily store files that might be used during a session, an example is if you are writing a document in a word processor, it will periodically save a temporary copy of what you're writing here so that if the app crashes, I can look here to see if there's a recent save you can recover.
This folder is usually emptied when you reboot. Sometimes the system may find some files or directories remaining and they might get stuck there because the system cannot delete them. This is usually not a big problem unless there are hundreds of files or the files take up a lot of disk space. in which case you may want to log in as root user in single user mode, navigate to this folder and delete them manually. To continue, we have the USR folder, this is the user's application space where the applications used by the user will be installed instead of The bin directory is used by the system and system administrator for maintenance.
It is also known as a UNIX system resource and any application installed here is considered non-essential to the basic functioning of the system. Installed applications will reside in one of several places here, just like the user. bin user s bin or local bin local Ben with your required library stored in the local user Lib or user Lib most programs that are installed from source will end up in local folders, many larger programs are They will install themselves on the shared user of any installed source code as the kernel source and header files will go to the SRC directory, this directory looks like a confusing mess at first and although the directory structure and what goes where is set in the FHS that I mentioned earlier, sometimes you'll still have to look elsewhere to find things that someone creating a certain app might not meet the standard and might just do whatever they want.
Also, some distributions may treat these folders differently and going back to the root we have the following var var is the variables directory containing files and directories that are expected to grow in size, for example var crash contains information about processes that failed. var log contains log files for both the system and many different applications that will constantly grow in size as you use the system. You will also find other things. here, as databases for mail and temporary storage for printer queues, also known as spooling and finallywe will return to the home folder. When you enter the home folder, you will see that each user has their own folder inside it, the home folder.
It is where you store your personal files and documents, as I said, each user has their own home folder and each user can only access their own unless they use administrator permissions. Some users mount the home folder to a different drive or a different partition, allowing you to reinstall. your system and preserve your files the home folder also contains many different directories that store your application settings a hidden directory is simply one that starts with a dot Linux hides them by default you can view them in the file manager by selecting show hidden files or by clicking By pressing Ctrl H, this is of course using Nautilus in gnome and some file managers may be different.
PC Man FM also press Ctrl H to view hidden files. If you are in the terminal and list the files, it will only show you what is not there. hidden unless you specify -a for all and now you can see all your hidden files. These hidden directories store things like cache. Some applications, such as a browser, are used to store temporary files. Other apps may store thumbnails or information that will be used over and over again. you have folders like config and local that store individual application settings, for example genie can be found in config, so here is the genie folder.
Any settings you change in the genie options are saved here. If I go back to the home folder you can see that some applications store their settings directly in the home folder like GIMP for example, these hidden folders are also where your desktop settings are saved whether you use KDE open blobs Gnome Unity, all your settings are saved here, like what wallpaper you use, what theme you use, etc., you can even place your icons and themes in these folders so you can have a custom look and easily save them for reuse. These hidden folders are important if you want them.
Back up your files and settings. I covered backups, how to make them, and where to store them in another video that I'll link in the corner of the screen and in the description below if you don't customize your system or don't. So you can simply backup all the folders you see here, if you want to save all your settings you may also want to include all the hidden files so if you reinstall your system just log in and all your themes They will now be available. Done just as you left it, you will have to reinstall your apps, but once you install them, the settings you set for them will already be in place and the apps will run as they did before, so you can see if Linux is anything like that. to Mac but very different from Windows, although it seems like a mess, it is actually a more efficient way of doing things and allows much more common resource sharing between packages when it comes to adding and removing software, your distribution will have a package manager that will handle it. all this for you, the package manager tracks where everything goes so that when you delete your package it takes all those files with it.
I hope you found this informative. I worked hard to prepare it and I will have plenty. to edit it now, so if you liked the video, please like it and don't forget to subscribe by pressing the big red button and the bell to receive notifications of new videos. Most importantly, if you found it useful, please share it by clicking share. and share it on your Twitter, Facebook or whatever platform you use as usual. You can also follow me on Twitter at Dorian dot slash and visit my Patreon page. All links are in the description. Thanks for watching and until next time. beat you up

If you have any copyright issue, please Contact