Sunday, August 3, 2025

Linux Link

ln command by default creates a hard link which is a file that share the same inode as the original file it links to.

Soft link (symbolic link) is a newer link type that addresses some disadvantage of hard link.  It can link to a directory.  It can like to entry in another file system.  It can link to an entry that does not exist currently (e.g. a file that is created from time to time).

When cd to a directory using symlink, the shell builtin pwd will display the name of the symlink that link to but /bin/pwd (utility) will display the destingation directory.  When you cd to .. it will return to the directory that holding the symlink.

No comments: