Symbolic link

A symbolic link, also called symbolic link, symlink or soft link is a link in a file system (files and directories) that points to another file or directory. It is merely a reference to the target file or the destination directory. A delete or move the file itself usually leads to the fact that the reference " into the void " points. Unlike a hard link, this reference is not equivalent to the actual file system entry of the referenced file.

  • 2.1 File link
  • 2.2 folder shortcut
  • 2.3 ShellObjects
  • 2.4 Symbolic Link
  • 2.5 junction
  • 2.6 folder crossfade
  • 2.7 Cygwin and links

Unix

In a Unix system, you can create the following command to create a symbolic link

Ln-s / source file / target file ( Optional) or understandable

The advantage of symbolic links is that these are partitions and file system-wide and have easily point to a place which is not the case with hard links. Although hard links to directories in principle possible, but should be avoided and may be applied as a rule only by the system administrator ( "superuser "). Symbolic links can confuse users, as it seems at first glance as if the linked file simultaneously exist in multiple directories; deleting the original file, however, leads to the fact that all symbolic links that refer to it, go into space, and the file is lost so far. With hard links, this is only the case when the last name, that is the last reference to the file was deleted.

Symbolic links to directories can be a problem when users or programs to deal with clueless directory trees. Easily creates an endless loop and thus a buffer overflow in the directory path buffer, leading to crashes or dangerous malfunctions. You can also delete a directory tree can cause the contents of the symbolic linked directory are also deleted (so-called broken symlink ).

Unix tries to prevent this to a certain extent, by prohibiting to delete a symbolic link to a directory on the system command " rmdir " so clueless with symbolic links prompt programs receive and fail an error message if they want to remove such a link. However, the command " rm -r" does indeed remove the symbolic link, not its goal.

Desktop Shortcuts

Graphical environments such as KDE Plasma Workspaces offer on Unix-like systems or Gnome the way so-called shortcuts ( en: " spatial abbreviation" ) to create and use, days usually with an extension * desktop. . These are file linkages which exist constructed from an INI file like structure text file. This configuration file can be a path or command, labels, help texts, symbols, and various other attributes define who can interpret and execute the work surface. These shortcuts are not transparent, as opposed to symbolic links for applications and users. Therefore, they are to be compared with the Windows shortcuts or MacOS alias, but offer more features than this.

Mac OS X

As a Unix system Mac OS X also dominates hard and symbolic links. The former are usually not used except in Apple's own file backup Time Machine. Symbolic links are like, produced in usual Unix via the command line.

In addition, Mac OS X inherited from his predecessor, Mac OS called aliases that reference specific files with hidden attributes, to another file or folder. They are much more powerful than the Windows shortcuts or desktop shortcuts, because the support of the aliases is deeply rooted in the operating system ( in the classic Mac OS in Alias ​​Manager ). An alias can also follow one on the same filesystem ( " Volume") moved file. To this end, the hidden information ( in the resource fork ) is not only the path to the destination file, but also their inode number and the volume ID will be stored.

Windows

Under Windows, there are five types of links.

Link to file

In the file association of Microsoft Windows is an ordinary, very small file that contains the hidden file extension *. Lnk used. In a narrow sense such file link are not referred to as a link, but shortcut on Microsoft Windows. These small windows shortcuts point to another file or to a directory. In addition, the shortcuts contain information such as the destination is open. A file association may have a different name from the target and is usually provided with an arrow bottom left of the icon ( icon).

A Windows shortcuts can be seen, that is, the user sees the shortcut in Windows Explorer or other file managers as a link. Most applications do not pursue such shortcuts but; when the application tries to open the file link does not automatically open the target in the rule, but the application tries unsuccessfully to open the link itself. In Windows shortcuts no relative (. \ Subfolder \ file.txt ), but only absolute paths are possible.

Folder shortcut

In the folder shortcut in Windows is a directory with the readOnly attribute and / or system that one pointing at the target file association with the fixed name Target.lnk and a (hidden ) desktop.ini file with (at least ) the following content contains:

[. Shell Class Info]   CLSID2 = { 0AFACED1 - E828 - 11D1 - 9187 - B532F1E9575D } A folder shortcut is ( in Windows Explorer) transparent.

Folder shortcuts are generated by Windows itself and used, for example, in the network environment.

ShellObjects

Shell or shell folder objects are defined in the Windows registry objects that can implement, inter alia, the function of a link. The (at least) necessary registry entries for such a shell object are as follows ( CLSID \ { 00000000-0000-0000-0000-000000000000 } is used here as a placeholder ):

[ HKEY_CLASSES_ROOT \ CLSID \ { 00000000-0000-0000-0000-000000000000 }]   @ = " display name "   [ HKEY_CLASSES_ROOT \ CLSID \ { 00000000-0000-0000-0000-000000000000 } \ DefaultIcon ]   @ = "..."; Path to the icon to be displayed   [ HKEY_CLASSES_ROOT \ CLSID \ { 00000000-0000-0000-0000-000000000000 } \ InProcServer32 ]   @ = "% SystemRoot % \ \ system32 \ \ shdocvw.dll "   " ThreadingModel " = "Apartment"   [ HKEY_CLASSES_ROOT \ CLSID \ { 00000000-0000-0000-0000-000000000000 } \ Instance ]   " CLSID " = " { 0AFACED1 - E828 - 11D1 - 9187 - B532F1E9575D }"   [ HKEY_CLASSES_ROOT \ CLSID \ { 00000000-0000-0000-0000-000000000000 } \ Instance \ InitPropertyBag ]   " Attributes " = hex: 15,00,00,00   "Target" = "..."; absolute (only without the "Target Folder know " or "Target Special Folder " )                 ; or relative path to the target object   "Target Folder know " = " { guidguid - guid guid guid - guidguidguid }"; GUID of the destination folder from Windows Vista   "Target Special Folder " = " 0x00xy "; CSIDL of the target object   [ HKEY_CLASSES_ROOT \ CLSID \ { 00000000-0000-0000-0000-000000000000 } \ Shell Folders ]   " Attributes " = hex: 00,00,00,00 Windows uses such linking shell objects themselves, for example for the virtual My Documents folder on the desktop and fonts and Management in the Control Panel.

