A Larger Picture of the Filesystem

Every operating system has a method of storing its files and directories so that it can keep track of additions, modifications, and other changes.

In Linux, every file is stored on the system with a unique name, in directories which can also hold other files and directories (or subdirectories).

You might think of the system as a tree-like structure, in which directories "branch off." Those directories may contain, or be the "parent" of, other directories which may hold files or directories of their own.

There would not be a tree without a root, and the same is true for the Linux filesystem. No matter how far away the branches, everything is connected to the root, which is represented as a single forward slash (/).

Red Hat Linux uses the term "root" in several different ways, which might be confusing to new users. There is the root account (the superuser, who has permission to do anything), the root account's login directory (/root) and the root directory for the entire filesystem (/). When you are speaking to someone and using the term "root," be sure you know which root you are talking about."

NoteWhat is the FHS?

Other Linux distributions exist, and your Red Hat Linux system is probably compatible with them because of the Filesystem Hierarchy Standard (FHS). The FHS guidelines help to standardize the way system programs and files are stored on all Linux systems.

To read more about the FHS, turn to the chapter on system administration in the Red Hat Linux Reference Guide. You can also visit the FHS website: http://www.pathname.com/fhs.

As long as you are logged into your user account (which will help prevent disastrous mistakes), it might be helpful to take a look around.

First, take a look at the root directory. This will help give a larger picture of where things are.

At the shell prompt, type:

cd /

You will see a prompt that looks like:

[newuser@localhost /]$

Now, take a look at which directories "branch off" the root directory by typing:


This is a little like viewing the tip of an iceberg. The directories you see are the parent directories of other directories, in which there may be other directories, and so on.

Figure 11-7. A View of the Directories from Root

Here are just a few of the directories you are likely to find:

etc     lib     sbin
usr     var

There are more, but for now, take a look at the /etc directory.

[newuser@localhost /]$ cd etc
[newuser@localhost /etc]$ ls

Here, among other things, you will find configuration files, which are files that help make programs work for your system, store program and system settings, and more.

Among the directories in here, you will see /etc/X11, which also contains directories and configuration files for the X Window System.

In the directory /etc/skel, you will find skeleton user files, which are used to populate newly created user accounts with standard, commonly used files.

What is a skeleton file? Well, when you were logged in as root, one of the first things you did was create a user account. When that user account was created, files were taken from /etc/skel and placed into the new account. The /etc/skel files are the standard files needed by every new account.

Look around a little in the /usr directory. From your current location in /etc/skel, type:

[newuser@localhost /skel]$ cd /usr
[newuser@localhost /usr]$ ls

If you forgot, cd /usr moves you to the /usr directory and ls lists the files in that directory.

In /usr, you will see a number of directories that hold some of your system's most important programs and files (see Figure 11-8).

Figure 11-8. Typing ls in /usr

In /usr/share/man, you will find the system manual pages; other documentation that is not covered by man pages will be found in /usr/share/doc and in /usr/share/info.

In /usr/X11R6, you will find files related to the X Window System, including configuration and documentation files.

In /usr/lib you will find files which are considered libraries for your system. Libraries contain commonly used code that can be shared by many programs.

Red Hat Linux uses the RPM technology of software installation and upgrades. Using RPM, either from the shell prompt or through Gnome-RPM, is a safe and convenient way to upgrade or install software. For more information about using Gnome-RPM, see the Official Red Hat Linux Customization Guide.

Once you become more comfortable with your system, you may want to install software not available in RPM format. To minimize collisions with RPM-managed files, the best place to put such software is in /usr/local.