Hard link vs. Soft link in Linux

Posted September 21, 2011 in Linux By Levi Putna

Symbolic links (also called symlinks or softlinks) most resemble Windows shortcuts. They contain a pathname to a target file. Hard links are a bit different. They are listings that contain information about the file.

Linux files don’t actually live in directories. They are assigned an inode number, which Linux uses to locate files.

Hard Links

  • Hard links cannot links directories
  • Cannot cross file system boundaries

Soft Links

Soft or symbolic links are just like hard links. It allows to associate multiple filenames with a single file. However, symbolic links allows:

  • To create links between directories
  • Can cross file system boundaries

Create symbolic link

You can create symbolic link with ln command:

$ ln -s /path/to/originalFile.txt /path/to/symFile.txt

Leave a Reply

Your email address will not be published.

*