{"id":5730,"date":"2022-12-20T18:57:29","date_gmt":"2022-12-20T21:57:29","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/ln-man1p\/"},"modified":"2022-12-20T18:57:29","modified_gmt":"2022-12-20T21:57:29","slug":"ln-man1p","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/ln-man1p\/","title":{"rendered":"LN (man1p)"},"content":{"rendered":"<h1 align=\"center\">LN<\/h1>\n<p> <a href=\"#PROLOG\">PROLOG<\/a><br \/> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#OPTIONS\">OPTIONS<\/a><br \/> <a href=\"#OPERANDS\">OPERANDS<\/a><br \/> <a href=\"#STDIN\">STDIN<\/a><br \/> <a href=\"#INPUT FILES\">INPUT FILES<\/a><br \/> <a href=\"#ENVIRONMENT VARIABLES\">ENVIRONMENT VARIABLES<\/a><br \/> <a href=\"#ASYNCHRONOUS EVENTS\">ASYNCHRONOUS EVENTS<\/a><br \/> <a href=\"#STDOUT\">STDOUT<\/a><br \/> <a href=\"#STDERR\">STDERR<\/a><br \/> <a href=\"#OUTPUT FILES\">OUTPUT FILES<\/a><br \/> <a href=\"#EXTENDED DESCRIPTION\">EXTENDED DESCRIPTION<\/a><br \/> <a href=\"#EXIT STATUS\">EXIT STATUS<\/a><br \/> <a href=\"#CONSEQUENCES OF ERRORS\">CONSEQUENCES OF ERRORS<\/a><br \/> <a href=\"#APPLICATION USAGE\">APPLICATION USAGE<\/a><br \/> <a href=\"#EXAMPLES\">EXAMPLES<\/a><br \/> <a href=\"#RATIONALE\">RATIONALE<\/a><br \/> <a href=\"#FUTURE DIRECTIONS\">FUTURE DIRECTIONS<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a><br \/> <a href=\"#COPYRIGHT\">COPYRIGHT<\/a> <\/p>\n<hr>\n<h2>PROLOG <a name=\"PROLOG\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">This manual page is part of the POSIX Programmer\u2019s Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux.<\/p>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">ln \u2014 link files<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">ln <b>[<\/b>-fs<b>] [<\/b>-L|-P<b>]<\/b> <i>source_file target_file<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">ln <b>[<\/b>-fs<b>] [<\/b>-L|-P<b>]<\/b> <i>source_file<\/i>&#8230; <i>target_dir<\/i><\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">In the first synopsis form, the <i>ln<\/i> utility shall create a new directory entry (link) at the destination path specified by the <i>target_file<\/i> operand. If the <b>\u2212s<\/b> option is specified, a symbolic link shall be created for the file specified by the <i>source_file<\/i> operand. This first synopsis form shall be assumed when the final operand does not name an existing directory; if more than two operands are specified and the final is not an existing directory, an error shall result.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">In the second synopsis form, the <i>ln<\/i> utility shall create a new directory entry (link), or if the <b>\u2212s<\/b> option is specified a symbolic link, for each file specified by a <i>source_file<\/i> operand, at a destination path in the existing directory named by <i>target_dir<\/i>.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">If the last operand specifies an existing file of a type not specified by the System Interfaces volume of POSIX.1-2017, the behavior is implementation-defined.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The corresponding destination path for each <i>source_file<\/i> shall be the concatenation of the target directory pathname, a <slash> character if the target directory pathname did not end in a <slash>, and the last pathname component of the <i>source_file<\/i>. The second synopsis form shall be assumed when the final operand names an existing directory.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">For each <i>source_file<\/i>:<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"12%\"><\/td>\n<td width=\"3%\">\n<p>1.<\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"83%\">\n<p>If the destination path exists and was created by a previous step, it is unspecified whether <i>ln<\/i> shall write a diagnostic message to standard error, do nothing more with the current <i>source_file<\/i>, and go on to any remaining <i>source_file<\/i>s; or will continue processing the current <i>source_file<\/i>. If the destination path exists:<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:17%;\">a.<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"12%\"><\/td>\n<td width=\"10%\"><\/td>\n<td width=\"1%\"><\/td>\n<td width=\"77%\">\n<p style=\"margin-top: 1em\">If the <b>\u2212f<\/b> option is not specified, <i>ln<\/i> shall write a diagnostic message to standard error, do nothing more with the current <i>source_file<\/i>, and go on to any remaining <i>source_file<\/i>s.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"12%\"><\/td>\n<td width=\"10%\">\n<p>b.<\/p>\n<\/td>\n<td width=\"1%\"><\/td>\n<td width=\"77%\">\n<p>If the destination path names the same directory entry as the current <i>source_file ln<\/i> shall write a diagnostic message to standard error, do nothing more with the current <i>source_file<\/i>, and go on to any remaining <i>source_file<\/i>s<i>.<\/i><\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"12%\"><\/td>\n<td width=\"10%\">\n<p>c.<\/p>\n<\/td>\n<td width=\"1%\"><\/td>\n<td width=\"77%\">\n<p>Actions shall be performed equivalent to the <i>unlink<\/i>() function defined in the System Interfaces volume of POSIX.1-2017, called using the destination path as the <i>path<\/i> argument. If this fails for any reason, <i>ln<\/i> shall write a diagnostic message to standard error, do nothing more with the current <i>source_file<\/i>, and go on to any remaining <i>source_file<\/i>s.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"12%\"><\/td>\n<td width=\"10%\">\n<p>2.<\/p>\n<\/td>\n<td width=\"1%\"><\/td>\n<td width=\"77%\"> <\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:17%; margin-top: 1em\">If the <b>\u2212s<\/b> option is specified, actions shall be performed equivalent to the <i>symlink<\/i>() function with <i>source_file<\/i> as the <i>path1<\/i> argument and the destination path as the <i>path2<\/i> argument. The <i>ln<\/i> utility shall do nothing more with <i>source_file<\/i> and shall go on to any remaining files.<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"12%\"><\/td>\n<td width=\"3%\">\n<p style=\"margin-top: 1em\">3.<\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"52%\">\n<p style=\"margin-top: 1em\">If <i>source_file<\/i> is a symbolic link:<\/p>\n<\/td>\n<td width=\"31%\"> <\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:17%;\">a.<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"18%\"><\/td>\n<td width=\"4%\"><\/td>\n<td width=\"1%\"><\/td>\n<td width=\"77%\">\n<p style=\"margin-top: 1em\">If the <b>\u2212P<\/b> option is in effect, actions shall be performed equivalent to the <i>linkat<\/i>() function with <i>source_file<\/i> as the <i>path1<\/i> argument, the destination path as the <i>path2<\/i> argument, AT_FDCWD as the <i>fd1<\/i> and <i>fd2<\/i> arguments, and zero as the <i>flag<\/i> argument.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"18%\"><\/td>\n<td width=\"4%\">\n<p>b.<\/p>\n<\/td>\n<td width=\"1%\"><\/td>\n<td width=\"77%\">\n<p>If the <b>\u2212L<\/b> option is in effect, actions shall be performed equivalent to the <i>linkat<\/i>() function with <i>source_file<\/i> as the <i>path1<\/i> argument, the destination path as the <i>path2<\/i> argument, AT_FDCWD as the <i>fd1<\/i> and <i>fd2<\/i> arguments, and AT_SYMLINK_FOLLOW as the <i>flag<\/i> argument.<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:17%; margin-top: 1em\">The <i>ln<\/i> utility shall do nothing more with <i>source_file<\/i> and shall go on to any remaining files.<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"12%\"><\/td>\n<td width=\"3%\">\n<p style=\"margin-top: 1em\">4.<\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"83%\">\n<p style=\"margin-top: 1em\">Actions shall be performed equivalent to the <i>link<\/i>() function defined in the System Interfaces volume of POSIX.1-2017 using <i>source_file<\/i> as the <i>path1<\/i> argument, and the destination path as the <i>path2<\/i> argument.<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<h2>OPTIONS <a name=\"OPTIONS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The <i>ln<\/i> utility shall conform to the Base Definitions volume of POSIX.1-2017, <i>Section 12.2<\/i>, <i>Utility Syntax Guidelines<\/i>.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The following options shall be supported:<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"3%\">\n<p style=\"margin-top: 1em\"><b>\u2212f<\/b><\/p>\n<\/td>\n<td width=\"12%\"><\/td>\n<td width=\"74%\">\n<p style=\"margin-top: 1em\">Force existing destination pathnames to be removed to allow the link.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"3%\">\n<p><b>\u2212L<\/b><\/p>\n<\/td>\n<td width=\"12%\"><\/td>\n<td width=\"74%\">\n<p>For each <i>source_file<\/i> operand that names a file of type symbolic link, create a (hard) link to the file referenced by the symbolic link.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"3%\">\n<p><b>\u2212P<\/b><\/p>\n<\/td>\n<td width=\"12%\"><\/td>\n<td width=\"74%\">\n<p>For each <i>source_file<\/i> operand that names a file of type symbolic link, create a (hard) link to the symbolic link itself.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"3%\">\n<p><b>\u2212s<\/b><\/p>\n<\/td>\n<td width=\"12%\"><\/td>\n<td width=\"74%\">\n<p>Create symbolic links instead of hard links. If the <b>\u2212s<\/b> option is specified, the <b>\u2212L<\/b> and <b>\u2212P<\/b> options shall be silently ignored.<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:11%; margin-top: 1em\">Specifying more than one of the mutually-exclusive options <b>\u2212L<\/b> and <b>\u2212P<\/b> shall not be considered an error. The last option specified shall determine the behavior of the utility (unless the <b>\u2212s<\/b> option causes it to be ignored).<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">If the <b>\u2212s<\/b> option is not specified and neither a <b>\u2212L<\/b> nor a <b>\u2212P<\/b> option is specified, it is implementation-defined which of the <b>\u2212L<\/b> and <b>\u2212P<\/b> options will be used as the default.<\/p>\n<h2>OPERANDS <a name=\"OPERANDS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The following operands shall be supported: <i><br \/> source_file<\/i><\/p>\n<p style=\"margin-left:26%;\">A pathname of a file to be linked. If the <b>\u2212s<\/b> option is specified, no restrictions on the type of file or on its existence shall be made. If the <b>\u2212s<\/b> option is not specified, whether a directory can be linked is implementation-defined.<\/p>\n<p style=\"margin-left:11%;\"><i>target_file<\/i><\/p>\n<p style=\"margin-left:26%;\">The pathname of the new directory entry to be created.<\/p>\n<p style=\"margin-left:11%;\"><i>target_dir<\/i><\/p>\n<p style=\"margin-left:26%;\">A pathname of an existing directory in which the new directory entries are created.<\/p>\n<h2>STDIN <a name=\"STDIN\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Not used.<\/p>\n<h2>INPUT FILES <a name=\"INPUT FILES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">None.<\/p>\n<h2>ENVIRONMENT VARIABLES <a name=\"ENVIRONMENT VARIABLES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The following environment variables shall affect the execution of <i>ln<\/i>:<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"12%\">\n<p><i>LANG<\/i><\/p>\n<\/td>\n<td width=\"3%\"><\/td>\n<td width=\"74%\">\n<p>Provide a default value for the internationalization variables that are unset or null. (See the Base Definitions volume of POSIX.1-2017, <i>Section 8.2<\/i>, <i>Internationalization Variables<\/i> for the precedence of internationalization variables used to determine the values of locale categories.)<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"12%\">\n<p><i>LC_ALL<\/i><\/p>\n<\/td>\n<td width=\"3%\"><\/td>\n<td width=\"74%\">\n<p>If set to a non-empty string value, override the values of all the other internationalization variables.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"12%\">\n<p><i>LC_CTYPE<\/i><\/p>\n<\/td>\n<td width=\"3%\"><\/td>\n<td width=\"74%\">\n<p>Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multi-byte characters in arguments).<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:11%;\"><i>LC_MESSAGES<\/i><\/p>\n<p style=\"margin-left:26%;\">Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"11%\">\n<p><i>NLSPATH<\/i><\/p>\n<\/td>\n<td width=\"4%\"><\/td>\n<td width=\"74%\">\n<p>Determine the location of message catalogs for the processing of <i>LC_MESSAGES<\/i>.<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<h2>ASYNCHRONOUS EVENTS <a name=\"ASYNCHRONOUS EVENTS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Default.<\/p>\n<h2>STDOUT <a name=\"STDOUT\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Not used.<\/p>\n<h2>STDERR <a name=\"STDERR\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The standard error shall be used only for diagnostic messages.<\/p>\n<h2>OUTPUT FILES <a name=\"OUTPUT FILES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">None.<\/p>\n<h2>EXTENDED DESCRIPTION <a name=\"EXTENDED DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">None.<\/p>\n<h2>EXIT STATUS <a name=\"EXIT STATUS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The following exit values shall be returned:<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"3%\">\n<p style=\"margin-top: 1em\">0<\/p>\n<\/td>\n<td width=\"6%\"><\/td>\n<td width=\"75%\">\n<p style=\"margin-top: 1em\">All the specified files were linked successfully.<\/p>\n<\/td>\n<td width=\"5%\"> <\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"3%\">\n<p>>0<\/p>\n<\/td>\n<td width=\"6%\"><\/td>\n<td width=\"75%\">\n<p>An error occurred.<\/p>\n<\/td>\n<td width=\"5%\"> <\/td>\n<\/tr>\n<\/table>\n<h2>CONSEQUENCES OF ERRORS <a name=\"CONSEQUENCES OF ERRORS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Default.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>The following sections are informative.<\/i><\/p>\n<h2>APPLICATION USAGE <a name=\"APPLICATION USAGE\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">None.<\/p>\n<h2>EXAMPLES <a name=\"EXAMPLES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">None.<\/p>\n<h2>RATIONALE <a name=\"RATIONALE\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The CONSEQUENCES OF ERRORS section does not require <i>ln<\/i> <b>\u2212f<\/b> <i>a b<\/i> to remove <i>b<\/i> if a subsequent link operation would fail.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Some historic versions of <i>ln<\/i> (including the one specified by the SVID) unlink the destination file, if it exists, by default. If the mode does not permit writing, these versions prompt for confirmation before attempting the unlink. In these versions the <b>\u2212f<\/b> option causes <i>ln<\/i> not to attempt to prompt for confirmation.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">This allows <i>ln<\/i> to succeed in creating links when the target file already exists, even if the file itself is not writable (although the directory must be). Early proposals specified this functionality.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">This volume of POSIX.1-2017 does not allow the <i>ln<\/i> utility to unlink existing destination paths by default for the following reasons:<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"12%\"><\/td>\n<td width=\"2%\">\n<p style=\"margin-top: 1em\">*<\/p>\n<\/td>\n<td width=\"3%\"><\/td>\n<td width=\"83%\">\n<p style=\"margin-top: 1em\">The <i>ln<\/i> utility has historically been used to provide locking for shell applications, a usage that is incompatible with <i>ln<\/i> unlinking the destination path by default. There was no corresponding technical advantage to adding this functionality.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"12%\"><\/td>\n<td width=\"2%\">\n<p>*<\/p>\n<\/td>\n<td width=\"3%\"><\/td>\n<td width=\"83%\">\n<p>This functionality gave <i>ln<\/i> the ability to destroy the link structure of files, which changes the historical behavior of <i>ln<\/i>.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"12%\"><\/td>\n<td width=\"2%\">\n<p>*<\/p>\n<\/td>\n<td width=\"3%\"><\/td>\n<td width=\"83%\">\n<p>This functionality is easily replicated with a combination of <i>rm<\/i> and <i>ln<\/i>.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"12%\"><\/td>\n<td width=\"2%\">\n<p>*<\/p>\n<\/td>\n<td width=\"3%\"><\/td>\n<td width=\"83%\">\n<p>It is not historical practice in many systems; BSD and BSD-derived systems do not support this behavior. Unfortunately, whichever behavior is selected can cause scripts written expecting the other behavior to fail.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"12%\"><\/td>\n<td width=\"2%\">\n<p>*<\/p>\n<\/td>\n<td width=\"3%\"><\/td>\n<td width=\"83%\">\n<p>It is preferable that <i>ln<\/i> perform in the same manner as the <i>link<\/i>() function, which does not permit the target to exist already.<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:11%; margin-top: 1em\">This volume of POSIX.1-2017 retains the <b>\u2212f<\/b> option to provide support for shell scripts depending on the SVID semantics. It seems likely that shell scripts would not be written to handle prompting by <i>ln<\/i> and would therefore have specified the <b>\u2212f<\/b> option.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The <b>\u2212f<\/b> option is an undocumented feature of many historical versions of the <i>ln<\/i> utility, allowing linking to directories. These versions require modification.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Early proposals of this volume of POSIX.1-2017 also required a <b>\u2212i<\/b> option, which behaved like the <b>\u2212i<\/b> options in <i>cp<\/i> and <i>mv<\/i>, prompting for confirmation before unlinking existing files. This was not historical practice for the <i>ln<\/i> utility and has been omitted.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The <b>\u2212L<\/b> and <b>\u2212P<\/b> options allow for implementing both common behaviors of the <i>ln<\/i> utility. Earlier versions of this standard did not specify these options and required the behavior now described for the <b>\u2212L<\/b> option. Many systems by default or as an alternative provided a non-conforming <i>ln<\/i> utility with the behavior now described for the <b>\u2212P<\/b> option. Since applications could not rely on <i>ln<\/i> following links in practice, the <b>\u2212L<\/b> and <b>\u2212P<\/b> options were added to specify the desired behavior for the application.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The <b>\u2212L<\/b> and <b>\u2212P<\/b> options are ignored when <b>\u2212s<\/b> is specified in order to allow an alias to be created to alter the default behavior when creating hard links (for example, <i>alias ln<\/i>=&#8217;<i>ln<\/i> <b>\u2212L<\/b>&#8216;). They serve no purpose when <b>\u2212s<\/b> is specified, since <i>source_file<\/i> is then just a string to be used as the contents of the created symbolic link and need not exist as a file.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The specification ensures that <i>ln<\/i> <b>a a<\/b> with or without the <b>\u2212f<\/b> option will not unlink the file <b>a<\/b>. Earlier versions of this standard were unclear in this case.<\/p>\n<h2>FUTURE DIRECTIONS <a name=\"FUTURE DIRECTIONS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">None.<\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>chmod<\/i>, <i>find<\/i>, <i>pax<\/i>, <i>rm<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The Base Definitions volume of POSIX.1-2017, <i>Chapter 8<\/i>, <i>Environment Variables<\/i>, <i>Section 12.2<\/i>, <i>Utility Syntax Guidelines<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The System Interfaces volume of POSIX.1-2017, <i>link<\/i>(), <i>unlink<\/i>()<\/p>\n<h2>COPYRIGHT <a name=\"COPYRIGHT\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology &#8212; Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http:\/\/www.opengroup.org\/unix\/online.html .<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https:\/\/www.kernel.org\/doc\/man-pages\/reporting_bugs.html .<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  ln \u2014 link files <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3782,1],"tags":[2543,2511],"class_list":["post-5730","post","type-post","status-publish","format-standard","hentry","category-1p-posix-comandos-generales","category-sin-categoria","tag-ln","tag-man1p"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/5730","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=5730"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/5730\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=5730"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=5730"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=5730"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}