What is Symbolic Link or Soft Link means in Linux

May 13, 2011 | By
| 2 Replies More

Symbolic Link or Softlink Linux

Symbolic Link or Soft Link is a special type of file that contains reference which points to another file or directory. Soft Links are often used as a file or folder because they hardly contain any text strings to be interpreted and followed by the operating system.

Soft Links are supported on almost all Redhat distributions. Although Symbolic Links point to their target, they operate independently of their targets. The ln command is used to create Soft Links. So to create a Symbolic link, use the following command syntax:

$ln -s [target directory or file] [symlink shortcut]

For example, to link the /usr/local/lib/sample directory to /sample, use the following command:

$ln -s /usr/local/lib/sample /sample

After creating the symbolic link above, /sample will point to /usr/local/lib/sample, and when user changes directory (CD) to /example, OS shell will automatically change it to /usr/local/lib/example directory. Now if you want to check whether this will work or not simply type:

$ls -la | more
sample -> /usr/local/lib/sample

The output above shows that file named sample points to /usr/local/lib/sample.

There are two types of links

1. Symbolic links:  Refers to a symbolic path indicating the exact location of another file.
2. Hard links :  Refers to the specific location of physical data.

Example creating Symbolic Link / Soft Link

The Soft link command (ln) below, will create a new link (soft) file sample which point to /home/bobbin/faren.sh

$ln -s /home/bobbin/faren.sh sample

This will create a new link(soft) file faren.sh which point to /home/bobbin/faren.sh

$ln -s /home/bobbin/faren.sh

Filed Under : LINUX HOWTO

Tagged With :

Free Linux Ebook to Download

Comments (2)

Trackback URL | Comments RSS Feed

  1. You have uploaded an awesome website.

Leave a Reply

Commenting Policy:
Promotion of your products ? Comment gets deleted.
All comments are subject to moderation.