I'm trying to define symlink and hardlinks between directories and files.

For example, I defined the path:


And I wrote the command like that for symlink.

ln -s /etc/passwd /mnt/data/d1/myp

Here, myp should be a file.

Also, I defined a path for my directory.


And I wrote the command like that for symlink:

ln -s /mnt /mnt/data/myd

Here, myd should be a directory.

Link count:

12 lrwxrwxrwx. 1 sys sys     4 Jan  8 13:20 myd -> /mnt

My question is this: Should I write the paths of directories and files differently? Or should they be written the same? Is it correct that I did?


There is no need to name symlinks to files and folders differently, unless it helps you organize your files. In short, there's nothing wrong with what you have done so far.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.