The ideal file-management software for both Mac and PC is DiskAid, available from www.digidna.net/diskaid. It’s free, and it can be used with or without jailbreaking. Once your file-management software has been installed, start it up while the iPhone is connected to your computer. Figure 1-18 shows the interface of DiskAid. Once the software is loaded, you’ll see the basic, “safe” media directory. The drop-down menu in the lower left will allow you to access the root directory, which has the guts of the device.
Understand the Hierarchy
Try opening up each folder and taking a look around. However, be careful not to modify any of the files until you know what they are, as you could do unnecessary damage to your phone. Of the folders, the main ones to spend some time browsing through are Applications, System, and /var/mobile. Remember that your root directory, /, is the origin of the main folders.
An important lesson in iPhone file directory browsing is to understand folder path addresses. When you see the phrase /private/var/tmp, it will help you to know that this phrase actually means to look in your / (root) directory for the private folder. Once you find the private folder, open it to be greeted by another group of folders. Look down this list to find the var folder, and open it up to see even more folders. Look through this new list to find the tmp folder, and open it. You’ve now arrived at your destination, as in Figure 1-19. All the mysterious phrase /private/var/tmp was trying to say was to just look inside the tmp folder by following the path from /private, through var, and into tmp.
Also note that in Unix, there is a feature called “symbolic links,” which is similar to aliases on Mac OS X or shortcuts on Windows. On Unix filesystems you can refer to the folder by any of its symbolic links, so /private/var and /var are effectively synonymous. In DiskAid these are symbolized by the “curved arrow” icon for directories.
Here are some brief explanations for each of the main folders in the Home or (root) directory.
This “slash” symbolizes the top of your filesystem, the root directory, simply called “root.”
Pathnames (folder/directory paths) are symbolized with this forward slash, such as /var/mobile.
Contains—you guessed it—applications. In addition to the stock iPhone applications, some of
the third-party applications that you may install will be placed in this folder. This is where you’ll
typically go for such things as customizing application icons or even modifying the program code. User-installed applications from the App Store will be installed in /var/mobile/Applications/.
Contains various preferences and frameworks, as well as the ringtone and wallpaper folders.
This is where a lot of the Mobile OS X system files can be found. The programs that customize your phone with custom graphics, carrier logos, and skins change many graphics files in this folder.
bin is short for binary, meaning simply a program you can run, usually command-line based. On an iPhone, you’ll find the various essential shell utilities and command-line programs here.
This is where core dumps are stored. When a program crashes, the OS sometimes writes a
file to disk showing the memory state of the program just before it crashed, for the purposes
dev stands for device. In Unix, almost everything is treated as a file from the programmer’s
perspective—the hard disk, network cards, and Bluetooth can all be accessed with files such as /dev/disk0.
A shortcut to /private/etc, the etc directory is traditionally where configuration files—the text files that define settings for programs—are stored.
Contains a lot of important files, including music, photos, and some email data.
This is the place for superuser binaries—programs for system administration.
The tmp directory is where temporary files used by programs are written. The expectation is that the contents of this directory are frequently deleted, like a “trash can.”
usr is intended to be for shareable, read-only data. Folders such as /usr/sbin and /usr/bin contain additional commands, and /usr/lib contains libraries of software code shared by the whole system.
A shortcut to /private/var, var stands for variable and is intended to contain variable data, such as logs, news, mail spool files and so on, which is constantly being modified by various programs running on your system. On the iPhone, it also happens to be the directory that contains much user data, originally in the /var/root directory but now stored in the /var/mobile directory.
A lot of the iPhone user’s personal data is stored here, including music, pictures, and more.
Prior to firmware 1.1.3, user data was stored here. It has moved to /var/mobile.
As you gain more experience navigating through your directory, you can begin using the other main ability offered by your browser software: modification of files and folders. DiskAid allows you to add, replace, or delete any file or folder in your directory. These abilities open your iPhone up to an all-new breed of customization options, from changing icons and backgrounds [Hack #8.02] to modifying the files that an application is based on.