Translation(s): English - Fran├žais - Italiano

There are two concepts of link in Unix-like OS (this includes Linux), usually called "hard link" and "symlink/symbolic link/soft link":

It's a special file existing in the filesystem and pointing to another file or directory. If you access the symlink from an application, it appears transparent for the application and you will really access the file or directory which the symlink is pointing to.

It is a special kind of file that contains a path to another file. The file type entry in the file's inode indicates that it is a symbolic link. When you attempt to access a symbolic link with a text editor or other program, the kernel redirects the program to the file indicated by the symbolic link's pathname. Unlike hard links, symbolic links can be made across different filesystems. Use the ln command with the -s option to create a symbolic link.

The symlinks utility performs maintenance on symbolic links. symlinks checks for symlink problems, including dangling symlinks which point to nonexistent files. symlinks can also automatically convert absolute symlinks to relative ones. Install the symlinks package if you need a program for maintaining symlinks on your system.

Although a symlink shows up with file permissions and user/group ownerships, the access rights are only determined by its target permissions and user/group ownerships!

Create a symlink:

ln -s <destination file or directory> <name of the symlink>

Delete a symlink without disturbing the targeted file or directory:

rm <name of the symlink>

The actual file/data is deleted from disk only when the last hard link/filename pointing to it is removed. The number of names is given by ls(1). There is no such thing as an "original" filename: all filenames have the same status. Usually, but not necessarily, all names of a file are found in the filesystem that also contains its data. Most filesystems do not support hard links to directories.

Create a hard link:

ln <destination file or directory> <name of the hard link>

Delete a hard link without disturbing other hard links pointing to the same file:

rm <name of the hard link>

CategorySystemAdministration | CategoryStorage