How to make a file appear in multiple directories
Most files appear in only one directory. However, there are ways to make a file appear in more than one place.
You can use a hard link to add a file to a directory.
For example, to make file
/u/bob/janus appear also
~/hot, use this command:
% ln /u/bob/janus ~/hot
When a file is hard-linked to multiple directories, it lives equally
in all of the directories. If it is deleted from one directory
rm command, it will still appear in the others.
ln fails with a message about a "cross-device link",
you can still get the same effect using a soft link; use the
-s option in the
ln command. For example:
% ln -s /u/bob/janus ~/hot
Soft or symbolic links are different in one important respect from hard links. You can create a soft link to a file that does not exist. If the file still doesn't exist when the link is used, you'll get the message "No such file or directory."
John Shipman, email@example.com
Last updated: 1995/12/04 19:39:34 UT