1 .\" This manpage is Copyright (C) 1992 Drew Eckhardt;
2 .\" 1993 Michael Haardt, Ian Jackson.
4 .\" %%%LICENSE_START(VERBATIM)
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date. The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein. The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
26 .\" Modified 1993-07-24 by Rik Faith
27 .\" Modified 1996-04-26 by Nick Duffek <nsd@bbc.com>
28 .\" Modified 1996-11-06 by Eric S. Raymond <esr@thyrsus.com>
29 .\" Modified 1997-01-31 by Eric S. Raymond <esr@thyrsus.com>
30 .\" Modified 2004-06-23 by Michael Kerrisk <mtk.manpages@gmail.com>
32 .TH SYMLINK 2 2013-01-27 "Linux" "Linux Programmer's Manual"
34 symlink \- make a new name for a file
36 .B #include <unistd.h>
38 .BI "int symlink(const char *" oldpath ", const char *" newpath );
41 Feature Test Macro Requirements for glibc (see
42 .BR feature_test_macros (7)):
48 _BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500 ||
49 _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED || _POSIX_C_SOURCE\ >=\ 200112L
54 creates a symbolic link named
56 which contains the string
59 Symbolic links are interpreted at run time as if the contents of the
60 link had been substituted into the path being followed to find a file or
63 Symbolic links may contain
65 path components, which (if used at the start of the link) refer to the
66 parent directories of that in which the link resides.
68 A symbolic link (also known as a soft link) may point to an existing
69 file or to a nonexistent one; the latter case is known as a dangling
72 The permissions of a symbolic link are irrelevant; the ownership is
73 ignored when following the link, but is checked when removal or
74 renaming of the link is requested and the link is in a directory with
85 On success, zero is returned.
86 On error, \-1 is returned, and
92 Write access to the directory containing
94 is denied, or one of the directories in the path prefix of
96 did not allow search permission.
98 .BR path_resolution (7).)
101 The user's quota of resources on the file system has been exhausted.
102 The resources could be inodes or disk blocks, depending on the file
103 system implementation.
110 .IR oldpath " or " newpath " points outside your accessible address space."
113 An I/O error occurred.
116 Too many symbolic links were encountered in resolving
120 .IR oldpath " or " newpath " was too long."
123 A directory component in
125 does not exist or is a dangling symbolic link, or
130 Insufficient kernel memory was available.
133 The device containing the file has no room for the new directory
137 A component used as a directory in
139 is not, in fact, a directory.
142 The file system containing
144 does not support the creation of symbolic links.
148 is on a read-only file system.
150 SVr4, 4.3BSD, POSIX.1-2001.
151 .\" SVr4 documents additional error codes EDQUOT and ENOSYS.
154 .\" re multiple files with the same name, and NFS.
160 Deleting the name referred to by a symlink will actually delete the
161 file (unless it also has other hard links).
162 If this behavior is not desired, use
174 .BR path_resolution (7),