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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.