These classnotes are depreciated. As of 2005, I no longer teach the classes. Notes will remain online for legacy purposes

UNIX01/Exploring The Root File System

Classnotes | UNIX01 | RecentChanges | Preferences

If you take a look at the root directory by doing an "ls -l /" you may see something like the following:

 [hart@einstein temp]$ ls -l /
 total 208
 drwxr-xr-x    2 root     root         4096 Jul  1 16:22 bin
 drwxr-xr-x    3 root     root         4096 Jul  1 16:35 boot
 drwxr-xr-x   20 root     root       118784 Jul  9 14:42 dev
 drwxr-xr-x   89 root     root         8192 Jul  9 14:42 etc
 drwxr-xr-x    7 root     root         4096 Jan 24 16:52 home
 drwxr-xr-x    2 root     root         4096 Jan 24 16:52 initrd
 drwxr-xr-x   11 root     root         4096 Jul  1 16:34 lib
 drwxr-xr-x    2 root     root        16384 Jan 30  2002 lost+found
 drwxr-xr-x    2 root     root         4096 Jan 27 21:22 misc
 drwxr-xr-x    7 root     root         4096 Jan 24 16:52 mnt
 drwxr-xr-x    3 root     root         4096 Jan 24 16:52 opt
 dr-xr-xr-x   80 root     root            0 Jul  9 07:41 proc
 drwxr-x---   32 root     root         4096 Jul 10 11:47 root
 drwxr-xr-x    2 root     root         8192 Jul  1 16:32 sbin
 drwxr-xr-x    3 root     root         4096 Sep 18  2002 tftpboot
 drwxrwxrwt   19 root     root         4096 Jul 11 15:58 tmp
 drwxr-xr-x   20 root     root         4096 Jul  1 14:14 usr
 drwxr-xr-x    8 root     root         4096 Jul  1 16:11 usr1
 drwxr-xr-x   25 root     root         4096 Jul  1 15:11 var

We will now examine some of the most common directories you will find in most UNIXes.

The /bin Directory

This directory contains the binaries or executable programs which are needed to start the system and other essential system functions. This directory holds programs that all users will need to access in order to use the UNIX box.

For example, you will usually find the various shells in /bin (such as /bin/sh and /bin/tcsh). You will also find most of the command line utilities which we have mentionned thus far in there (such as /bin/ls, /bin/ps and /bin/cp).

The /boot Directory

This is the directory that normally contains the boot-loader for the machine and the operating system kernel.

The /dev Directory

Files in the /dev directory reference system devices. They access system devices and resources such as hard disks, the mouse, printers, consoles, modems, memory, floppy disks, ethernet cards, and the CD-ROM drive. UNIX systems include many device files in the /dev directory to accomodate seperate devices attached to the computer. These device files are divided into major classifications:
    • block types: which indicates that the device transfers data as a block of characters
    • character types: which indicates that the device transfers data as a serial flow of characters.

Explanation of some of the items in this directory can be found at the bottom of page 43 in the book. (Look at it now).

The /etc Directory

The /etc directory contains configuration files for the system and system resources (such as services). Most of this directory is reserved for the system administrator and contains files critical to the operation of the system.

We will examine the contents of this directory in gratuitous detail as the rest of these courses proceed, but you can see a preview of the contents of /etc on page 44 of the book (Look at it now).

The /lib Directory

This directory houses kernel modules (which are like drivers for the Linux kernel), security information, and shared libraries for the entire system.

The /mnt Directory

This is where you can have additional mount points for other filesystems and devices. You will usually find the mount points for the CD-ROM and floppy drives here. NOTE: Some UNIX and Linuxes do not use the /mnt directory structure.

The /proc Directory

This directory does not actually exist on your hard drive. It is what is known as a virtual file system and exists in system memory only. Files in the /proc file system refer to the various processes running on the system. When you issue the 'ps' command, it reads its information from /proc.

/proc has many powerful uses and features which we will touch on in this course, and will return to examine in more detail in UNIX03.

The /sbin Directory

This directory contains binaries and executables for system administration. Typically, you will not have normal users running programs found in this directory.

The /tmp Directory

Many programs need a temporary place to store data while processing. The traditional location is the /tmp directory.

The /var Directory

We have already seen a glimpse at one of the uses for this directory tree, as a place for storing system logs. But it also stores things like spool files (such as mail and printer spool files) and may even store web-sites on some web-servers.

The /usr and /opt Directories

Underneath the /usr directorie is typically another directory tree mirroring the root directory. There you may find
 /usr/bin
 /usr/etc
 /usr/lib
 /usr/sbin
 etc.

which will contain other executables, configuration files, libraries, etc. The purpose of the /usr directory is to store additional programs, configurations, libraries, etc that are not critical for system functioning, and are instead considered "supplimental" or "user" applications.

As an example, a Word Processor or Office Suite would typically go in here. You will also find things like system-wide icon sets, fonts, and other media.

The one problem arises in a difference of opinion between UNIX system administrators. Some admins prefer the directory /opt instead of /usr. Typically, these admins also prefer /opt to be more "freeform" (similar to what you have under Windows), which can really confuse things. Sometimes, these admins are also application developers who make /opt the "default" installation location for their programs (the most notable one is Open Office, which installs in the awful /opt/OpenOffice.org directory by default.)

Thus, it can be very easy for a UNIX or Linux install to get out of hand with a sysadmin who does not take care to keep things installed consistantly. Obviously, if you have half of your user applications installed in /usr and half in /opt, maintenance can get pretty difficult.



Classnotes | UNIX01 | RecentChanges | Preferences
This page is read-only | View other revisions
Last edited July 12, 2003 7:06 am (diff)
Search:
(C) Copyright 2003 Samuel Hart
Creative Commons License
This work is licensed under a Creative Commons License.