Unix Directories Files


Unix Directories & Files

Before I start my discussion of Unix commands, let's take a look at the structure of the Unix file system.

The directory system

Like the Macintosh file system, the Unix file system starts at the top level with a root directory, which can contain files and sub-directories. The root directory in Mac OS 9 and earlier is named after your hard disk. The root directory in Unix is named / (a slash without any other characters following it). Subdirectories below the root directory are indicated by listing them after the root slash. Each subdirectory is separated from the subdirectory it resides within by a slash.

For example, a home directory could be /Users/ronh. That means that in the root directory, /, is a subdirectory called Users, inside of which is a subdirectory called ronh.

Tips

  • On Mac OS, subdirectories are also known as folders.

  • Unix uses a forward slash (/) to separate subdirectories, not a backslash (\) as in Windows or MS-DOS.

  • I discuss the home directory later in this chapter. It is also covered in more detail in Chapter 3.


File names

There are two things about Unix file names that you should be aware of.

First, although Unix file names are normally case-sensitive, in the Mac OS Extended file system (HFS+), file names are not case-sensitive. What does this mean to you? Just that you need to be aware of the case of file names, especially if you move files to another Unix machinefor example, to a Unix Web server. Remember, on every other Unix machine in the known universe, upper- and lowercase are different. It's a good idea to pretend that this is the case on your Mac OS X machine, too.

Second, Unix file names do not normally include space characters. Although the Mac OS X Finder has no problem with spaces in file names, the underlying Unix uses spaces to separate commands, options, and operands. Spaces in Unix file names will cause you no end of grief because Unix will misinterpret them as operand separators in the commands you enter and your commands will perform unpredictably. If you need to enter a command that includes a file name with space characters, enclose the file name in single quotation marks so the system recognizes it as a single entity in the command.

Invisible files

File names that begin with a dot (.) are hidden. Programs such as the shell, mail, and editors use these files to store preferences and other data.

Note that Unix has two unusually named subdirectories, one with a single dot (.) and another with double dots (..). These are shorthand ways for Unix to refer to "the current directory" and "the directory above this one" (also called the parent directory). The Unix operating system gives these plain files special treatment, as you'll learn later in this chapter in the discussion of the cd command.

Tip

  • I explain how to include invisible files in a file list later in this chapter.




Visual QuickStart Guide. Mac OS X 10. 4 Tiger
Mac Os X 10.4 Tiger (Visual Quickstart Guides)
ISBN: 0321423372
EAN: 2147483647
Year: 2003
Pages: 301
Authors: Maria Langer

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