Section 3.2. Filesystem Hierarchy


3.2. Filesystem Hierarchy

Like most other filesystems , the Mac OS X filesystem is conceptually a hierarchical tree-based structure that branches from a root. In the case of Mac OS X, the filesystem is rooted on the drive partition from which the system boots. In the typical case where you boot off the single partition of the hard drive that is in your machine, your filesystem is rooted there. If you have more than one disk drive, then the filesystem is rooted on whichever partition you boot from. Likewise, if you boot from an external disk drive or even a disk image on a network server, the filesystem will be rooted from there. Figure 3-2 shows a Finder window displaying the boot disk's filesystem.

The structure of the Mac OS X filesystem at the root level is very strict, and almost every file that Mac OS X needs to run has a specific place within it. Some of the folders at the root of the filesystem are visible in the Finder when you click on your boot drive; others are not.

Figure 3-2. The Finder showing the boot disk


3.2.1. The Filesystem Through the Finder

The folders at the root of the filesystem that are visible in the Finder are:


Applications

This folder contains applications that are available to all users on the system. Most applications that Apple ships for Mac OS X (such as iCal, iPhoto, and Safari) are located here. In addition, a large number of useful utility programs, such as the Terminal and Activity Monitor, are installed in the Utilities subfolder.


Developer

If you have installed the developer tools on your system, most of the applications, documentation, examples, and other files needed for building applications for Mac OS X are located here.


Library

This folder contains application- and system-specific resources, such as fonts and application preferences, that are needed by all the users on the system. In some respects, this folder is like its namesake in that it holds a lot of useful information for the various parts of the system.


System

This folder contains the resources used by the operating system itself. Mac OS X is very particular about the files in this directory and will prevent you from messing with them. It's best to consider this directory strictly Apple's domain.

File Extensions and the Finder

By default, file extensions , the part of a filename that comes after the dot, are hidden in the Finder. This means a file named DialUpNumbers.txt will appear in the Finder, by default, as DialUpNumbers. Some folks, especially old-time Mac OS 9 users, prefer this approach as they wish to look at the icon to determine what kind of file it is. Others, however, including most of us who cut our teeth on Unix, prefer to see the file extensions intact.

To make file extensions viewable all the time, use the Finder Preferences menu (-,), click on the Advanced button in the toolbar, and then click on the checkbox next to "Show all file extensions."



Users

This folder contains the Home folders for the users on the system. Within a Home folder, a user is the master of her domain. Outside a user's Home folder, the ability to make changes is greatly limited and depends on the type of user she is.

If the Classic Mac OS 9 environment is installed on your machine, you'll also see the following folders:


Applications (Mac OS 9)

This folder contains applications that aren't designed to run on Mac OS X.


Desktop Folder

This folder contains all the files and folders that are part of the Mac OS 9 desktop. This folder is useful when you boot back and forth between Mac OS 9 and Mac OS X and need to get to the files that you left on the Mac OS 9 desktop.


Documents

This is the traditional folder in Mac OS 9 for storing your documents and is placed here for convenience. In Mac OS X, you should always use the Documents folder in your Home folder instead of this folder.


System Folder

This folder contains the Mac OS 9 system and supporting files.

These folders aren't part of Mac OS X but are located at this level of the filesystem for ease of use when you boot into Mac OS 9 from the drive.

3.2.2. The Filesystem Under the Hood

The Finder's view of the filesystem doesn't reveal everything that's there. The Finder is just one view, and for most users, it is sufficient because it keeps hidden system files, sometimes known as dot files , from view. The Terminal (/Applications/Utilities), however, lets you dive beneath the pretty GUI view and see everything in the filesystem. Example 3-1 shows the output of the ls command.

Chapter 4 will give you a little bit more grounding in the Terminal. For now, just play along.


Example 3-1. The command-line view of the filesystem root
 $ ls / Applications    Network         bin             mach.sym        tmp Desktop DB      System          cores           mach_kernel     usr Desktop DF      Users           dev             opt             var Developer       Volumes         etc             private Library         automount       mach            sbin

