A Tour of the File System

All Unix systems have certain standard directories. Although the underlying operating system doesn't care about the precise directory structure, many of the standard Unix utilities have specific directory names hard coded into their source code. Here is a list of some of the more interesting directories and what you might find in them.

There is an effort in progress to standardize the organization of the Unix file system in order to facilitate the creation of portable scripts and administrative tools. For more information see the Filesystem Hierarchy Standard at http://www.pathname.com/fhs/.

Common Unix Directories

/bin /usr/bin

Here are where all the utility programs are stored. The most commonly used programs are put into /bin. The less commonly used programs are put into /usr/bin. On some systems, /bin may be the only directory of the two available when the system is booted into single user mode.

/tmp , /var/tmp

Many programs write temporary files into /tmp. These directories are wide open to all users. Files stored in /tmp should not stay there very long.

/lib , /usr/lib

Here is where compiled library files such as the C library are stored. Also certain programs that are not normally executed directly by the user are stored here. For example, the C compiler has two passes. They are stored in /lib. The dictionary for the spell program, the macro packages for nroff, and many other things are stored in /usr/lib.

/usr/share/man

Here is where the online manual is stored. This directory contains subdirectories for each manual section. For example, /usr/share/man/man1 contains all the manual pages for section 1 in compressed form.

/usr/include

Here is where the header files used with C programming are stored. This directory is the standard place where the C compile looks when it sees header files included with the <...> notation. Notice that there are several subdirectories under /usr/include as well.

/usr/local

This directory contains locally produced items. For example, /usr/local/bin contains programs that are not part of the normal Unix distribution, but that are of interest to all users at a particular site. Also under /usr/local are directories for local administrative commands, local manual pages, and so forth.

/var

The /var directory is where "variable" files are stored. These files tend to be highly volitale and may change from minute to minute. Incoming mail, log files, and other such things are often stored here.

/var/adm

On many systems this is where various administrative files are stored. For example, account files, the shutdown log file, and the file that records information about telnet connections are stored here. On most Linux systems, /var/log contains all the log files.

/var/spool

This directory is used for spooling operations of various types. The print daemon, uucp, cron, mail and various other Unix programs that do things automatically use this directory for temporary files and work files.

/home

On some old systems, user home directories are all kept under /usr. However since there are often many home directories and since they often need to be managed with a different policy than that used by the rest of the system, most current systems store user home directories under /home. Note that in Unix each ordinary user has a personal directory for storing his/her files. Many Unix applications assume such a directory exists and expect to store all of a user's personal configuration information there. Unix does not have a "registry" in the sense of Windows.

/etc

This directory contains files and programs of interest to the system administrator. Many system configuration files are in /etc.

/dev

This directory contains the special device files. Unix treats all I/O devices as if they were files. By tradition, all such files appear in /dev.