From the course: Introduction to Linux

The Linux file system - Linux Tutorial

From the course: Introduction to Linux

The Linux file system

- [Instructor] To store data on a Linux system, we use files and files are organized into directories, or folders, as they are on other operating systems. These files and directories make up the file system. In order to organize files consistently on Linux systems, most distributions follow the file system hierarchy standard, or FHS. This standard makes it possible to switch between distributions easily and to use unfamiliar distributions without having to spend a lot of time looking in different places on different systems for files you need. Though, if you're coming to Linux from another operating system, it can take a while to get used to how files are organized. In the Linux file system, everything starts with the file system route, which is represented by a single slash. On a Linux system, there's only one file system route. Even if we plug in other storage devices, those devices become part of the overall file system and they're not represented as separate file systems like we might be used to seeing on a Windows system, with C and D and other drives. You can think of the file system route kind of like the My Computer level on a Windows system rather than the C drive. Using a desktop based file browser, we'll see other discs listed as we might expect on other operating systems, even though they're mounted or made available within the root file system, usually under the MNT directory or a directory called Media. From the root, as we move deeper into the file system and at the first level, there are a variety of directories, each with a specific purpose. Some of the important directories defined by the FHS include the home directory, which is where each user has their own directory to store their personal files. There are also other directories like Bin, Sbin, and Usr, where programs of different types are kept. The ETC directory is where system-wide configuration files are stored, and VAR is where changeable, or variable system information is kept. This is where we'll find system logs and logs for other software. Some directories defined by the file system hierarchy standard aren't real directories on the disc at all. The Dev, Proc, and Sys directories are created by the kernel to represent hardware available on the system, processes running on the system, and the system itself. Entries in these directories allow programs and the user to access these resources, which is important if configurations need to be changed or if information needs to be read from or sent to devices. On a Linux system, everything is represented as a file, including all the system's hardware, processes that run programs, settings in the kernel, and so on. When we're getting started with Linux, we don't need to worry too much about most of these directories. It's good to know what they are though because as I mentioned, it can be overwhelming to see all this if you're new to Linux. As you explore Linux more deeply, you'll probably work with many of these directories, but for now, it's enough just to know that they each have a particular purpose, and it's important to know where your files are inside the home directory in a directory labeled with your username. Here in my file browser, I can also see my home directory by clicking on the home item here on the left side. While the layout of the files and directories is called the file system, the term file system is also used to refer to different strategies or data structures for storing and representing file data and file metadata. Those are things like ext4, btrfs, zfs, xfs, and so on, but we're not going to get into different file systems here because in most cases you'll choose one or another based on what you need your storage system to do, and that's something that's a bit more advanced than I want to go into here. For most users, it's not something we have to think too much about, but some administrators and developers make their entire career about working with and administering file systems and storage. When we're getting started with Linux, it's fine to just let the operating system installer handle choosing what type of file system we'll be using. We can always create other file systems on other media later on. The file system on a Linux machine can seem intimidating and technical and a little bit alien if you're used to other operating systems hiding some of the inner workings from you. But knowing where to find our own files and having an idea of what all the other directories are for provides a good start for working with Linux.

Contents