As you can see, this is a much different view of the filesystem than you'll see in the Finder. Some of the foldersApplications, Library, Network, System, and Usersare the same as those in the Finder, but many aren't exposed. You'll see this kind of difference time and again in Mac OS X. The GUI gives you a filtered view of the system, and most of the time, this filtered view is exactly what you want. The Terminal, on the other hand, gives the raw view of the system, providing you with unfettered access to the depths of the system.

Some of the folders and files visible using the command line at this level, but hidden in the Finder, are:


Desktop DB and Desktop DF

These are the hidden files behind Mac OS 9's desktop. The Desktop folder in the Finder view uses these files to present your Mac OS 9 desktop to you while you are booted into OS X.


Network

This virtual filesystem allows you to browse the filesystems shared from servers on your network.


Volumes

This directory contains all the disks, other than the boot disk, that are attached to your computer. For example, external FireWire disks (including an iPod), as well as CDs, will show up here.


automount

This directory contains links to any filesystems mounted from network file servers using network protocols such as AFP, NFS, and SMB.


bin

This directory contains many of the executable Unix programs that your system needs.


cores

This directory contains crash files for the various Unix programs. This is the traditional location in which Unix programs write out their crash data.


dev

This directory contains the various device nodes for the system. One of the core ideas of Unix is that the various devices can be treated as filesincluding some devices that you normally wouldn't think of as being a file. The dev tree contains the "files" that represent everything attached to the operating system.


etc

This directory contains configuration files used by the various Unix components of the system.


mach, mach.sym, and mach_kernel

These files make up the kernel, the core part of the operating system that manages everything else.


opt

This directory is used to store optional Unix tools and libraries that may not be an integral or included part of Mac OS X itself. For example, Mac OS X Server places the Apache 2 web server in this folder but uses an earlier version of Apache as its default web server daemon.


private

This is the directory that actually contains the etc, var, and tmp directories. These directories actually don't live at this level of the filesystem but are linked into the root (/) directory.


sbin

This directory contains system executables needed at startup as well as some configuration utilities for the system.


tmp

This is a place for the temporary files that some Unix programs create.


usr

This directory contains the Unix tools and libraries that are intended for all users on the system.


var

This directory contains data that changes frequently such as mail spools and logfiles. The disk files that implement the backing store for virtual memory are also held here.

3.2.2.1. More hidden files

There's actually another layer of hidden files beyond what you see with the ls command. If you change the command and add an -a option (to show all files), you'll see the extra files shown in Example 3-2.

Example 3-2. Hidden files in the root directory
 $ ls -a / .               .vol            Network         cores           opt ..              Applications    System          dev             private .DS_Store       Desktop DB      Users           etc             sbin .Spotlight-V100 Desktop DF      Volumes         mach            tmp .Trashes        Developer       automount       mach.sym        usr .hotfiles.btree Library         bin             mach_kernel     var

The .DS_Store file contains the Finder settings and the comment text for the various files within the folder. The rest of these files are, well, files that you really don't need to see. They are hidden from the command-line view, which indicates that you should mess with them only if you really need to and you know what you are doing.

3.2.2.2. Opening hidden directories in the Finder

Even though the Finder hides these directories from you, there is an easy way to get to them. Simply use the Go to Folder command (Go Go to Folder, or Shift--G) and enter the path to the folder you want to see. An example of this is shown in Figure 3-3.

Figure 3-3. The Go to Folder sheet


If you want to see every file on your system all the time, you can do so by typing the following command in the Terminal:

  $defaults write com.apple.Finder AppleShowAllFiles YES

Then, either log out and log back in, or just give the Finder a few minutes to pick up the change. This seems cute at first (and some people may find it useful), but it can quickly become irritating, so you might find yourself preferring the Finder's regular view instead. To reverse this setting, use the following command:

 $defaults write com.apple.Finder AppleShowAllFiles NO

This command uses the defaults system, which is covered in more detail in Chapter 14.

If you'd rather not log back in or wait for the Finder to pick up on your changes, you can relaunch the Finder by holding down the Option key and using the Finder's Dock menu. When holding Option, a new choice will appear labeled Relaunch.





Running Mac OS X Tiger
Running Mac OS X Tiger: A No-Compromise Power Users Guide to the Mac (Animal Guide)
ISBN: 0596009135
EAN: 2147483647
Year: 2004
Pages: 166

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net