Files are stored on devices such as hard and floppy disks. The details of
how this may be done is considered in a later
lecture.
The O/S defines a
file system on
the devices. Many O/S use a
hierarchical file system:
A directory is a file that keeps a list of other files. This list is the set
of children of that directory node in the file system. A directory cannot hold
any other kind of data.
On MSDOS a file system resides on each floppy or partition of the hard disk.
The device name forms part of the file name.
On Unix there is a single file system. Devices are
mounted into this file system.
(Use the command mount
to see this.)
To locate your position as a user of the file system, there is the concept
of your
current working directory.
Unix only has one working directory per
user. MSDOS has one per device.
MSDOS maintains a current file system (drive).
Unix has a per user home directory.
You can change the current working directory by using the command
cd new-directory
An individual node of the file system has its own name. Naming conventions
differ between O/S's. In MSDOS, a name is constructed of upto 8+3 characters.
Windows95 uses tricks on top of the MSDOS file system to give ``long
file names'' of upto 255 characters.
In ``standard Unix'' (POSIX) a name may consist of upto 256 characters.
The full file names are constructed by concatenating the directory names
from the root down to the file, with some special separator between names.
This is known as absolute path naming. In MSDOS, the full path name also
includes the drive name.
Example:
MSDOS
C:\expsys\lectures\search.txt
Example:
Unix
/usr/usrs/os
/usr/usrs/os/myfile
Relative naming means that files are named from some special directory:
. current directory (Unix and MSDOS)
.. parent directory (Unix and MSDOS)
~ home directory (some Unix shells)
~user
home directory of user (some shells)
Example:
Unix
~fred/../bill/dir1/./../file1
If just the name itself is given without any special prefixes (such as /, .,
.., ~) then it refers to the file in the current working directory.
An O/S - to the user - consists of the O/S itself plus a command interpreter
and a set of programs that perform common operations. This set of operations
include
-
File copying
-
File renaming
-
File removal
-
Printing a file
-
Displaying contents of a file
-
Listing contents of a directory
-
Changing directories
-
Showing current working directory
-
Making a new directory
-
Removing a directory