Monday, March 16, 2015

Hardlinks and Softlinks in Linux

Links are created as a reference to the original file . the different types of links are

1. Softlink or Symbolic link.

Softlinks are created as a reference to the original file across the partitions in the file systems. It will be pointing to different inode numbers.

Command to create soft link.
#ln -s <FULL PATH OF ORIGINAL FILE>   <LINKFILE>

Ex: If you want to create a link for network service in /home..Do the following

#
#ln -s /etc/init.d/network /home/network
#
#ls -lrthi /home -->Will show you the link file details with inode numbers(i) with size of file(h)
#




2. Hardlink:

Hardlinks cannot create across the partitions. You can only create hardlinks on the same file systems. Here the inode number will be same.

Command:
#ln <FILE NAME> < LINKNAME>
#
#cd /etc/init.d
#
#ln network network-hard
#




No comments:

Post a Comment

Thank you !!