Another topic which really threw me for a loop when I started with GNU/Linux was: The file system. If you’re used to the ‘Program Files’ directory and having CD-ROM drives and the like automatically mount to ‘My Computer’, then you might find the GNU/Linux file system a little strange at first. Actually, the file system is one of my favorite parts of GNU/Linux – it just makes sense! First, I’m just going to quickly go over how a common microcrap file system is laid out so we can compare more easily.
Basically, windows mounts all hard drives, CD-ROM’s, thumb drives, and any other kind of mountable volume as a letter in ‘My Computer’. It used to be that your ‘A:’ drive was your floppy drive, for example. Most people know that your ‘C:’ drive is your primary hard drive where your actual working copy of windowz is installed on. All of the files required for programs to run are mainly stored in ‘Program Files’ in a folder for each program.
So if you have a program called ‘Converter.exe’, it’s most likely installed to ‘c:/program files/converter/converter.exe’. (As some of you can tell it’s been a while since I’ve touched microcrap so my syntax is slightly wrong I know.) Also, all of the files needed by the ‘converter.exe’ program are in that same folder.
This is where GNU/Linux/Unix is COMPLETELY different. Get ready to leave your head spinning for a while on this one-but it makes much more sense actually.
First, GNU/Linux doesn’t use drive letters such as the ‘C:’ drive or ‘My Computer’. Your primary hard drive, where your actual running operating system is installed, is located at a place called the root directory. The root directory is at a place called ‘/’. That is to say, at the top of your file system, the ‘highest’ you can go in any of the directories is to the ‘/’ directory.
It is similar to opening ‘C:/’ in windowz. EVERYTHING within the file system is within ‘/’. Another way to think about it, is if you opened up a file manager in GNU/Linux, and kept hitting the ‘Parent Folder’ or ‘Up One Level’ button, you would eventually get to the ‘root directory’, which is simply located at ‘/’. As a side note, I think windowz will actually take you to the desktop if you keep hitting the ‘Up One Level’ button, which is really confusing but technically incorrect, as the ‘Desktop’ directory is actually within ‘C:’! Very stupid.
Here’s a short clip to show you exactly what I’m trying to explain here…
As you can see in the video, everything within GNU/Linux falls under the root directory. So where does everything actually go then? This is where GNU/Linux shines. GNU/Linux is VERY organized compared to microcrap file systems.
GNU/Linux gives each user that will be using the computer their own directory, much like ‘My Documents’, except that is the ONLY directory you are allowed to use for your personal files. You don’t just create a new folder anywhere you want called ‘temp’ and start using it. (Well technically you can as ‘root’ – but you’re not supposed to. I’ll get into permissions in a later post)
Likewise, this file system keeps all the program data for EVERY program in one spot. It’s not like ‘Program Files’ in windows where each program has it’s own folder stuffed with all of it’s required files, libraries, drivers, documentation, configuration files, etc.
Similarly, all of the drivers, documentation & libraries used for all of those programs are all kept in their own, separate spot. Everything on your GNU/Linux file system is stored in a designated spot, based on what type of file it is. This creates a much more organized and efficient file system! When the computer needs a certain file, it knows, and you do too, exactly where that file is.
So where does this file system keep our CD-ROM and what if I plug in an external hard drive? Well technically, if you are logged in as the ‘root’ account, you can mount these devices anywhere you want in the system, but usually, ALL of these devices are mounted in a directory, usually automatically with all the modern distributions I’ve used. It will depend on your distribution as to where exactly these things are mounted, but usually it will be in ‘/media/’ or ‘/mnt/’ from my experience. They aren’t like windowz ‘drives’ – it’s just a directory. So if you plug in your Blackberry, it will be mounted as a regular folder. Here’s a video of me plugging my Blackberry to show you.
You can’t see me plug the USB cable into my Blackberry, but notice how the file manager detects it, and automatically creates a directory for it? Did you see the directories there for my CD-ROM’s?
This is a somewhat simplistic explanation, but it’s a start….
I will get into file and directory permissions in my next article in this series, but for now just understand that as a ‘regular user’ you really only have access to your one directory. You can make as many folders as you want in there though, and it works perfect for keeping all your personal files separate from everything else. The ‘root’ account as all the power, but you REALLY want to limit the amount of stuff you do while logged in as ‘root’!