Today we’re going to Understand the Linux File System. This is not a comprehensive article and hopefully, it will but not be very technical. This is just for anybody who is curious about what is different from the Linux Unix file system. So likewise, What you might be used to working within windows or Macintosh or other devices.
It does have its idiosyncrasies mainly because of the fact that the Linux file system comes from Unix. Unix is the granddaddy of all operating systems. It was originally designed for computers that lived in like that fill up a whole room and had hundreds of users attached to. Them and all sorts of different storage. All over the place and take drives and things like that.
However, we’re using this system today on our in our little laptops and desktops. That was maybe one or 2 hard drives in them but we still get all the functionality. These big gargantuan systems of years ago and the first thing that.
Clear Confusion about the file system.
I guess we need to do is clear up just a little bit of confusion. We need to define the word file system in the sense that we’re talking about today. Because there are two meanings to that word file system. That word refers to the format that you put on a hard drive. The way hard drive itself actually stores files and you’ll hear people say. I had to format the hard drive and install a new file system in windows. There are file systems like fat 32 and NTFS.
However, in Linux, there are a number of file systems the de-facto is EXT4 but it is EXT3 and EXT2 and JFS and XFS and butter FS and many more to choose from the. Average user that really doesn’t care about what file system is being used. On their hard drive as long as it works an EXT4 is one of the most stable and best in the world. However, It’s good to Choose a stable file system.
So in this article what we’re talking about is a file system. In the sense of how an individual computer organizes data where it stores it, and how it keeps up with where it is.
So let’s actually take a look at some of the folders. That you will find on your computer and to do that I’m going to open up an actual file manager. Here in this case since we’re using ubuntu, So it’s called files or nautilus is the actual name of the program that does this and we’re in the root folder. So now let’s begin with the article to understand the Linux file system.
The first floor to look at it’s going to be slash bin this is going to be a folder that contains commonly executed. They are gonna be shared for everyone on the system whether that’s normal users or administrative users. SO if we go to see the /bin folder. there are just extremely common you know like CP for copying a file you know rm for removing a file cd for moving a directory and so on regardless of the user type everybody can access all of these.
The next folder is /boot that’s going to contain the actual external as well as some of the boot configuration. So if we go to the slash boot folder. We look in here we see things like the initial ramdisk images the actual compressed Linux kernel and then the grub folder inside the grub folder. You get several more files that are related to the actual building of the system and one, in particular, is going to be grub that CFG that will let you configure what shows up in your list of kernels to select from AS you boot your system and then if you were to do but with windows you would actually see a windows entry inside there as well.
The next folder is slash Dev. It is going to contain files that point to both physical and pseudo devices. However, keep in mind that on Linux everything is a file. So there’s even files that point to physical hardware.
The slash etc folder or some people call it slash Etsy. This is going to be the place that you’re going to find system and program configuration files this is true of both user-installed software as well like say you do apps install. All your installed software configuration files are in /etc folder. That’s true for just about everything you could see that there are configurations like for X11 that your window manager this configurations like and this can be the place for all the configuration files for the system.
So the next folder is slash home and when a new user is created in the Linux. They will get a home directory unless the user was created as you know as a user doesn’t get a home directory. So we can go to slash home. Yow can find all your user’s home directory in /home folder. These are only for non-root users that’s an important thing root has its own directory which will cover in a second. And inside each person’s home directory can just be whatever they want to put in. There as well as any configuration that applies to that particular user in their home directory.
The /route so this is the root user home directory. You know that root gets its own directory like it wouldn’t be an /home/route. Which is going to be in /route and this is not to be confused with the root directory. Which is just /(slash) the thing that has all these folders and so /route is the home directory for the root user.
Library folder or /lib folder
There are 3 folders are going to be slash lib, slash lib32 and lib64. This is gonna be library files are used by the system and that’s gonna include things like shared object files as well as other files most the files will just be found in slash lib. However, if there are 32-bit variants and 64-bit variants of different library files then they can be placed in either of those 2 folders.
The lost and found folder and that’s mostly used by fsck to help recover fragments of files that may have been damaged due to some file system corruption. You probably won’t ever need to interact with this folder.
The next is a slash media folder some distros have a media folder like this where if you were to plug and say like an external USB key then the system may amount that USB key to slash media folder and then some unique identifier and then let you access it from the system. you can also mount things yourself here but the better place to do that’s going to be the slash mnt folder which is gonna cover next.
So for the /mnt folder also called /mount that’s maybe the place you’re gonna mount various file systems. Whether that’s local disks or network disks or so on servers
Linux has no concept of like C drive or D drive or E drive and so on well this is where slash mount comes in. So if you were to buy a new hard drive a 2 terabyte. You put into your computer on windows it might offer that up as like the E drive or the F drive.
Where is in Linux you have to go into /mount create a folder call it you know photos and then you can mount that drive on to that folder. So you would say mount my new hard drive on /mnt/photos. You know pictures from there /mnt/pictures are in affect your E drive.
The /opt folder is the folder, You can use that for really whatever you want for every software. I like to put some for the I develop into. There that might be running on a cloud server but there’s no special pattern on. You have to use that folder for on my machine there is currently nothing in it.
The next is the slash proc folder. This is a very important folder and this is a virtual file system for system resources and information about processes along with a couple of other things.
So we go to the /proc and We can see a number of different things here and what’s in this folder is first as a lot of folders and what this is it’s a folder for every process on the system
Therefore this is going to be the actual process ID’s here on the right. But there are other files in here as well he has also crypto, CPU info, consoles, and memories. There are mem stat miscellaneous modules and these are all things that you can interact with. Some files are read-only but some are you can actually put data into so like, for instance, you can do cat /proc/uptime. You could see that it gives you different values as I go. you know this is a virtual file it’s pointing to the uptime of the system. The folder for every process select number PID1 is going to be system does. You so if I go to /proc/1. Then I got a whole list of files that are specific to that process memories are all virtual.
Next folders is /sbin this is kind of like /bin except this is going to be executables that are mostly for systems administrators.
So if we go on to have a look at all these we can see things like creating file systems we can see things like creating you know or mounting stuff looking at IP tables for firewalls looking at block devices. And there’s tons of other different things but these are mostly for administrators who are doing some work to the system and not so much for just the normal user.
/tmp directory in the Linux file system
The /tmp folder is going to be a place to write temporary files. When I say temporary I really do mean temporary. Once the system reboots its kind of just wipe out the whole folder. So never save any work that you want to keep into that folder. But if you want to just put some files in their temporary then you know go ahead and do that.
/usr directory in Linux.
The /usr folder and they’ll /usr folder is almost like a mini Linux file system if we’re going to /usr folder we see a lot of things that we see in the root directory like /etc /lib. /sbin source and so on.
But these are all things that are geared more towards the actual usr programming usr operations whereas. The other stuff is more like system level it’s also worth pointing out that specifically with respect to the bin folder.
Which contains executables that you put into there by default will override those that are in like /bin. So if you had an executable called ls in /usr/bin. firstly it is going to run that instead of /bin however if you have no ls for instance in that folder. It will fall back to /bin and that’s all based on your path by default the path is set to use /bin as a last resort.
The last folder to look the /var folder and that’s gonna be just for variable files. That’s just a mishmash of Whatever you want to put in here and you could see there’s things like cache folder backups folder.
But there’s 2 things of interest here one is the log file folder. So in that folder, there are basically all the system logs that you might have for various purposes like your Syslog or your Xorg log and so on.
I think I’ve pretty much covered all of the basic stuff here and all of the differences between the Linux file system and the Other file systems out there. Go ahead make it so we can’t see the files and then we are going to remove this directory. And get back to normal so I hope that was an interesting guide.
I know that I have left a great deal of stuff out but it gives you a basic idea of how the Linux file system works and most of it is the same as. What you’re dealing with but there are some differences that every now and then get out again. You run across you go. What was that all about so thank you for reading the article. I love to hear from your comments are always welcome.
I hope you enjoy my article. please subscribe to our newsletter to read my articles and please share with all your penguins’ friends to grow. To Improve this article if you find anything incorrect so please comment below and I will update. To read my article click HERE. Reference Wikipedia