cancel
Showing results for 
Search instead for 
Did you mean: 

about links

Vijesh
Occasional Contributor

about links

Hi
When i create hardlink & softlink what will effect on link id which shows in ls -l option.And what is difference between softlink & hardlink.Please help me out
7 REPLIES
Bijeesh
Respected Contributor

Re: about links

Hi,
If you are creating hard link it will be the same copy of the original file.Whatever may be the changes you are making in any of these file make change to the other file also.It can't cross file systems.The inode number of both file are same.

Soft link is just like a shortcut to the original file.

For Hardlink
#ln

For Soft link
#ln -s
Bijeesh
Respected Contributor

Re: about links

Hi,
After creating hard link,the no:of links will be increase.(ie,the second coloumn of ls -l)
Vijesh
Occasional Contributor

Re: about links

Thanks for your reply
What will effect in link id (i.e ls -l)after creating soft link.If any links providing difference between softlink and hardlink.
Bijeesh
Respected Contributor
Sajjad Sahir
Honored Contributor

Re: about links



1. hardlink is using when you want the link to be in the same file system. In this case the inode for both link and the file is the same. If you want to move the shared link to another location or you want to move the original file, it does not affect either of them.
u can use ln command to create hard link
this can not be used on directories. and can be used only in the same fS and not outside file systems

Soft links:- this one is mainly using when u want a temporary link. indod is different unlike hard link this can be both for file and directories.
If the source file gets deleted the link will be removed at next reboot

This can extend across file systems

u can use ln -s command to create a soft link

thanks and regards

Sajjad Sahir
Sajjad Sahir
Honored Contributor

Re: about links

Dear Vijesh

1. hardlink is using when you want the link to be in the same file system. In this case the inode for both link and the file is the same. If you want to move the shared link to another location or you want to move the original file, it does not affect either of them.
u can use ln command to create hard link
this can not be used on directories. and can be used only in the same fS and not outside file systems

Soft links:- this one is mainly using when u want a temporary link. indod is different unlike hard link this can be both for file and directories.
If the source file gets deleted the link will be removed at next reboot

This can extend across file systems

u can use ln -s command to create a soft link

thanks and regards

Sajjad Sahir
Sajjad Sahir
Honored Contributor

Re: about links

Dear Vijesh

1. hardlink is using when you want the link to be in the same file system. In this case the inode for both link and the file is the same. If you want to move the shared link to another location or you want to move the original file, it does not affect either of them.
u can use ln command to create hard link
this can not be used on directories. and can be used only in the same fS and not outside file systems

2.Soft links:- this one is mainly using when u want a temporary link. indod is different unlike hard link this can be both for file and directories.
If the source file gets deleted the link will be removed at next reboot

This can extend across file systems

u can use ln -s command to create a soft link

thanks and regards

Sajjad Sahir