Directories

O Directories

  1. Directory Structure
  2. File Names and Paths
  3. Extensions and Suffixes
  4. System Directory Structure

Directories

Directories are files with a strictly prescribed internal structure, for they must be understood by numerous system routines. There is no physical difference between a directory and any ordinary file. Every directory is itself a file, stored on disk like any other file.

The directory itself is listed as a directory entry with . (dot or period) assigned to it. This entry is conventionally included because it simplifies system operations such as calculating how much unused space is left on the disk.

Directory Structure

Each user has a personal directory and this directory as an entry of user directories, which in turn is listed as an entry in a system directory. At the top of the directory is the root directory which is maintained by the system. The structure of the directory is in the shape of a tree and the root directory is the root. Every directory must be listed in exactly one, and only one directory preceding it. There are two entries that appear in every directory. The first one, . (the dot) refers to the directory itself. The second one is .. (two dots) refers to the parent directory in the tree structure. There is a tree structure rule--every directory must be listed in exactly one preceding directory to prevent circular listings.

File Names and Paths

A file can be accessed by specifying its path using the directory tree. The pathname is the full name of the file including the directory of where the file is located. Subdirectories are separated by a slash so a typical path looks like this:

dir1/dir2/dir3/.../filename

Files not listed in the subdirectories are usually found in the user's root directory.

For example,

/home/smith/filename

The file called "filename" is located in the user smith's home directory.

./filename is equivalent to /home/smith/filename

Extensions and Suffixes

Ordinary files are sometimes given a one character suffixes, separated from the file name by a dot as in program1.c which is a program written in C language.

Suffix Type of File
.a archives (often of system data)
.c C language source files
.d data files for utility programs
.f Fortran language source files
.h data files for system services (headers)
.i C preprocessor output (C source) files
.o relocatable object files
.p Pascal language source files
.r Ratfor language source files
.s assembler language source files
.z compacted files produced by pack

Previous Contents Next