The File System Hierarchy
Start course
1h 43m

Red Hat Enterprise Linux (RHEL) is a rock solid commercial grade Linux operating system. If you're interested in learning RHEL from a system admins perspective then this course is for you!

The "Red Hat Enterprise Linux Technical Overview" course walks you through many of the basic system admin tasks and concepts required to administer RHEL effectively.

This course will provide you with insights to:

  • Working with the Terminal
  • Understanding the Kernel and User Spaces
  • Graphical User Interface
  • File management and the File System Hierarchy
  • Editing Files using Vim
  • Organizing Users and Groups
  • File Permissions
  • Managing Software
  • Configuring Networking
  • Controlling System Startup Processes
  • Introduction to Containers
  • Overview of Cockpit

Hey guys, right now I'm going to talk very briefly about the File Hierarchy Standard.

Now everything starts from the roots of the file system which we represent with a forward slash (/) so going to my computer VM, I'm going to run the ls command against the the root of my file system and you can see a number of directories that are risen and below that. And they're all directly below the root of the file system. Again this is our starting point and we have a number of important directories that I'm going to be highlighting right now. So let's go and deal with them in in this order yeah from left to right. So we have the bin directory and this is where we would find binaries in other words executables and the binaries that are find below bin are typically usable by all users of the system.

As opposed to a counterpart or its counterpart over here called sbin.

Sbin, system binaries, again these are programs however they are typically only usable by the root user. Now if you're looking at the colorization of those two directories you may find it quite odd and that is because they are in fact symbolic links. So bin on a Rhel8 system points to usr/bin and sbin points to usr/sbin. 

Now you see that usr directory is also very important.

It stands for UNIX system resources and below the usr directory you'll find a number of important directories far beyond the scope of this class. However I would just like to highlight at this stage that that is where we would find the actual binaries. So, if you're looking for the path to a program like the ls command, it is most likely below usr/bin and then the path is ls and there it is.

And if I'm go and try and do a directory listing right now against sbin you could see that there is no ls command or there's no ls file below usr/sbin

Now conversely, we are looking for a program called IP, to do IP address management from the command line. So I'm going to say all right show me the file usr/bin/ip and you can see over here that it says no such file or directory and again it's because the ip command you get kind of sounds like it's a systems administration command and if it is a systems administration command it's most likely below usr/sbin. So let's go and find out if that is true and you could say yeah the directory listing does in fact work. Now a common command that we can make use of, to to help us find where files are, is the whereis command.

So I could have just said whereis ls and you can see every year that it gives me a couple of references and the first one is, to the binary the other ones have got no reference to binaries in their pods, and similarly if I to say whereis ip you can see over here again, it returns a number of results and one of them is that the IP file or there's an IP binary below usr/sbin. Now we also have the boot directory and the boot directory is really important because it does have the Kernel. 

That is where the Kernel is as well as the files necessary to initialize and to load the Kernel. So this over here the VM Linux file that is the very Linux Kernel, the core of the operating system and its associated files and then we also have a number of other resources namely grub2, which is implemented as the bootloader. This is used to initialize or to load the Linux Kernel. 

We have a directory called dev which is where device files typically would go. We have etc. Now etc is really cool because etc stands for extended txt configurations and this is where you would go to look for configuration files.

So, if you're looking for a configuration file for your web server or how about your SSH server, it is most likely below etc.

Now the FHS also specifies where home directories go. Now normal user home directories go below /home. So, if you have a look at the contents of that we have a directory called student which is below home, which is below the root of my filesystem. Now root users home directory is /root so it's not like this, it is in fact /root and the word root over there.

We also have the lib and lib64 directories. This is where application libraries typically go.

This would be things like like shared code, other directories that I'd like to call out at this stage would include tmp. So, tmp is a form of temporary space and that is not the only place where we find tmp or temporary space because we have another important directory called var. Variable data that is what the var file system is all about. And this would include things like spool directories and files, administrative and logging data, transient and temporary files. That is what would be stored below var.

So, if we have a look below var right now, you can see that we have some cache related information, we have some logs, and we have another units of temporary space over here.

So there are two directories, two temp directories and you may be wondering well what's the difference between the two. Because I can kind of see that they are independent tmp directories because they don't look like symbolic links, the one doesn't point to the other one. It's quite simple, the tmp directory below the root of the filesystem in other words this one over here that has got a purging policy of ten days.

So the contents of that directory would be cleared every ten days, as was to var/tmp and this is the other units of temporary storage that we have is cleared every 30 days. So remember that was some very basic information about the file hierarchy standard and if you want more information there are many great references not only on your systems but also on the internet. So I would encourage you to explore this a little bit more.

And with that it does bring this video to an end I will see you in the next chapter.

About the Author
Learning Paths

Jeremy is a Content Lead Architect and DevOps SME here at Cloud Academy where he specializes in developing DevOps technical training documentation.

He has a strong background in software engineering, and has been coding with various languages, frameworks, and systems for the past 25+ years. In recent times, Jeremy has been focused on DevOps, Cloud (AWS, Azure, GCP), Security, Kubernetes, and Machine Learning.

Jeremy holds professional certifications for AWS, Azure, GCP, Terraform, Kubernetes (CKA, CKAD, CKS).

Covered Topics