I was browsing a directory on a Linux machine, and when doing a detailed listing I noticed that a link is pointing to itself, for example:
somelink -> /path/to/directory/somelink
I am wondering what is the reason for doing such a thing?
A symlink is a symbolic Linux/ UNIX link that points to another file or folder on your computer, or a connected file system. This is similar to a Windows shortcut. Symlinks can take two forms: Soft links are similar to shortcuts, and can point to another file or directory in any file system.
A symbolic link, also termed a soft link, is a special kind of file that points to another file, much like a shortcut in Windows or a Macintosh alias. Unlike a hard link, a symbolic link does not contain the data in the target file. It simply points to another entry somewhere in the file system.
A symbolic link is a file-system object that points to another file system object. The object being pointed to is called the target. Symbolic links are transparent to users; the links appear as normal files or directories, and can be acted upon by the user or application in exactly the same manner.
A symlink (also called a symbolic link) is a type of file in Linux that points to another file or a folder on your computer. Symlinks are similar to shortcuts in Windows. Some people call symlinks "soft links" – a type of link in Linux/UNIX systems – as opposed to "hard links."
If the somelink
is in /path/to/directory
then this is an invalid symlink. If you try to access it, the filesystem will give you an error (probably something like too many levels of symbolic links*). It could have been a typo (or some other mistake) when it was created, or the symlink got moved somehow and ended up linking to itself.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With