Linuxlab

Inodes and links

A file's name and the file itself are different things. The data lives in an inode, and a name in a directory is just a pointer to that inode. Hard and symbolic links grow out of this. The sandbox already has ~/data/original.txt to practise on.

Steps

1. A hard link

A hard link is a second name for the same inode. Make one and compare the inode numbers: they match.

ln ~/data/original.txt ~/hard.txt
ls -i ~/data/original.txt ~/hard.txt   # same inode

2. A symbolic link

A symbolic link is a separate little file that holds a path to its target. It points at a name, not at an inode.

ln -s ~/data/original.txt ~/soft.txt
cat ~/soft.txt          # reads like the original
ls -l ~/soft.txt        # shows -> t
Locked

The rest of this lesson is part of a paid course

You are reading the open part. Buy the course to unlock the whole lesson and its lab.

See the course