Question

When I do ls -lart in my current working directory it shows

lrwxrwxrwx 1 root 10004 36 Dec 16 17:59 index.html ->/home/moviebeam/assets/ui/index.html

But I cannot see contents of the file.And most important the file index.html is not present in the path /home/moviebeam/assets/ui/. Then why it is showing up when I run command ls -lrt ?

Was it helpful?

Solution

This:

lrwxrwxrwx 1 root 10004 36 Dec 16 17:59 index.html ->/home/moviebeam/assets/ui/index.html

is a softlink to the original file. It is checked upon creation if this targetfile is present, but once the softlink (or symbolic link) is created, the targetfile can be deleted, and the softlink will still exist.

Should you want to keep the content of the file in your link, while the targetfile can be deleted, then you should create a hardlink (ln instead of ln -s).

OTHER TIPS

A symbolic link can exist, even if the file or folder at the other end doesn't. If you run file index.html, it will probably tell you that it's a broken symbolic link. Removing the original file won't remove any symbolic links pointing to it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top