Symbolic Link

A symbolic link (often symlink, especially in verb form, or soft link) is a special type of directory entry in modern Unix (or Unix-like) filesystems that allows to almost transparently refer to another directory entry, typically a file or a directory.

Usage

Symbolic links are created with the ln -s command. For example:
  ln -s name_of_real_file name_of_link 
Although this syntax is identical to the one of the cp command, it is significantly counter-intuitive, often leading to surprising results with symlinks to directories (the link gets created inside the directory and points to itself). Most operations (open, read, write) on the symbolic link automatically dereference it and operate on its target (the real file). Some operations (e.g. removing) work on the link itself. Using the 'ls' command, which is standard on these systems, a symbolically linked file might look something like this:
  lrwxrwxrwx    1 jbailey  jbailey         4 2003-02-07 16:49 link -> file 
The 'l' in the first column is a hint that this file is a symbolic link. The information at the furthest right indicates that this file is called 'link', and that when you access it, you will see the contents of 'file'. In contrast with hard links, there are no restrictions on where a symbolic link can point, it can refer to a file on another file system, to itself or to a file which does not even exist (e.g. when the target of the symlink is removed). Such problems will only be detected when the link is accessed. Symbolic links are inherently dangerous, especially in the hands of novice computer users. Although links to files create the illusion of the file being present in several locations at once, just as hard links, these locations are not equivalent and deleting the wrong pathname destroys the file completely. Symbolic links to directories can be lethal with unaware programs working with directory trees. At best they can cause endless looping as well as pathname buffer overflows leading to crashes or dangerous malfunctions. At worst, deleting a directory tree will lead to the content of the symlinked directories being deleted as well. Unix tries to protect against this behavior to some extent by disallowing to destroy a directory symlink using the remove-directory (rmdir) system call, hence symlink-unaware programs will generally fail after trying to delete the first such link.

Storage of symbolic links

Early implementations of symbolic links would store the symbolic link information in standard disk blocks, much like regular files. The file merely contained the text string of the filename the link pointed to, and had a special attribute set indicating that it was a symbolic link rather than just a regular file. This arrangement proved to be somewhat slow and could waste disk space on small systems. An alternative called fast symlinks was created where the link text could be stored within the standard data structures used for storing file information on disk and called the inode. This space is generally the one otherwise used for storing the chain of disk blocks composing a file (60 bytes on the standard UFS filesystem). This simply means that short symbolic links can be referenced quickly. Systems with fast symlinks often fall back to using the older method if the path and filename stored in symlink is larger than the available inode space, or for disk compatibility with other or older versions of the operating system. The original style has been retroactively termed slow symlinks. Although storing the link value inside the inode allows to save a disk block and a disk read, it is still necessary to parse the pathname information in the link, which always requires reading an additional inode and generally requires reading other, potentially many directories, both the list of files and the inodes of each of them until matches are found with link pathname components. Only when a link points to a file inside the same directory are the performance gains really dramatic.

Other operating systems

For people familiar with the Microsoft Windows operating system, a symbolic link is similar to a "shortcut", or an "alias" in the Mac OS operating system, or a "shadow" in the OS/2 operating system. Another option under Windows are Junction Points (this requires NTFS 5.0), which are more similar to symbolic links than Windows shortcuts.

 

<< PreviousWord BrowserNext >>
oakwood memorial park cemetery
woodlawn memorial cemetery
san fernando mission cemetery
valhalla memorial park cemetery
home of peace cemetery
club des hashischins
calvary cemetery, east los angeles
hollywood forever cemetery
grard de nerval
uss pampanito (ss 383)
pavel chekov
love in a cold climate
radio telefs ireann
bruce babbitt
list of memorials
bert bolin
mary stewart
keygen
zefram cochrane
customer privacy
the fountainhead
detroit electric
easyjet
terry and the pirates
transcendental generation
consumer privacy
terry and the pirates (comic strip)
the late late show
terry and the pirates (radio serial)
terry and the pirates (television series)
music of new zealand
un ballo in maschera
orillia, ontario
dorestad
oshawa, ontario
steve buscemi
owen sound, ontario
inflation in mexico
christian legal society
00s
futanari
political privacy
university challenge
ghostface killah