next up previous contents
Next: Looking at an Entire Up: ``Elementary'' Commands Previous: Deleting Files (rm)

What is a File?

 

A file is a collection of bytes that has order to it, there is a beginning and an end. The beginning and end may only be symbolic, and sometimes they coincide (if the beginning and the end point to the same place, the file has zero size).

For most of us, a file is a chunk of storage on a hard disk. And a file name is a way of asking the operating system where to find the beginning of this chunk of storage. UNICES allow us to have multiple directory entries (file names) all pointing at the same chunk of storage. If they do this by saying something like:

The chunk of storage begins at location X
this is called a (hard) link. If they do this by saying something like:
The chunk of storage can be found at some/kind/of/path/name
this is called a symbolic link.

Both of these kinds of links are useful. The hard link can only be used on a common hard disk and partition, because the locations are actually numbers, distances from the beginning of the disk partition.

When we delete a file, what we are doing is unlinking the filename from the chunk of storage. It is only when the chunk of storage is not pointed to by any filenames that the chunk of storage becomes free, and can be overwritten or reused for something else. So we need to keep track of the link count for each chunk of storage, and this was mentioned earlier when we talked about the ls command.

Symbolic links can end up pointing to nothing if the filename they point to is removed.

You can probably tell that some of the file operations pointed out above operate on the name of the file (the directory entry) and some operate on the content. And sometimes it could be either the name or the content, depending on the context.


next up previous contents
Next: Looking at an Entire Up: ``Elementary'' Commands Previous: Deleting Files (rm)

Gordon Haverland
Sat Oct 9 13:50:48 MDT 1999