Wednesday, June 22, 2011

Create, Update, Remove the Symbolic links in Linux/Unix..!

Creating a symbolic link or symlink in UNIX:

Syntax:  ln -s {target-filename} {symbolic-filename}
Eg:         ln -s /krishna/firefox/firefox    /usr/bin/firefox
     -->   cd /usr/bin/
     -->   ls -lrt firefox
output:
             firefox ->  /krishna/firefox/firefox


Updating a symbolic link or symlink in UNIX:

Syntax:  ln -nsf {target-filename} {symbolic-filename}
Eg:         ln -nsf /krishna/newFirefox/firefox    /usr/bin/firefox
     -->   cd /usr/bin/
     -->   ls -lrt firefox
output:
             firefox ->  /krishna/newFirefox/firefox

 


Removing a symbolic link or symlink in UNIX:

Removing a symbolic link is similar to removing any file; 

You need to use “rm” UNIX command to remove any symlink. 

This will only removes symlink and not delete the source directory.

 

Syntax: rm {symbolic-filename}
Eg:        rm /usr/bin/firefox
     -->   cd /usr/bin/
     -->   ls -lrt firefox
output:
             ls: firefox: No such file or directory

Cheers,

No comments:

Post a Comment