Links

Links are pointers between files. With links, you can have files exist in many locations and be accessible by many names. There are two types of links: hard and soft.

Hard links are names for a particular file. They can only exist within a single directory and are only removed when the real name is removed from the system. These are useful in some cases, but many users find the soft link to be more versatile.

The soft link, also called a symbolic link, can point to a file outside of its directory. It is actually a small file containing the information it needs. You can add and remove soft links without affecting the actual file.

Links do not have their own set of permissions or ownerships, but instead reflect those of the file they point to. Slackware uses mostly soft links. Here is a common example:

   $ ls -l /bin/sh
   lrwxrwxrwx   1 root     root     4 Apr  6 12:34 /bin/sh -> bash
   

The sh shell under Slackware is actually bash. Removing links is done using rm. The ln command is used to create links. These commands will be discussed in more depth in Chapter 10.