Hard vs. Symbolic Links

Lisa Olson
1 min readJan 16, 2018

--

In order to understand hard and symbolic links, you first have to understand the concept of an inode which is basically a way of storing your computer’s stuff. Primarily inodes are information about files and directories.

The purpose of creating symbolic and hard links in general is to access the contents inside of these inodes. There’s two ways of doing this which are hard links and symbolic links.

A hard link is a pointer to the i-node. A symbolic link contains the name of the i-node. So the symbolic link points to the name whereas the hard link points to the i-node itself.

To create a hard link between two files, you use the command ln.

ln first_file.txt second_file.txt

This causes first_file to point at second_file for it’s contents, meaning if second_file’s data is changed, first_file’s data is also changed.

To create a soft link between two files, you use the same command ln, but include the option s. It looks like this :

ln -s first_file.txt second_file.txt

--

--

Lisa Olson
Lisa Olson

Written by Lisa Olson

Front End Developer. Passionate about everything I do. How we spend our days is how we spend our lives.

No responses yet