Basic Lesson 2: A Home of Your Own

By Ed Hurst | Posted at 1:20 AM
As Ed Hurst continues his Clueless Computer User's Guide to Open Source, Ed explains something very important everyone should know about GNU/Linux and UNIX: where your files go in those systems. While all of the differences may seem confusing at first, Ed lays them out in an easy to understand fashion so that you can start using Free Software operating systems productively quickly.

Basic Lesson 1 explained files and permissions. On modern Open Source computer systems, which are based on the design of older commercial Unix systems, you can create files that you own, and only root can read them without your permission. Here in Lesson 2, we answer the question: Where will your files be?

Note: the terms folder and directory mean the same thing. That's because "files" on a computer's hard drive are just a collections of electro-magnetic charges held in a pattern. Their actual location is of little interest to most of us. What we need to know is where they are "located" logically. The system at its lowest level gives associations to these collection of electro-magnetic charges so that the system can allow you to "see" the file in a "location" within a folder or directory. If you "move" a file, all you've actually done is given the file a different association.

Most PCs you buy come with an operating system. We refer to that as the system "bundled" with the PC. Bundled PC operating systems allow any user to create or move files just about anywhere they please. The permissions of the various folders and directories are wide open. If you feel like keeping your pictures in the Systems Folder, there's little to stop you, in spite of it being a very bad idea. Mucking around in your Systems Folder can destroy your operating system.

Open Source systems prevent this sort of chaos. While most operating systems, by default, allow you to log on, and they assume you will be working on files in a directory of you own, only advanced multi-user systems are designed with permissions that limit what you can do. This protects the system from corruption, and prevents you from accidentally putting dangerous files outside your own part of the system.

That area you own is called your home. You have a home directory with your name on it. It is the one place on the system where you can do pretty much as you please. You or root can lock any other user out of your home directory. That's because directories have permissions, too. From your user account, you cannot read anything in root's home directory.

On the rest of the system, the ordinary user would usually not have much freedom beyond reading the files, and executing some programs. Most programs use supporting files called libraries ("libs" for short). These are arranged according to a logical order, based on their use, in different places within the system's file structure. Furthermore, most programs have to have special instructions so that they don't attempt to do things you don't want. These are called configuration files ("config files" for short). You would naturally have to be free to read both of these, up to a point, in order to run the programs you need to run.

On most systems, there is also a place called the temporary directory where a lot of stuff is put that can't be used after you log out, or after the machine is shut down. Most any user is allowed to write files in that directory -- that is, the programs they are allowed to use write files there.

Just like all computer systems you are likely to have seen, the entire system of files has a structure. There is the base directory, which on most Open Source systems is called the root directory -- not to be confused with the root user. There aren't likely to be any files there on Open Source systems, just a number of directories under it. As you descend deeper into a directory, and its sub-directories, you are likely to see your "location" noted by names and slashes -- forward slashes.

For example, if your user's name is "bonk," then you might find your home folder with the notation: /home/bonk. That means: the bonk folder, which is inside the home folder, which is found in the root folder. The folders are logically structured in trees that branch out from the root. The root of the file system is usually notated with a simple slash -- / -- and the first slash in every location notation is that one. It's a little confusing at first, because there are more slashes, but you'll get used to it. Sometimes there is a short abbreviation for your home directory: the tilde symbol --  ~ .

On bundled systems, you often need to clean up your hard drive by running a utility that reorganizes the files. During normal use, the files are created and destroyed, and the place they occupied on the drive is left empty. Changes you make to an old file might have no room on that particular spot on the drive, so the file is split in two or more physical locations. The files are said to be fragmented. The system does alright keeping track of everything, but fragmented files take longer to open. Open Source systems don't do this. They are constantly checking for gaps and fragments, and moving them around until it all matches neatly. It does this in the background, when it's not busy with something else.

Drives are never named with letters in Open Source, at least not the way they are with bundled systems. There is no "C" and "A" and so forth. The reason for that is partly because older commercial systems might have a large number of hard drives. It would be less confusing if the system worried about all that physical structure, and users just concentrate on logical structure. Files on what we call removable media -- floppies, CDs, etc. -- are mounted specifically. The system is more stable if it is specifically told they are there, because of that constant background checking we mentioned above. It won't do to tell the system "check to see if there's a floppy in the drive" every time you want to read from it or write to it. That's a waste of resources. When you take it out of the drive, you first need to tell the system to unmount the drive. Otherwise, some file moving it planned to do later won't be done, and your changes will be lost.

Oddly, Open Source systems treat the Internet as just another file system. For dialup users, it's a file system that can be mounted and unmounted rather easily. For the most part, the heart of the modern Internet -- the so-called "backbone" -- is controlled by a group of computers that work much like Open Source operating systems. Many of those computers actually run Open Source, itself. This means that your Open Source computer speaks the same language. When you go looking for a website on the Internet, you will see fewer mistakes for that reason. Sadly, way too many systems connected to the Internet do not speak that clear language, and many websites will be hard to read. Some will even refuse to let you on their websites. These computers run the same stuff as comes bundled on PCs, a system that doesn't usually act the same as the rest of the world.

Perhaps if more of us run Open Source computer systems, things will change.



Ed Hurst is Associate Editor of Open for Business. Ed is also the Music Director for Grace Baptist Church of Kickapoo Creek, Texas. He loves computers, runs GNU/Linux and reads all sorts of things. You can reach Ed at ehurst@ofb.biz.