What is Linux?
Linux is the thing that in some form or another all modern computing is built on. It’s a developers best friend. Linux is an operating system that runs almost everywhere. Servers, PC’s, cell phones, etc… It’s usually free too.
What is a “file system”?
A file system is the part of an operating system that decides where stuff goes. It provides the processes for storing and receiving data. File systems can differ between operating systems. For example the file system for Windows is very different from the file system on OSX.
What is the “Linux file system”?
The Linux file system is the unique set of characteristics and processes that govern accessing and storing content while using the linux operating system. Linux has many different flavors (or distributions) and as a result the file system can differ slightly on each. In general the file system is roughly the same across all distributions. I’m not going into detail about the technologies that underly the Linux file system. My intention here is to give an overview of the basic layout of the root file system directories and the intended purpose of each directory.
|bin||Essential command binaries||The place where the programs/binaries that are important to your OS are stored. Things like “pwd” are stored here.|
|boot||Static files of the boot loader||Contains everything your OS needs to boot.|
|dev||Device files||Where your devices live. Your devices are treated as files in linux and will appear here.|
|etc||Host-specific system configuration||This is the folder where all of your OS’s system-wide configurations are stored like start up scripts or package manager settings|
|home||Location of user specific folders||The place where a “home” directory is specified for each user. This is where users store their personal files and documents. User-specific preferences for applications will also be present in the home directory.|
|lib||Essential shared libraries and kernel modules||This is where the libraries are stored. These libraries contain additional functionality that your existing programs may need or be built based upon. The libraries here are similar to those you’d add to your code so that you don’t have to “re-invent the wheel”.|
|media||Mount point for removable media||This is where you would find removable media that’s been mounted to your OS. Things like USB sticks, hard drives or NAS shares|
|mnt||Mount point for mounting a file system temporarily||This folder serves nearly the same purpose as the “media” folder but the media folder is managed by the OS. You’d use it if you wanted to mount devices manually.|
|opt||Add-on application software packages||This is usually where manually installed third-party software/drivers end up. Things like printer drivers could be found here.|
|proc||Pseudo files that contain info about running processes||This folder contains data about running processes. For example if you wanted to look up a processes ID or memory consumption, that data would be stored here. Similar data can be found in the system monitor.|
|root||The root users home folder||It’s not the same as a normal home folder. This the home directory specified for the root user when someone logs in or runs something as root.|
|run||Data relevant to running processes||A temporary files system that runs in ram. It’s a form of storage available to apps on your system that only need very temporary storage.|
|sbin||Essential system binaries||System binaries that would be used by an admin|
|snap||Where snap packages are stored||Mainly used by Ubuntu, Snap packages are self-contained and run differently than normal packages.|
|srv||Data for services provided by this system||Service directory where service data is stored. Usually empty unless running a server or process that requires remote access.|
|sys||A way to interact with the kernel.||Similar to the run directory in that the contents of this folder are stored in memory and must be regenerated each time the OS boots.|
|tmp||Temporary files||This directory is similar to the APPDATA directory in windows in that it is a place to keep data for a short period of time. This directory is usually written to by programs. In Windows however, the APPDATA directory can retain its values for a very long time if not cleaned. The tmp directory should be wiped after a reboot.|
|usr||Secondary hierarchy||The user application space. This is where the binaries for programs that the user installed reside. This differs from the ‘bin’ directory in that binaries stored here aren’t needed by the system for basic operation. So if you installed Ruby for example, it’s likely to end up here.|
|var||Variable data||Contains the files and directories that are expected to grow in size. This directory contains things like crash dumps and logs.|
Why is this information valuable?
This information isn’t immediately valuable. It’s one of those things that you don’t know you need to know until you need to know it. Knowing the linux file system at a high level is like knowing how to use the dewey decimal system at your local library. You may go your whole life without using the information but when you need a book and there’s no librarians around, you’ll be glad you know it. Just like with the dewey decimal system, even retaining a vague familiarity of the basic layout of the linux file system is helpful.
In the case of linux, the value of this information will become apparent for most people when trying to fix/setup something.
If you’d rather watch this content instead of reading it, I found a very succinct youtube video that covers this. Check it out: Video link: https://www.youtube.com/watch?v=HbgzrKJvDRw