Unix File Organization

In Unix, the entire file system is a rooted tree. In VMS, the users own directory seems to be an isolated space and access to other spaces is generally forbidden. In Unix, many of the system directories are readable by all users and it is fairly simple to find out which directly contains the file which executes a normal command.

/bin most frequently used standard utilities
/usr system files, and the games directory.
/usr/bin less frequently used standard utilities, possibly some non-standard ones.
/dev files associated with devices. Each terminal, printer, disk, and the main memory has a file-name here.
/etc miscellaneous system files, including passwd
/tmp holds temporary files generated by many programs

Directories may contain both individual file-names and other directories. Each directory can exist in only one other directory, so that a clear chain of directories is always present in any path. A directory or file having the same name as another directory or file is not physically the same file just because the name is the same. Such files are distinguished by being on different paths, just as we can differentiate between two people named Mary Smith by naming their parents or grandparents.

However, one physical file may have names (the same or different ones) in several directories, including directories belonging to different users. A file-name is specified by giving the complete path from the root on down:

/users/whose/projects/proj1/data/thisfile

Fortunately, there are a few shortcuts. If the user has done a cd projects/proj1/data command, so that the current working directory is data, the file may be used as thisfile. Also, .. is a special file-name for the directory just above the current one, and . means the current directory ~ means the user's home directory. ~user2 means the home directory of user2.

.filename A file name beginning with a period (such as .cshrc) does not show in a normal directory listing. This allows you to keep files which you run in a directory, without having to see them listed. To see a listing of all files in a directory, including those with names beginning with . use ls -a. Files beginning with . are often called invisible files.
cd / will take you to the root directory, and make it your current working directory.
cd ~ or cd will take you to your home directory.
cd ~/other will take you to the directory other, a subdirectory of your home directory. This works no matter what your current working directory is.
cd ../that will take you to the directory that, a subdirectory of the parent of your current working directory. In other words, that is a sister of your current directory.
cd ../that/zip will take you to the directory zip, a subdirectory of the that directory. that is a sister of your current directory.
cd /usr/bin will take you to local, a subdirectory of users, which is a subdirectory of root

Note that a path beginning with / ( an Absolute path) starts looking in root. A path that does not begin with a slash (a relative path) starts looking in the current working directory. (A relative path is "relative" to the current working directory.)

Files you automatically have In your directory

When you first sign on, you will find that an ls -a directory listing shows some invisible files in your home directory. These files are supposed to be there. They set up various things for you so that you can have access to the files you need to get at, and such things. Do not delete them. Be very careful about making changes to them, being sure to keep a back-up copy which you can mv back to the original name if you goof badly.

.cshrc sets things the tcsh needs to know
.history keeps a log of the last commands you entered; the number of commands is set in .login
.login runs automatically to set terminal characteristics, aliases for easy use of mail, and the environment.
.profile setup if you use sh as your login shell; default shell is csh on this machine


Previous Page
Index
Next Page