The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



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

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-10-2007
balu_solaris balu_solaris is offline
Registered User
  
 

Join Date: Jul 2007
Posts: 6
Differentiate Soft and Hard Link

Hi,

Can somebody please help me in knowing the difference between soft (Symbolic) link and hard link.
Please explain it in as simple terms as possible.

Kris
  #2 (permalink)  
Old 07-10-2007
hemangjani hemangjani is offline
Registered User
  
 

Join Date: Feb 2006
Posts: 73
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.
  #3 (permalink)  
Old 07-19-2007
balu_solaris balu_solaris is offline
Registered User
  
 

Join Date: Jul 2007
Posts: 6
Thank you!!!

Thanks so much for your simple but greatly helpful explanation.
Thanks a ton.
  #4 (permalink)  
Old 01-23-2009
rogerben rogerben is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 66
one doubt

Thanks a lot for ur definition. can you pls let me know actually what is the use of using hard link and soft link.
  #5 (permalink)  
Old 01-23-2009
Corona688 Corona688 is offline
Registered User
  
 

Join Date: Aug 2005
Location: Saskatchewan
Posts: 1,929
Quote:
Originally Posted by rogerben View Post
Thanks a lot for your definition. Can you please let me know what is actually the use of using hard link and soft links?
It's best to create your questions in new threads instead of resurrecting ones that've been dead for two years.

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.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:04 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0