next up previous contents
Next: Types of Files Up: Beginning UNIX User's Guide Previous: Other Regular Expression Languages

File Types and Permissions

 

One of the underlying philosophies of UNIX is that everything is a file. The files in your home directory are files, directories are files, a LAN connection is a file, your keyboard is a file, your display is a file (in fact, the keyboard and display are 2 halves of a single file), all devices connected to your computer are files!

Some files are only symbols, they idealize concepts which are useful. A case in point is /dev/null, sometimes known as the bit-bucket. You can write whatever you want to it, it accepts everything. If you try to read from it, you immediately get end-of-file. An infinite dump and a zero source, a handy symbol to have around. Do you browse the web? Hate those cookies everyone sends your way? Send those cookies to /dev/null, no more problem!

So what is a file? A file is a collections of bytes, with a particular order to them. So, the minimum properties of a file are:

If the beginning of a file and its end co-incide, it has zero length.

What can a file of zero length contain? Well, by its presence it indicates a single bit of information, that it in fact exists. Beyond that, only what may be gleamed from its name. So, if you were looking for the file by name, it's existence (or lack thereof) only implies a single bit of information. If you look for this file by pattern, its name may convey a little more information.

Computers rarely operate on bytes any more, typically a computer's word size is at least 2 bytes, and may be as many as 8. Some computer architectures use word sizes that are not a whole number of bytes. And even among computers that have word sizes that are a whole number of bytes, we have 2 common differences:

The place where most of this matters is with applications involving networking. For a single computer by itself, it doesn't matter too much what bit and byte order are in effect for the various data types, as long as everything is consistent.




next up previous contents
Next: Types of Files Up: Beginning UNIX User's Guide Previous: Other Regular Expression Languages

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