Links are very similar to shortcuts, which many of you may be familiar with. They allow files to have multiple identities across the filesystem.
There are two types of links - hard and symbolic links.
A hard link is an additional name for an existing file.
To create a hardlink, simply use the
Let's demonstrate this by an example.
$ echo 'Testing' > sample.txt $ ln sample.txt sampleHardLink.txt $ cat sampleHardLink.txt
The first line simply takes the word Testing and outputs it to a newly created file called sample.txt. The second line creates the hard link, and the third line uses the
more command to output the file contents of sampleHardLink.txt. We'll learn about the
echo command and redirections (
Now if I go edit sampleHardLink.txt, the changes will also show up in my sample.txt file. Note that I can place the hard link anywhere I'd like on my file system.
A symbolic link is actually very closely related to hard links, with added improvements.
To create a symbolic link, use the
$ ln -s targetFileOrDir linkName
Try experimenting with hard and soft links own your own to get a feel for their differences and features.
To remove any existing links or files associated with a link, use the
Stretch out your back and relieve your back muscles with inversion therapy. This device counteracts the forces of gravity on the body by decompressing and elongating the spine. By using this product just ten minutes a day, you can be well on your way to improved circulation and posture while relieving muscle aches, back pain and stress.$$ Check price
In this completely revised second edition of the perennial best seller How Linux Works, author Brian Ward makes the concepts behind Linux internals accessible to anyone curious about the inner workings of the operating system. Inside, you'll find the kind of knowledge that normally comes from years of experience doing things the hard way.$ Check price