Symbolic links, or symlinks, are quite useful. Symlinks can be use to point to files or directories. Any operation performed on a symlink is done on the destination that it points to, except removing the symlink. As an example of its usefulness I have used it on servers where you configure an application to use Java but I create and use a symlink which points to the path of the installed version of Java.
Using a symlink I could install a new version of Java and then simply set the symlink to point to the new Java installation instead, which makes life easier and requires no changes to the application config.
<br /> $ cd /usr/local/<br /> $ sudo ln -s jdk1.6.0_30 java<br />
Creating a symlink
<br /> orfels@cbvmorfels01:~$ ln -s music documents/mp3<br />
What we did here was to create a symbolic link to /home/orfels/music in /home/orfels/documents/ called mp3.
Check it out:
<br /> orfels@cbvmorfels01:~$ ls -lh documents/<br /> lrwxrwxrwx 1 orfels orfels 5 Apr 26 10:08 mp3 -> music<br />
The l in the first column indicates that it is a symbolic link. The arrow -> indicates the destination of the link.
Removing a symlink
<br /> orfels@cbvmorfels01:~$ unlink documents/mp3<br />
The symlink has been removed:
<br /> orfels@cbvmorfels01:~$ ls -lh documents/<br /> total 0<br />
No related posts.