Ln (Unix)

ln
Original author(s)AT&T Bell Laboratories
Developer(s)Various open-source and commercial developers
Initial releaseNovember 3, 1971; 52 years ago (1971-11-03)
Operating systemUnix, Unix-like, IBM i
PlatformCross-platform
TypeCommand
Licensecoreutils: GPLv3+

The ln command is a standard Unix command utility used to create a hard link or a symbolic link (symlink) to an existing file or directory.[1] The use of a hard link allows multiple filenames to be associated with the same file since a hard link points to the inode of a given file, the data of which is stored on disk. On the other hand, symbolic links are special files that refer to other files by name.[2]

The ln command by default creates hard links, and when called with the command line parameter ln -s creates symbolic links.[3] Most operating systems prevent hard links to directories from being created since such a capability could disrupt the structure of a file system and interfere with the operation of other utilities.[4] The ln command can however be used to create symbolic links to non-existent files.[2]

  1. ^ Kernighan, Brian W.; Pike, Rob (1984). The Unix programming environment. Englewood Cliffs, N.J.: Prentice-Hall. p. 59. ISBN 013937681X.
  2. ^ a b "GNU Coreutils: ln invocation". gnu.org. Free Software Foundation, Inc. Retrieved 7 August 2015.
  3. ^ "ln - The Open Group Base Specifications Issue 7". pubs.opengroup.org. The IEEE and The Open Group. Retrieved 7 August 2015.
  4. ^ "Why are hard links not allowed to directories in UNIX/Linux?". unix.stackexchange.com. Retrieved 7 August 2015.