https://wiki.cabal.mx/index.php?title=Comandos_de_la_terminal/ln&feed=atom&action=historyComandos de la terminal/ln - Historial de revisiones2024-03-28T23:36:51ZHistorial de revisiones para esta página en el wikiMediaWiki 1.32.1https://wiki.cabal.mx/index.php?title=Comandos_de_la_terminal/ln&diff=5348&oldid=prevRrc en 20:01 5 abr 20142014-04-05T20:01:07Z<p></p>
<p><b>Página nueva</b></p><div>__NOTOC__<br />
* [[:#ln | ln]]<br />
<br />
== ln ==<br />
<br />
<syntaxhighlight lang="bash"><br />
[root@Llawyr ComandosDeLaTerminal]# ln --help<br />
Usage: ln [OPTION]... [-T] TARGET LINK_NAME (1st form)<br />
or: ln [OPTION]... TARGET (2nd form)<br />
or: ln [OPTION]... TARGET... DIRECTORY (3rd form)<br />
or: ln [OPTION]... -t DIRECTORY TARGET... (4th form)<br />
In the 1st form, create a link to TARGET with the name LINK_NAME.<br />
In the 2nd form, create a link to TARGET in the current directory.<br />
In the 3rd and 4th forms, create links to each TARGET in DIRECTORY.<br />
Create hard links by default, symbolic links with --symbolic.<br />
By default, each destination (name of new link) should not already exist.<br />
When creating hard links, each TARGET must exist. Symbolic links<br />
can hold arbitrary text; if later resolved, a relative link is<br />
interpreted in relation to its parent directory.<br />
<br />
Mandatory arguments to long options are mandatory for short options too.<br />
--backup[=CONTROL] make a backup of each existing destination file<br />
-b like --backup but does not accept an argument<br />
-d, -F, --directory allow the superuser to attempt to hard link<br />
directories (note: will probably fail due to<br />
system restrictions, even for the superuser)<br />
-f, --force remove existing destination files<br />
-i, --interactive prompt whether to remove destinations<br />
-L, --logical dereference TARGETs that are symbolic links<br />
-n, --no-dereference treat LINK_NAME as a normal file if<br />
it is a symbolic link to a directory<br />
-P, --physical make hard links directly to symbolic links<br />
-r, --relative create symbolic links relative to link location<br />
-s, --symbolic make symbolic links instead of hard links<br />
-S, --suffix=SUFFIX override the usual backup suffix<br />
-t, --target-directory=DIRECTORY specify the DIRECTORY in which to create<br />
the links<br />
-T, --no-target-directory treat LINK_NAME as a normal file always<br />
-v, --verbose print name of each linked file<br />
--help display this help and exit<br />
--version output version information and exit<br />
<br />
The backup suffix is '~', unless set with --suffix or SIMPLE_BACKUP_SUFFIX.<br />
The version control method may be selected via the --backup option or through<br />
the VERSION_CONTROL environment variable. Here are the values:<br />
<br />
none, off never make backups (even if --backup is given)<br />
numbered, t make numbered backups<br />
existing, nil numbered if numbered backups exist, simple otherwise<br />
simple, never always make simple backups<br />
<br />
Using -s ignores -L and -P. Otherwise, the last option specified controls<br />
behavior when a TARGET is a symbolic link, defaulting to -P.<br />
<br />
Report ln bugs to bug-coreutils@gnu.org<br />
GNU coreutils home page: <http://www.gnu.org/software/coreutils/><br />
General help using GNU software: <http://www.gnu.org/gethelp/><br />
For complete documentation, run: info coreutils 'ln invocation'<br />
<br />
[root@Llawyr ComandosDeLaTerminal]# ln --version<br />
ln (GNU coreutils) 8.21<br />
Copyright (C) 2013 Free Software Foundation, Inc.<br />
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.<br />
This is free software: you are free to change and redistribute it.<br />
There is NO WARRANTY, to the extent permitted by law.<br />
<br />
Written by Mike Parker and David MacKenzie.<br />
<br />
[root@Llawyr ComandosDeLaTerminal]# ln STRERR HLSTERR<br />
<br />
[root@Llawyr ComandosDeLaTerminal]# ls -ali STRERR HLSTERR <br />
8521820 -rw------- 2 rrc rrc 44 Nov 16 13:10 HLSTERR<br />
8521820 -rw------- 2 rrc rrc 44 Nov 16 13:10 STRERR<br />
<br />
[root@Llawyr ComandosDeLaTerminal]# rm STRERR <br />
rm: remove regular file ‘STRERR’? y<br />
<br />
[root@Llawyr ComandosDeLaTerminal]# ls -ali STRERR HLSTERR <br />
ls: cannot access STRERR: No such file or directory<br />
8521820 -rw------- 1 rrc rrc 44 Nov 16 13:10 HLSTERR<br />
<br />
[root@Llawyr ComandosDeLaTerminal]# ln -s HLSTERR STDERR<br />
<br />
[root@Llawyr ComandosDeLaTerminal]# ls -ali STDERR <br />
8523095 lrwxrwxrwx 1 root root 7 Apr 4 15:31 STDERR -> HLSTERR<br />
<br />
[root@Llawyr ComandosDeLaTerminal]# rm HLSTERR <br />
rm: remove regular file ‘HLSTERR’? y<br />
<br />
[root@Llawyr ComandosDeLaTerminal]# ls -ali STDERR HLSTDERR<br />
ls: cannot access HLSTDERR: No such file or directory<br />
8523095 lrwxrwxrwx 1 root root 7 Apr 4 15:31 STDERR -> HLSTERR<br />
<br />
[rrc@Llawyr ComandosDeLaTerminal]$ ln -s ../../../var/www/html/linuxcabal.org <br />
<br />
[rrc@Llawyr ComandosDeLaTerminal]$ ls -al linuxcabal.org<br />
lrwxrwxrwx 1 rrc rrc 36 Apr 4 16:31 linuxcabal.org -> ../../../var/www/html/linuxcabal.org/<br />
<br />
[rrc@Llawyr ComandosDeLaTerminal]$ ln -s ../../var/www/html/richard <br />
ln: failed to create symbolic link ‘./richard’: File exists<br />
<br />
[rrc@Llawyr ComandosDeLaTerminal]$ ln -sf ../../var/www/html/richard <br />
<br />
[rrc@Llawyr ComandosDeLaTerminal]$ ls -al richard<br />
lrwxrwxrwx 1 rrc rrc 26 Apr 4 16:34 richard -> ../../var/www/html/richard<br />
<br />
[root@pridd ComandosDeLaTerminal]# ln -is ../../../var/www/html/richard <br />
ln: replace ‘./richard’? <br />
<br />
[root@pridd ComandosDeLaTerminal]# ls -al richard<br />
lrwxrwxrwx 1 root root 29 Apr 5 13:51 richard -> ../../../var/www/html/richard/<br />
<br />
[root@pridd ComandosDeLaTerminal]# ln -sr /var/www/html <br />
<br />
[root@pridd ComandosDeLaTerminal]# ls -al html<br />
lrwxrwxrwx 1 root root 21 Apr 5 13:53 html -> ../../../var/www/html/<br />
<br />
[root@pridd ComandosDeLaTerminal]# ls -al C1/C2/C3<br />
total 12<br />
drwxrwxrwx 3 rrc rrc 4096 Mar 22 16:03 ./<br />
drwxrwxrwx 3 rrc rrc 4096 Mar 22 16:03 ../<br />
drwxrwxrwx 3 rrc rrc 4096 Mar 22 16:04 C4/<br />
<br />
[root@pridd ComandosDeLaTerminal]# ln -st C1/C2/C3 /var/www/html/richard<br />
[root@pridd ComandosDeLaTerminal]# ls -al C1/C2/C3<br />
total 12<br />
drwxrwxrwx 3 rrc rrc 4096 Apr 5 13:57 ./<br />
drwxrwxrwx 3 rrc rrc 4096 Mar 22 16:03 ../<br />
drwxrwxrwx 3 rrc rrc 4096 Mar 22 16:04 C4/<br />
lrwxrwxrwx 1 root root 21 Apr 5 13:57 richard -> /var/www/html/richard/<br />
<br />
[root@pridd ComandosDeLaTerminal]# ln -irst C1/C2/C3 /var/www/html/richard<br />
ln: replace ‘C1/C2/C3/richard’? y<br />
<br />
[root@pridd ComandosDeLaTerminal]# ls -al C1/C2/C3<br />
total 12<br />
drwxrwxrwx 3 rrc rrc 4096 Apr 5 13:57 ./<br />
drwxrwxrwx 3 rrc rrc 4096 Mar 22 16:03 ../<br />
drwxrwxrwx 3 rrc rrc 4096 Mar 22 16:04 C4/<br />
lrwxrwxrwx 1 root root 38 Apr 5 13:57 richard -> ../../../../../../var/www/html/richard/<br />
<br />
[root@pridd ComandosDeLaTerminal]# ln -sriv /var/www/html/richard<br />
ln: replace ‘./richard’? y<br />
‘./richard’ -> ‘../../../var/www/html/richard’<br />
<br />
</syntaxhighlight><br />
<br />
[[Category:Comandos de la terminal]]</div>Rrc