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
Relieve your stress, back, neck and sciatic pain through 1,782 acupuncture points for immediate neck pain relief. Made for lower, upper and mid chronic back pain treatment, and improves circulation, sleep, digestion and quality of life.$$ Check price
Command Line Kung Fu is packed with dozens of tips and practical real-world examples. You won't find theoretical examples in this book. The examples demonstrate how to solve actual problems. The tactics are easy to find, too. Each chapter covers a specific topic and groups related tips and examples together.$ Check price