Why would you want to give a program more than one name? How can you move quickly through the filesystem like Star Trek’s Enterprise jumping through a “worm hole”? What good are multiple views of the files in a directory? You’ll see these things and more, as we look into Linux filesystem links.
Why would you want to give a program more than one name? How can you move quickly through the filesystem like Star Trek’s Enterprise jumping through a “worm hole”? What good are multiple views of the files in a directory? You’ll see these things and more, as we look into Linux filesystem links.
A link is similar to a shortcut on a Microsoft Windows desktop or an alias on the Macintosh: the link symbolizes a file or folder that’s located somewhere else in the filesystem. In most cases, operations on the link (such as open, read, and write), affect the file the link represents, not the link itself.
For example, the sequence of commands…
$ touch /tmp/reminders $ ln -s /tmp/reminders ticklers $ echo “Send story to my editor” > ticklers $ cat /tmp/reminders $ cat ticklers
… appends text to /tmp/reminders. Since ticklers is a link, all read and write operations on ticklers affect what ticklers points to, not ticklers itself. Links provide convenience and abstraction.
Linux filesystems have two kinds of links. And, as you’d expect from a versatile system like Linux, you can use links in some surprising ways.
Our first few sections introduce the concepts behind links. Understanding some of this can take a little time and thought, but once you’ve got it, you’ll find all kinds of uses for links! So, let’s dig in.
Two Kinds of Links
Linux has two kinds of filesystem…
Please log in to view this content.
Not Yet a Member?
Register with LinuxMagazine.com and get free access to the entire archive, including: