What is a file?

Last revision August 3, 2004

Table of Contents:
  1. The Unix file system
  2. The directory tree
  3. File ownership and permissions
  4. Files as units
  5. Examining file contents
  6. Other commands
  7. Standard Files and Data Pipes

A file includes:

Data contents - stream of bytes - stored somewhere on the disk.

Administrative data called an "inode" which uniquely identifies where the data is stored and what its characteristics are (owner, date, etc); but the name of the file is not stored as part of the inode. Important data stored in the inode includes:

  • location of the data blocks on the disk
  • length of the file (number of bytes)
  • creation/modification/last access dates and times
  • user and group ownership
  • permission settings

The name is not stored as part of the file. No file knows its own name. The name is simply a reference (or link) to an inode. This name is stored in a special file called a directory.

  • This makes the hierarchical structure possible.
  • Also allows multiple links (names) to the same file.
  • Regular hard links must all be in the same directory, and refer only to plain files (not other directories).
  • Symbolic links can span directories or refer to other directories. These act like one-way trap doors to get into a file or directory from a different place. Symbolic links are similar to file aliases in the Macintosh and Windows operating systems.

There is no concept of file type or file creator stored with the file. Programs interpret the contents of the file as they desire and any program can access any file. When using file shares on a Unix server to store Windows PC or Macintosh files, the filename extension (such as .doc or .xls) is retained as part of the filename on the Unix server, but it has no special meaning to Unix programs. It only has meaning to the PC or Macintosh that accesses the file.

<--Previous Overview Next-->

Comments or Questions?