'\" te .\" Copyright 1989 AT&T .\" Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. .TH link 1M "16 Mar 2011" "SunOS 5.11" "System Administration Commands" .SH NAME link, unlink \- link and unlink files and directories .SH SYNOPSIS .LP .nf \fB/usr/sbin/link\fR \fIexisting-file\fR \fInew-file\fR .fi .LP .nf \fB/usr/xpg4/bin/link\fR \fIexisting-file\fR \fInew-file\fR .fi .LP .nf \fB/usr/sbin/unlink\fR \fIfile\fR .fi .SH DESCRIPTION .sp .LP The \fBlink\fR and \fBunlink\fR commands link and unlink files and directories. Only super-users can use these commands on directories. .sp .LP Use \fBlink\fR to create a new file that points to an existing file. The \fIexisting-file\fR and \fInew-file\fR operands specify the existing file and newly-created files. See \fBOPERANDS\fR. .sp .LP Note that the ZFS file system does not support links between directories. .sp .LP \fBlink\fR and \fBunlink\fR directly invoke the \fBlink\fR(2) and \fBunlink\fR(2) system calls, performing exactly what they are told to do and abandoning all error checking. This differs from the \fBln\fR(1) command. See \fBln\fR(1). .sp .LP While linked files and directories can be removed using \fBunlink\fR, it is safer to use \fBrm\fR(1) and \fBrmdir\fR(1) instead. See \fBrm\fR(1) and \fBrmdir\fR(1). .SS "/usr/xpg4/bin/link" .sp .LP If the existing file being hard linked is itself a symbolic link, then the newly created file (\fInew-file\fR) will be a hard link to the file referenced by the symbolic link, not to the symbolic link object itself (\fIexisting-file\fR). .SH OPERANDS .sp .LP The following operands are supported: .sp .ne 2 .mk .na \fB\fIexisting-file\fR\fR .ad .RS 17n .rt Specifies the name of the existing file to be linked. .RE .sp .ne 2 .mk .na \fB\fIfile\fR\fR .ad .RS 17n .rt Specifies the name of the file to be unlinked. .RE .sp .ne 2 .mk .na \fB\fInew-file\fR\fR .ad .RS 17n .rt Specifies the name of newly created (linked) file. .RE .SH ENVIRONMENT VARIABLES .sp .LP See \fBenviron\fR(5) for descriptions of the following environment variables that affect the execution of \fBlink\fR: \fBLANG\fR, \fBLC_ALL\fR, \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR. .SH ATTRIBUTES .sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp .sp .TS tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) . ATTRIBUTE TYPEATTRIBUTE VALUE _ Availabilitysystem/core-os .TE .SS "/usr/xpg4/bin/link" .sp .sp .TS tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) . ATTRIBUTE TYPEATTRIBUTE VALUE _ Availabilitysystem/xopen/xcu4 _ Interface StabilityCommitted _ StandardSee \fBstandards\fR(5). .TE .SH SEE ALSO .sp .LP \fBln\fR(1), \fBrm\fR(1), \fBlink\fR(2), \fBunlink\fR(2), \fBattributes\fR(5), \fBenviron\fR(5), \fBstandards\fR(5)