<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"><channel><title>Tech-Recipes - Latest Comments in Create a hard link in UNIX | UNIX | Tech-Recipes</title><link>http://tech-recipes.disqus.com/</link><description>Cookbook of Tech Tutorials</description><language>en</language><lastBuildDate>Sat, 01 Nov 2008 12:24:15 -0000</lastBuildDate><item><title>Re: Create a hard link in UNIX | UNIX | Tech-Recipes</title><link>http://www.tech-recipes.com/rx/173/create-a-hard-link-in-unix/#comment-3431513</link><description>Removing the original file will not destroy the linked file, and therefore the information is not lost. The contents only disappear when all links have been removed</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">karelc</dc:creator><pubDate>Sat, 01 Nov 2008 12:24:15 -0000</pubDate></item><item><title>Re: Create a hard link in UNIX | UNIX | Tech-Recipes</title><link>http://www.tech-recipes.com/rx/173/create-a-hard-link-in-unix/#comment-2767073</link><description>I have a hard link in Windows Explorer on XP home edition.  How do I delete it?  (In laymen's terms)</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Anonymous</dc:creator><pubDate>Thu, 24 Mar 2005 07:39:20 -0000</pubDate></item><item><title>Re: Create a hard link in UNIX | UNIX | Tech-Recipes</title><link>http://www.tech-recipes.com/rx/173/create-a-hard-link-in-unix/#comment-2767072</link><description>There is another very cool usage of this found at this place : &lt;a href="http://bulma.net/body.phtml?nIdNoticia=2012" rel="nofollow"&gt;http://bulma.net/body.phtml?nIdNoticia=2012&lt;/a&gt; . Actually some programs create a different inode from a hardlinked file if you modify the file; for example patch, or vi (if you had previously "set bkc=no") create a new inode when working on these hardlinks. &lt;br&gt;So imagine you are compiling a kernel, trying different patchsets. You dont want to make many "real" copies of the same files, as it takes lot of space and time to do so. Then you could just do hardlinks to the files. And then, only the modified files will actually exist:&lt;br&gt;&lt;br&gt;cd /usr/src/&lt;br&gt;cp -rl linux-clean linux-experiment&lt;br&gt;&lt;br&gt;then you will see, the new folder takes lot less space than the original one but is however fully funcional :) you can compile, apply patches, etc....</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Anonymous</dc:creator><pubDate>Sat, 17 Apr 2004 15:05:19 -0000</pubDate></item><item><title>Re: Create a hard link in UNIX | UNIX | Tech-Recipes</title><link>http://www.tech-recipes.com/rx/173/create-a-hard-link-in-unix/#comment-2767071</link><description>Probably a better way of describing the difference between hard and soft links:&lt;br&gt;&lt;br&gt;The UNIX file system stores files in inodes.  The filesystem table contains a list of filenames, and the pointer to the inode in which that file exists.&lt;br&gt;&lt;br&gt;A hard link creates a second entry in the filesystem table pointing to the same inode of the file.  This can be illustrated with the &lt;em&gt;ls&lt;/em&gt; command very easily:&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;code&gt;&lt;br&gt;1&amp;#58; # touch /this&lt;br&gt;2&amp;#58; # ln /this /root/that&lt;br&gt;3&amp;#58; # ls -i /this /root/that&lt;br&gt;4&amp;#58;      18 /root/that       18 /this&lt;br&gt;5&amp;#58; # rm -f /this&lt;br&gt;6&amp;#58; # ls -i /root/that&lt;br&gt;7&amp;#58;      18 /root/that&lt;br&gt;&lt;/code&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;What did I do above?  Here's a play-by-play:&lt;br&gt;&lt;br&gt;1: create a file (/this)&lt;br&gt;2: hardlink the file (/this) to another file (/root/that)&lt;br&gt;3: ask to see the inodes that the files exist in&lt;br&gt;4: note that the inode numbers are identical - 18&lt;br&gt;5: delete the original file&lt;br&gt;6: show me the inode of the other file again&lt;br&gt;7: it's still the same.&lt;br&gt;&lt;br&gt;In the above example, Inode 18 is occupied only once, and is referenced by two different path/filenames.  Removing the first file doesn't in any way affect the second.  The actual inode is still in use by the second reference.  As soon as you remove all references, the inode is considered unused and can have new data written to it.&lt;br&gt;&lt;br&gt;One caveat - hard links cannot span mount points.  My own home directory is mounted from another disk, for example, so I cannot hardlink from /this to /home/bofh/that.  The other caveat is that you cannot hard link directories.&lt;br&gt;&lt;br&gt;Soft links are really pointers to a pointer.  &lt;em&gt;ls -i&lt;/em&gt; on both files will still show they are pointing at the same inode...  but if you remove the original file, then the inode is actually completely dereferenced.  The plus-side is that soft links can span mount points and you can soft link directories.  The downside is that if you remove the original then the link is broken.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">bofh468</dc:creator><pubDate>Thu, 13 Nov 2003 19:27:17 -0000</pubDate></item></channel></rss>