Linux File System: Part 1

September 5, 2009

You just moved over from Window and are now working with Ubuntu.  The only problem is that you have no idea how the file system is laid out.  In Windows you know that there are partitions D:\ (usually the recovery partition/drive) and C:\ (which acts like the main partition/drive).  Even further, these partitions are visible when you boot up your computer so you don’t have to worry about mounting them.

Now as for a Linux system, EVERYTHING IS A FILE!!! (and if it isn’t a file it’s a process).  Directories like /home (similar to C:\Users\[user name] in Windows) is just a special kind of file, that contains “pointers” do it descendants.  At this point I should mention that in Linux the file system is set up like a tree, with root node /.  Those of you that are familiar with working in DOS will have to get use to using / to navigate between directories and not \.  Really it’s not that hard to do, but does take some getting used to.  And if you are going to say “Why does Linux not adhere to the standard?” Just remember that Linux is based off of Unix which has been around much longer than Windows.  Additionally Windows doesn’t have a great track record when it comes to adhering to standards (IE for example).  Something else to keep in mind is that file names are case sensitive.  That means that THIS.txt is different from tHiS.txt or This.txt and even this.txt.  In Windows this isn’t the case (Thanks Kevin telling me this.  I always entered file names as if they were case sensitive when working with Windows.)

Remember earlier when I said that under Windows you don’t have to mount drives/partitions once you boot up the system?  Well under Linux you don’t have this convenience.  However, there are some advantages to this set up, so you shouldn’t cry too much.  For instance the /usr (the file that contains most of the system executables, I’ll talk about this more later) can be mounted from another computer on your network and everything will work just fine.  Just try moving the folder C:\WINDOWS to another location (have fun fixing your registry errors if you actually do this by the way).  The reason this will work under Linux is because it will still see /usr as a local directory that’s part of the local directory structure.

It is finally time to talk about the different parts of the Linux file system. To see what the directories under / are just go to that directory and enter ls -p. The entries with a / after them are directories, everything else is just a regular file.
On my system the list of directories is:

/bin /boot /dev /etc /home /initrd /lib /lib32 /lost+found /media /mnt /opt /proc /root /sbin /srv /sys /tmp /usr /var

The /lib32 directory seems to be special to 64-bit machines so I won’t be talking about it. However, I figure that it is similar to /lib, but provides support for 64-bit systems.

In part 2-and part 3, if it is needed, I will discuess each of these directories.  Nothing too detailed but it should provide you with a good starting point.