Monday 29 August 2016

How To Create Symlinks(Soft Link or Symbolic link) On Linux/Windows


Symbolic link (also symlink or soft link) is the nickname for any file that contains a reference to another file or directory in the form of an absolute or relative path and that affects pathname resolution.

Soft links are basically a pointer to file path  Symlink(Soft link) is actually point to another path (a file name). it resolves the name of the file each time you access it through the symlink. If you move the file, the symlink will not follow and give you an error like file not exist. If you replace the file with another one, keeping the name, the symlink will point to the new file. Symlinks can span filesystems. With symlinks you have very clear distinction between the actual file and symlink, which stores no info beside the path about the file it points to.

In linux OS you can create a symlink

~ $ ln -s <target folder/file path> <symlink file path>

Here -s is to tell, we want to create a symbolic link

Example.

~ $ ln -s /home/satishk/KSPdf /home/satishk/blogFolder/KSPdf

Name of target folder and the symlink folder could be diffrent

~ $ ln -s /home/satishk/KSPdf /home/satishk/blogFolder/newNameOfKSPdf

After creation of symlink you can verify the link by following command or by clicking the symlink folder

 $ readlink KSPdf

result : /home/satishk/KSPdf

To read more about Soft Link or Hard Link you can use following command on your terminal

$ man ln

or can also click here to know more about the ln command


Symlink on windows

The way of symlink creation is on windows is little different from linux. To create a symlink on windows base machine you can you the following command.

Mklink /d <target folder> <symlink file path>

Here /d is to tell, we want to create a symbolic link

mklink /D \MyDocs \Users\User1\Documents

for more info on windows you can click
here

No comments:

Post a Comment

Configer Sublime Text Editor to compile and run java program

Sublime Text is an editor which has the balance between simplicity and power. Many programmers are using Sublime for their daily program...