Create a hard link in UNIX
Posted October 9, 2003 by Quinn McHenry in UNIX
Last Updated on
A hard link is a reference to a file or directory that appears just like a file or directory, not a link. Hard links only work within a filesystem. In other words, don’t use hard links between mounted filesystems. A hard link is only a reference to the original file, not a copy of the file. If the original file is deleted, the information will be lost.
To create a hard link of the file /export/home/fred/stuff to /var/tmp/thing, use:
ln /export/home/fred/stuff /var/tmp/thing
The syntax for creating a hard link of a directory is the same. To create a hard link of /var/www/html to /var/www/webroot, use:
ln /var/www/html /var/www/webroot
See also: Create a symbolic link in UNIX
About Quinn McHenry
View more articles by Quinn McHenry
The Conversation
Follow the reactions below and share your own thoughts.