RSS

How to create soft link with ln command in linux

29 Dec

To make links between files you need to use ln command. A symbolic link (also known as a soft link or symlink) consists of a special type of file that serves as a reference to another file or directory. Unix/Linux like operating systems often uses symbolic links.
Two types of links

There are two types of links

symbolic links: Refer to a symbolic path indicating the abstract location of another file
hard links : Refer to the specific location of physical data.

How do I create soft link / symbolic link?

To create a symbolic link in Unix or Linux, at the shell prompt, enter the following command:
ln -s {target-filename} {symbolic-filename}

For example create softlink for /home/gurjot/Desktop/syllabi.pdf as /home/gurjot/study/syllabi1.pdf, enter the following command:
ln -s /home/gurjot/Desktop/syllabi.pdf  /home/gurjot/study/syllabi1.pdf
ls -l /home/gurjot/Desktop/syllabi.pd
f

Output:

lrwxrwxrwx 1 gurjot  gurjot   16 2011-08-12 22:53 syllabi1.pdf -> /home/gurjot/Desktop/syllabi.pdf

Advertisement
 
Leave a comment

Posted by on December 29, 2011 in Uncategorized

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.