Linux Up Skill - Day 19

Linux Up Skill - Day 19
Photo by George Pagan III / Unsplash

Working on lesson 19 of the Linux Up Skill Challenge. Today’s lesson is titled “Inodes, symlinks and other shortcuts.”

The lesson begins speaking about the Linux Virtual Filesystem and the inode or layer between filenames and actual data. The lesson points out that permissions, ownership, and the dates are kept at the inode level and not with the filename.

Next the lesson is having me work through some commands to get familiar with the difference between hard and soft links.

root@linux-up-skill:~# cd root@linux-up-skill:~# ln /etc/passwd link1 root@linux-up-skill:~# ln -s /etc/passwd link2 root@linux-up-skill:~# ls -li total 10280 661934 -rw-r--r-- 2 root root 1935 Jun 29 14:08 link1 130827 lrwxrwxrwx 1 root root 11 Jul 11 15:59 link2 -> /etc/passwd 655340 drwxr-xr-x 24 root root 12288 Jul 11 15:17 nmap-7.92 130824 -rw-r--r-- 1 root root 10498200 Aug 7 2021 nmap-7.92.tar.bz2 264539 drwx------ 3 root root 4096 May 28 07:10 snap 265188 drwxr-xr-x 2 root root 4096 Jun 9 11:43 test

It is interesting how the soft link shows all permissions available, which is actually for the link and not the underlying file. Then the lesson goes over the other differences:

  • Hard Links
    • Only link to a file, not a directory
    • Can’t reference a file on a different disk/volume
    • Links will reference a file even if it is moved
    • Links reference inode/physical locations on the disk
  • Soft Links
    • Can link to directories
    • Can reference a file/folder on a different hard disk/volume
    • Links remain if the original file is deleted
    • Links will not reference the file anymore if it is moved
    • Links reference abstract filenames/directories and not physical locations
    • They have their own inode