Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

why can't we create a hard link to a directory??????

Status
Not open for further replies.

dotprofile

Programmer
Mar 18, 2003
5
US

why can't we create a hard link to a directory,when unix treates the directories also as files.
what happens if the i node of a hard link is same as the i node of the file to which it is pointing....

thank u
 
The inode of a hard link is always the same as the inode of the file it points to - it is is in fact simpy another directory entry for the same inode. A directory has a strict position within the filesystem hierarchy and so cannot be linked to with a hard link - effectively the directory would appear in 2 places. The OS itself can create hard links to directories but a user cannot.

A soft link is simply a pointer to another inode and so can point to a drectory and span filesystems since it's inode is not the same as that of it's target.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top