ln: Make links between files

A “hard link” is another name for an existing file; the link and the original are indistinguishable. Technically speaking, they share the same inode, and the inode contains all the information about a
file–indeed, it is not incorrect to say that the inode _is_ the file. On all existing implementations, you cannot make a hard link to a directory, and hard links cannot cross file system boundaries. (These
restrictions are not mandated by POSIX, however.)

“Symbolic links” (”symlinks” for short), on the other hand, are a special file type (which not all kernels support: System V release 3 (and older) systems lack symlinks) in which the link file actually
refers to a different file, by name.

`ln’ makes links between files. By default, it makes hard links; with the `-s’ option, it makes symbolic (or “soft”) links. Synopses:

ln [OPTION]… [-T] TARGET LINKNAME
ln [OPTION]… TARGET
ln [OPTION]… TARGET… DIRECTORY
ln [OPTION]… -t DIRECTORY TARGET…

* If two file names are given, `ln’ creates a link to the first file from the second.

* If one TARGET is given, `ln’ creates a link to that file in the current directory.

Example:

@dell:~/x$ ls -li
total 0
1268369 -rw-r–r– 1 user1 user1 0 Jan 13 16:42 1
1268732 lrwxrwxrwx 1 user1 user1 1 Jan 13 16:42 2 -> 1

1268733 -rw-r–r– 2 user1 user1 0 Jan 13 16:43 3
1268733 -rw-r–r– 2 user1 user1 0 Jan 13 16:43 4
@dell:~/x$

Trackback URI | Comments RSS

Leave a Reply

You must be logged in to post a comment.