Links

Do you have a nickname? When you are at work, you might be called Mr. Smith. When at the ball field, you might be Shorty, and when with your mate, you might be Sweetie. These monikers all refer to the same thing: you.

Similarly, files can have multiple names. When you create a file and give it a name, you create a hard link to the file. Note the link count field in the following example. The link count field appears immediately after the permissions. It contains a 1, indicating that currently only one hard link exists to the body of data represented by the file's name:

$ ls -l stats
-rw-r--r--   1 obrien   guest        629 Nov  2 00:54 stats

In addition, the ln command can be used to create more hard links to the same file.

The following example ...

Get Korn Shell Programming by Example now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.