The Rest of the Directory Structure
Your home directory is just one part of the entire FreeBSD directory structure. Outside of your home directory, FreeBSD has a complex, but well organized, set of directories. As a normal user, you cannot make any changes to any directories or files outside of your home directory (with certain exceptions, which are not important right now). However, you will access files located outside of your home directory structure on a very regular basis because this is where most of the programs you will be working with are located.
Like most modern operating systems, FreeBSD uses a hierarchal directory structure known as a tree structure. You are probably familiar with this term from Windows. If not, it gets its name from the fact that if visualized, the directory structure looks like an inverted tree with the highest level directory (the root directory) at the top (the root of the tree), and all other directories branching off the root directory. Figure 3.1 shows some levels of the FreeBSD directory tree. The levels given in the figure are explained next.
Figure 3.1 FreeBSD directory tree. Notice where your home directory is located on the tree.
The directory at the top of the tree in Figure 3.1 is known as the root directory. It is represented by a single slash (/). All other directories are subdirectories of the root directory. An absolute directory path is written with each directory separated by a forward slash, going all the way back up to the root directory. For example, the directory /usr/bin indicates the directory bin, which is a subdirectory of the directory usr, which is a subdirectory of the root or top level directory /. Table 3.1 lists the purpose of the directories shown in the tree.
Table 3.1 Purpose of Directories Shown in the Tree of Figure 3.1
Directory |
Purpose |
/ |
The top-level root directory. Primarily serves as a container to hold the entire file system. |
/boot |
Containsfiles necessary for starting the system, including the kernel. |
/bin |
This directory contains programs that are part of FreeBSD, including the commands for creating and deleting directories, and so on. |
/etc |
Configuration scripts that control the behavior of the system. Also data files that store user information such as passwords. |
/usr |
Programs and directories generally accessed by normal users. |
/usr/local |
Programs and configuration files specific to the local system. This generally refers to third-party software installed that is not part of the base FreeBSD install. |
/home/username |
This is where users' home directories are stored, where username is the name of the user who owns the directory. I introduced the home directory earlier in this hour. |
/var |
This includes files that vary in size. Common things that are stored here include directories to hold print jobs waiting to be sent to the printer, Web server log files, and email directories. |
Table 3.1 (and the tree in Figure 3.1) does not show all the directories, but it does show some of the more important ones to give you an idea of how the directory tree looks and works. If Table 3.1 is about as clear as mud to you right now, don't worry. Each of these directories will be explained in full when we deal with them later in the book.