File and directory links
Links are connections between a file name and an index node reference number (i-node number), the internal representation of a file. Because directory entries contain file names paired with i-node numbers, every directory entry is a link.
The i-node number actually identifies the file, not the file name. By using links, any i-node number or file can be known by many different names. For example, i-node number 798 contains a memo regarding June sales in the Omaha office. Presently, the directory entry for this memo is as follows:
i-node Number | File Name |
---|---|
798 | memo |
Because this information relates to information stored in the sales and omaha directories, linking is used to share the information where it is needed. Using the ln command, links are created to these directories. Now the file has three file names as follows:
i-node Number | File Name |
---|---|
798 | memo |
798 | sales/june |
798 | omaha/junesales |
When you use the pg or cat command to view the contents of any of the three file names, the same information is displayed. If you edit the contents of the i-node number from any of the three file names, the contents of the data displayed by all of the file names will reflect any changes.