File
- File is a container for storing information.
- It stored sequence of characters,it doesn't contain the eof(end-of-file) mark like DOS files.
- A file's size is not stored in the file, nor even its name.
- All file attributes are kept in a separate area of the hard disk, not directly accessible to humans, but only to the kernel.
Unix treats directories and devices as files as well. A directory is simply a folder where you store filenames and other directories. All physical devices like the hard disk, memory, CD-ROM, printer and modem are treated as files. The below picture depicts the file structure.
The implicit features of every UNIX file system is that there is a top, which serves as the reference point for all files. This top is called
root and is represented by a / (front-slash). root is a directory. It is conceptually different from the user-id root used by the system administrator to log in.
The root directory (/) has a number of subdirectories under it. These subdirectories in turn have more subdirectories and other files under them. For instance, usr and home are two directories directly under /, while a second tim,jane,tom and julia are subdirectories are home.
Every file , apart from root, must have a parent and it should be possible to trace the ultimate parentage of a file to root. Thus, the home directory is the parent of jane, while / is the parent of home, and the grandparent of jane. If you create a file prog under jane directory, then jane will be parent of this file.
It's also obvious that, in these parent-child relationships, the parent is always a directory. home and jane are both directories as they are both parents of at least one file or directory. prog is simply an ordinary file. it cant have any directory under it.