Symbolic link: Difference between revisions
[unchecked revision] | [unchecked revision] |
(Created page with "{{Filesystems}} <!-- {{In Progress}} --> ==Introduction== A symbolic link is a special type of file that refers to another file or directory and is most often encountered in ...") |
|||
Line 12: | Line 12: | ||
Example: |
Example: |
||
On a system substituting the hierarchy (Linux, glibc, shown as shell commands for clarity) : |
On a system substituting the hierarchy (Linux, glibc, shown as shell commands for clarity) : |
||
<code> |
<code><pre> |
||
$ ln -T /dir1/sdir1 /dir2/sdirlink1 |
$ ln -T /dir1/sdir1 /dir2/sdirlink1 |
||
$ cd /dir2/sdirlink1 |
$ cd /dir2/sdirlink1 |
||
Line 25: | Line 25: | ||
$ pwd |
$ pwd |
||
/dir1 |
/dir1 |
||
</code> |
</pre></code> |
||
On a system substituting the hierarchy (posnk (old version), newlib, shown as shell commands for clarity) : |
On a system substituting the hierarchy (posnk (old version), newlib, shown as shell commands for clarity) : |
||
<code> |
<code><pre> |
||
$ ln -T /dir1/sdir1 /dir2/sdirlink1 |
$ ln -T /dir1/sdir1 /dir2/sdirlink1 |
||
$ cd /dir2/sdirlink1 |
$ cd /dir2/sdirlink1 |
||
Line 41: | Line 41: | ||
$ pwd |
$ pwd |
||
/dir2 |
/dir2 |
||
</code> |
</pre></code> |
Revision as of 12:21, 6 March 2015
Filesystems |
---|
Virtual Filesystems |
Disk Filesystems |
CD/DVD Filesystems |
Network Filesystems |
Flash Filesystems |
Introduction
A symbolic link is a special type of file that refers to another file or directory and is most often encountered in UNIX derived/inspired operating systems and their file systems. Symbolic links are real files that contain a path which is automatically resolved when the link is accessed.
Path resolution
There are multiple ways of handling symbolic links during path resolution: Some operating systems maintain the hierarchy of the path leading to the symlink while others substitute the entire hierarchy of the path for that of the target. UNIX-like operating systems handle this in a strange way: The kernel and C library do the latter while some shells maintain a history of path changes and resolve the parent of a symlinked directory as the parent of the symlink.
Example: On a system substituting the hierarchy (Linux, glibc, shown as shell commands for clarity) :
$ ln -T /dir1/sdir1 /dir2/sdirlink1
$ cd /dir2/sdirlink1
$ pwd
/dir1/sdir1
$ cd ..
$ pwd
/dir1
$ cd
/
$ cd /dir2/sdirlink1/..
$ pwd
/dir1
On a system substituting the hierarchy (posnk (old version), newlib, shown as shell commands for clarity) :
$ ln -T /dir1/sdir1 /dir2/sdirlink1
$ cd /dir2/sdirlink1
$ pwd
/dir2/sdirlink1
$ cd ..
$ pwd
/dir2
$ cd
/
$ cd /dir2/sdirlink1/..
$ pwd
/dir2