Information Technology Reference
In-Depth Information
From the point of view of the le system, a le's data is just an array of un-
typed bytes. Applications can use these bytes to store whatever information
they want in whatever format they choose. Some data have a simple structure.
For example, an ASCII text file contains a sequence of bytes that are interpreted
as letters in the English alphabet. Conversely, data structures stored by appli-
cations can be arbitrarily complex. For example, a .doc files can contain text,
formatting information, and embedded objects and images, an ELF (Executable
and Linkable File) files can contain compiled objects and executable code, or a
database file can contain the information and indices managed by a relational
database.
Directory. Whereas a file contains system-defined metadata and arbitrary
data, directories provide names for files. In particular, a directory is a list of
Definition: directory
human-readable names and a mapping from each name to a specific underlying
file or directory. One common metaphor is that a directory is a folder that
contains documents (files) and other folders (directories).
As Figure 11.2 illustrates, because directories can include names of other
directories, they can be organized in a hierarchy so that different sets of asso-
ciated files can be grouped in different directories. So, the directory /bin may
include binary applications for your machine while /home/tom (Tom's \home
directory") might include Tom's les. If Tom has many les, Tom's home di-
rectory may include additional directories to group them (e.g., /home/tom/
Music and /home/tom/Work .) Each of these directories may have subdirectories
(e.g., /home/tom/Work/Class and /home/tom/Work/Docs ) and so on.
The string that identifies a file or directory (e.g., /home/tom/Work/Class/
OS/hw1.txt or /home/tom ) is called a path. Here, the symbol / (pronounced
Definition: path
slash) separates components of the path, and each component represents an
entry in a directory. So, hw1.txt is a file in the directory OS ; OS is a directory
in the directory Work ; and so on.
If you think of the directory as a tree, then the root of the tree is a direc-
tory called, naturally enough, the root directory . Path names such as /bin/ls Definition: root directory
that begin with / define absolute paths that are interpreted relative to the root
Definition: absolute path
directory. So, /home refers to the directory called home in the root directory.
Path names such as Work/Class/OS that do not begin with / define relative
paths that are interpreted by the operating system relative to a process's current
Definition: relative path
working directory .
So, if a process's current working directory is /home/tom ,
Definition: current
working directory
then the relative path Work/Class/OS is equivalent to the absolute path /home/
tom/Work/Class/OS .
When you log in, your shell's current working directory is set to your home di-
rectory . Processes can change their current working directory with the chdir(path) Denition: home directory
system call. So, for example, if you log in and then type cdWork/Class/OS ,
your current working directory is changed from your home directory to the
subdirectory Work/Class/OS in your home directory.
 
Search WWH ::




Custom Search