You are on page 1of 15

Operating Systems Lab 04

Hard and Soft Links


Index Node
(INODE)
• Every file in the system has an inode (Index Node)
• Contains all file information except the file contents and name.
• Just like a personal id or a passport.(Without a Name!)

• Inode contains:
• Inode doesn't contains:
 Inode number
 File Size
 Name of File
 Owner Information  Content of File
 Permissions
 File type
 Number of links
 Etc
[oracle@localhost ~] $ Ls – Li
Here i is inode number
Types of Links
• Soft Link (Symbolic Link)
• Hard Link
Soft Link
• Also known as Symbolic Link
• It is a pointer to the original file
• Just like a short cut in windows
• Can have different inode
number
• Smaller size than original file
• If we delete an original file, the
soft links will become useless.
Hard Link
• Different name of same file
• Same file size
• Same inode number
• Indistinguishable from original file.
• If original file is deleted it does not
effect hard link.
Video
• https://
www.youtube.com/watch?v=4-vye3QFTFo
How to Create Hard in Linux
Hard Links
Soft Link in Linux
Softlink example
• jm@wd:-$ ln – s ~/dropbox/laptop_Desktop/
~/Desktop/

• s stands for softlink


• ~/dropbox/laptop_Desktop/ is Source
• ~/Desktop/ is destination
https://www.youtube.com/watch?v=OVZMlOT6L-4
Hardlink example
https://www.youtube.com/watch?v=Eduo7WsJp20

You might also like