Q. Both Linux / UNIX allows the data of a file to have more than one name in separate places in the same file system. Such a file with more than one name for the same data is called a hard-linked file. How do I create a hard link in Linux / UNIX?
A. A hard link to a file is indistinguishable from the original directory entry; any changes to a file are effectively independent of the name used to reference the file. Hard links may not normally refer to directories and may not span file systems.
ln command to make links
ln command make links between files. By default, ln makes hard links.
ln command syntax
ln {source} {link}
Where,
=> source is an existing file
=> link is the file to create
To create hard link for foo file, enter:
ln foo bar
ls -i foo
ls -i bar
Hard links limitations
There are some issues with hard links that can sometimes make them unsuitable. First of all, because the link is identical to the thing it points to, it becomes difficult to give a command such as "list all the contents of this directory recursively but ignore any links". Most modern operating systems don't allow hard links on directories to prevent endless recursion. Another drawback of hard links is that they have to be located within the same file system, and most large systems today consist of multiple file systems.
Featured Articles:
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- My 10 UNIX Command Line Mistakes
- 10 Greatest Open Source Software Of 2009
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- Top 20 OpenSSH Server Best Security Practices
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Linux Video Editor Software
- Email FAQ to a friend
- Download PDF version
- Printable version
- Comment RSS feed
- Last Updated: 10/9/07



{ 2 comments… read them below or add one }
hi i m zafar
i wanna to update in linux command
but i know some cmd so plz me update continu
thanks
hard link
ln -fs file_location link_file_location
where
fs is forcefully and source respectively