Friday, March 9, 2012

Replace & Hard Links and Soft Links

Replave four by 4 in a file :

:%s/four/4/g
:%s/\<four/4/g     ->starting with four
%s/\<four\>/4/g    -> only four 



Differences between symbolic link and hard link

Let's summarize our findings. The list bellow summarizes some differences between symlink and hard link:
  1. Hardlink or hardlinks cannot be created for directories (folders). Hard link can only be created for a file.
  2. Symbolic links or symlinks can link to a directory (folder).
  3. Removing the original file that your hard link points to does not remove the hardlink itself; the hardlink still provides the content of the underlying file.
  4. If you remove the hard link or the symlink itself, the original file will stay intact.
  5. Removing the original file does not remove the attached symbolic link or symlink, but without the original file, the symlink is useless (the same concept like Windows shortcut).

Hard Links :
1. All Links have same inode number.
2.ls -l command shows all the links with the link column(Second) shows No. of links.
3. Links have actual file contents
4.Removing any link ,just reduces the link count , but doesn't affect other links.
Soft Links(Symbolic Links) :
1.Links have different inode numbers.
2. ls -l command shows all links with second column value 1 and the link points to original file.
3. Link has the path for original file and not the contents.
4.Removing soft link doesn't affect anything but removing original file ,the link becomes "dangling" link which points to nonexistant file.

No comments:

Post a Comment