Symbolic Links

Symbolic links come in real handy when you need to create multiple paths to the same directory. Why would you need to do this? Dependencies are one great reason. Let’s say you install a new package that needs to be configured to point to another library, and let’s suppose that library gets updated, and let’s also suppose that instead of updating it in place, you install the new version alongside the old. Let’s use php as an example. Let’s say you want to upgrade to 5.3 from 5.2. Your old installation is sitting in a folder called php. You can safely install the new version in a folder called 5.3.x and create a symbolic link called php to point to the new version.

Create a symbolic link to a file

#syntax = ln -s {/path/to/file-name} {link-name}
ln -s /my/directory/data/file.txt new-link.txt

Create a symbolic link to a directory

ln -s /my/existing/directory newlink
Snippets and tagged