![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Hard Link vs SOft Link???? | skyineyes | UNIX for Dummies Questions & Answers | 3 | 05-29-2008 12:38 PM |
| soft link for directory in root FS | solaris123 | SUN Solaris | 2 | 04-01-2008 02:25 AM |
| hard/soft link question | Browser_ice | UNIX for Dummies Questions & Answers | 1 | 08-19-2006 02:13 AM |
| Difference between hard link and soft link in unix | RAJACHOKALINGAM | UNIX for Dummies Questions & Answers | 2 | 08-01-2006 04:10 AM |
| Differences between hard link and soft link | penguin-friend | UNIX for Advanced & Expert Users | 3 | 03-08-2002 03:49 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Hope this helps:
Soft Link: ------------- - Soft links are links to a file but not the inode. - Created using ln -s file1 file2 => ls -il 131135 lrwxrwxrwx 1 user user 5 Jul 10 09:04 file2 -> file1 131137 -rw-r--r-- 1 user user 35 Jul 10 09:03 file1 - The inode for file1 is 131137 and inode for file2 is 131135. - If you see the permission bits, there is 'l' in the front for a soft link. - If file1 is deleted, the link still exists. But if you try to view file2, its empty. This means that once the main file is deleted the data is gone. Hard Link: -------------- - Hard links are links to inode - Created using ln file1 file2 => ls -il 131136 -rw-r--r-- 2 user user 48 Jul 10 09:27 file1 131136 -rw-r--r-- 2 user user 48 Jul 10 09:27 file2 - The inode for file1 and file2 is the same (131136). - If you see the output above for "ls -i", file2 does not show that it is linked to file1. In reality it is not linked to file1 but it is linked to the inode. - If you see that there is number '2' before the username 'user'. This shows the number of hard links to the inode. - If file1 is deleted, the data is not deleted. If you view file2 the data is still there. Deleting file1 only deletes a link. The data is gone once the last hard link is deleted. |
|
||||
|
Quote:
Hardlinks only work on the same partition, since inodes are local to their particular partition. Symlinks, which just store the filename and path, work across partitions. Hard links never break, while it's quite possible to have and make invalid symlinks. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|