About nixCraft

Topics

Understanding UNIX / Linux symbolic (soft) and hard links

Posted by Vivek Gite [Last updated: September 25, 2007]

Inodes are associated with precisely one directory entry at a time. However, with hard links it is possible to associate multiple directory entries with a single inode. To create a hard link use ln command:

# ln /root/file1 /root/file2
# ls -l

Above commands create a link to file1.

Hard link vs. Soft link in Linux or UNIX

Soft or symbolic links are just like hard links. It allows to associate multiple filenames with a single file. However, symbolic links allows:

These links behave differently when the source of the link is moved or removed.

How do I create symbolic link?

You can create symbolic link with ln command:
$ ln -s /path/to/ file1.txt file2.txt
$ ls -l

Above command will create a symbolic link to file1.txt. Read man page of ln for more information.
Continue reading rest of the Understanding Linux file system series (this is part VI):

Tell us how we're doing: Please answer a few questions about your experience to help us improve nixCraft.

You may also be interested in other helpful articles:

Discussion on This Article:

  1. Balakumar Says:

    Thank u Vivek Gite Sir,
    for posting very nice article about linux filesystem…

Leave a Reply

We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Tags: , , , , ,

Copyright © 2004-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Sitemap - Powered by Open source software.