Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are circular symlinks in Unix-like systems used for? [closed]

Tags:

linux

symlink

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?

like image 458
A. B Avatar asked Oct 01 '12 20:10

A. B


People also ask

What are symlinks used for?

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.

How do symlinks work Linux?

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.

What is a symlink and how does it work?

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.

What are symbolic links in Linux?

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."


1 Answers

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.

like image 164
Jon Lin Avatar answered Nov 28 '22 17:11

Jon Lin