A shell object is ( in Windows Explorer) transparent.

Symbolic Link

Since Windows Vista or Windows Server 2008 (both internal Windows NT 6.0) are available through the Win32 API genuine symbolic links available that transparently present in the file system and can refer to files and directories on your own computer. Symbolic links may contain a relative target information.

To create the symbolic link is the right Create Symbolic Link is required. This is by default, only users with Administrator privileges available. Furthermore, it must be known when creating the link, whether the target is a file or a directory. For these reasons, the symbolic links of Windows are not fully compatible with POSIX.

Create symbolic links from Windows Vista:

C: \> mklink "C: \ EinLink.pdf " "D: \ EinDokument.pdf "   c: \> mklink / d " D: \ path1 \ New directory" ".. \ path2 \ Reales directory"   c: \> mklink / d "C: \ network share " "\ \ myserver \ myshare " The second line shows that the target information can also be a relative path, which is then resolved until calling the symbolic link, that is should for example, D: \ path1 and D are shifted \ path2 elsewhere, eg from D: \ to D: \ Archive \ would the resolution of the symbolic link still work as opposed to using an absolute indication. On the other hand, if D: \ path1 \ and D: \ path2 \ would no longer share a common parent path, the relative symbolic link then meadow on a no longer existing path.

Ads, where a symbolic link points - the / al parameter filters the output symbolic link -:

C: \ > dir / al   Volume in drive C: is abc   Directory of C: \   07/12/2010 10:28 EinLink.pdf [D: \ EinDokument.pdf ] Delete Symbolic Links:

C: \> del "C: \ EinLink.pdf "   c: \> rmdir "D: \ path1 \ New Folder "   c: \> rmdir "C: \ network share " Symbolic links in Windows Me (just like on UNIX) even after a system reboot.

Junction

Regardless, there are since the NTFS edition 3.0, the file system used by Windows 2000, by default, so-called junction points ( also english file system reparse points or junction points and short junctions called ). However, it lacked in Windows 2000 using the supplied tools to manage junction points. Junction points are the symbolic links to directories much more similar than the usual connectives. These junction points correspond Linux largely to mounting directories on another site using mount - rbind.

Junction can from Windows Vista from a command line with the command mklink / J be created and in older Windows editions junction.exe with the add-on applications available from Microsoft and Linkd.exe - former application from Sysinternals and the latter from the Windows 2003 Resource Kit Tools.

Use the following commands

C: \> mklink / J "C: \ New Folder " "D: \ path \ directory Reales " or

C: \> junction " C: \ New Folder " "D: \ path \ directory Reales " or

C: \> linkd "C: \ New Folder " "D: \ path \ directory Reales " may be a branching point "C: \ New Folder " can be created, the "D: \ path \ directory Reales " referenced. The contents of " D: \ path \ directory Reales " ( the target of the branch point, english junction target) can now also under " C: \ New folder " in Explorer (english junction directory) called up and started. Junction points are also retained after a Windows restart.

The cancellation of a branching point via the following commands:

> C: \> rmdir "C: \ New Folder " or

C: \> junction -d "C: \ New Folder " or

C: \> linkd "C: \ New directory" / D Where the transfer value " d", delete ' - English for " delete " - and "C: \ New Folder " is the goal of the applied branch point.

In contrast to genuine symbolic links absolute paths are stored in junction points always:

C: \> mklink / J "New Connection" destination folder   Connection created for New Connection << === >> destination folder     C: \ > dir / al junction   Volume in drive C: is abc   Directory of C: \   07/12/2010 10:30 new connection [C: \ Target Folder] On the command line junction can also be displayed with the DIR command, where instead of a

is then output (for normal directories) ( or English ). The reference target appears, which must be queried separately about the said Additional applications for older Windows editions - Here then is also - from Vista.

Folder crossfade

Starting with Windows Vista, writes are programs that do not have write permission for the directory, carried out under certain conditions without an error message; The actual write operation is diverted to a shadow directory in the user profile. This shadow directory is displayed for that user to the actual directory so that it looks to him as if the write operation has been performed successfully.

This enables Microsoft programs, which support the concept of restricted user rights are not correct, nevertheless no error message to expire.

Cygwin and links

The Cygwin environment supports POSIX -compatible hard links and symbolic links. Hard links are mapped transparently to hard links in Windows. Existing junction points are displayed as a symbolic link. Cygwin -based symbolic links, however, emulated, because the Windows own symbolic links are not fully POSIX compliant. Such links are therefore only available for Cygwin programs, other programs will only see a file system attribute. This also applies to Vista and Windows 7 Cygwin supports symbolic links that were created by Microsoft SFU. Conversely, this is not true. SFU also uses files for emulation, but in a different format.

Survey

Pictures of Symbolic link

26197
de