Can we use symbolic link and hard link for directories?

9,083

Most filesystem do not support hard links on directories. However, you can symlink directories.

You can bind mount a directory in Linux, which functions similar to a hard link from a user's perspective. Here is an example:

mount --bind /usr /home/user/foo

This is commonly used for chroot environments, since a symlink is relative the chroot's /, a bind mount can provide access to locations outside of the chroot.

Share:
9,083

Related videos on Youtube

user2935706
Author by

user2935706

Updated on September 18, 2022

Comments

  • user2935706
    user2935706 almost 2 years

    I know we can do that for files. What about directories?

    It seems that cpanel uses that a lot.