Text-only | Table of Contents (frame/ no frame) |
(2) UNIX File System |
![]() ![]() ![]() |
pwd
-- print working directory). The current directory is initially set to your home directory ($HOME).
cd
classes
- All Unix systems have a root filesystem, mounted on /
- A file system is physically a partition of a disk, a whole disk, a logical combination of disks, a removeable device (CDROM), a remotely mounted fileserver, or possibly a virtual construction made to resemble a directory hierarchy
- File systems are mounted and become a part of the hierarchy. They are not referred to as separate entities (unlike MacOS volumes and Windows drive letters).
df
shows mounted file systems- For most purposes, you do not need to know where a file physically resides, only the pathname to it.
ls
-li
shows links.
There is only one 'real' file.
ln
-s real_file link_name
ln -s hosts1 h1
ln -s ~richard/public/sendmail mail-notes
Unix actually references all files internally using a numeric value (unique in a given filesystem). The directory itself is just a special file storing human-readable names and their equivalent identifiers (called inodes). Several features are made possible by this arrangement:
- File names can be almost unlimited length, since they aren't moved around internally
- File name lookups are very fast. Obtaining the additional information about a file takes time, (to retrieve the inode data) but simply looking up the names is fast.
- The "." and ".." entries in a directory are trivially implemented as hard links.
- Column 2 of
ls -l
output is the number of links to a file or directory- e.g.
ls -l /usr/bin/mc*
- e.g.
ls -li /usr/bin/mc*
- Creating a hard link:
The same command (ln
) is used to create hard links and symbolic links, but with no option.ln existing-file-name new-file-name
- The system call to delete a file is
unlink()
. When the link count reaches zero, the filesystem actually deletes the file.
slide02.src last modified Feb 8, 2011 | Introduction | Table of Contents (frame/no frame) |
Printable (single file) |
© Dartmouth College |