next up previous contents
Next: The vi Editor Up: Beginning UNIX User's Guide Previous: File Permissions

Filesystem Hierarchy

 

There is absolutely nothing in the various UNIX filesystems that says that a certain file, or a certain kind of file, has to reside in a certain place. Which has caused a bit of discomfort in the past. This was one of the biggest differences between one version of UNIX and another. (The other big difference was between the system libraries in the BSD versus USG camps.)

But it has been noticed that this is something which should be agreed upon. The early Linux efforts along this line begot the ``Fileystem Hierarchy Standard'', now at version 2.x; and lately something called the Linux Standards Base. I am sure something similar exists in the various BSD camps.

The reason for the various parts of the filesystem stems from a few needs/observations:

Some of these miscellaneous reasons stem from things like how does one easily perform backups, especially when the entire filesystem is spread across multiple partitions and devices, and may be as large as hundreds or thousands of GB.

At one of the basic levels, it has been found that some parts of the filesystem are static (they don't change, or change very rarely), and some are variable. Another observation is that some parts of the filesystem can be relatively easily shared with other computers in a network (more so for homogenous networks than heterogenous networks), while others are very much tied to a single machine.

A couple of examples of parts of the filesystem which contain unchanging data which is machine specific are /etc (which contains configuration information) and /boot (which contains copies of boot blocks and possibly OS kernels). Examples of shareable parts of the filesystem which can vary a lot are /var/mail (network-wide mail files for users) and /var/spool/news (news files).

A general layout of the preferred Linux filesystem is as follows:

/
The root directory,
/bin
Essential command binaries,
/boot
Static files of the boot loader,
/dev
Device files,
/etc
Host-specific system configuration,
/home
User home directories,
/lib
Essential shared libraries and kernel modules,
/mnt
Mount point(s) for temporary partitions,
/opt
Add-on application software packages,
/root
Home directory for the root user (superuser).,
/sbin
Essential system binaries,
/tmp
Temporary files,
/usr
Secondary hierarchy of system files,
/var
Variable data.

As a general user, the directories you are most in need of are: your home directory ( /, $HOME), /bin, /usr/bin and /usr/local/bin. Your home directory (and any subdirectories you decide to make) are the only places (other than /tmp and /var/tmp) where you will be creating or editing files. The 3 binary directories, are the 3 locations where your systems administrator (sysadmin) makes available programs for you to run (normally).

If you are (also) the sysadmin, you have a lot of things to learn about. In the event you are also responsible for sysadmin duties, you probably should read through the FHS, and also read through your distributions documentation. There is far too much there to be covered in a beginners Linux course.


next up previous contents
Next: The vi Editor Up: Beginning UNIX User's Guide Previous: File Permissions

Gordon Haverland
Sat Oct 9 13:50:48 MDT 1999