Symlink cheatsheet

A Symbolic Links (also called symlink or softlink), is a special file which references another file or directory. These symlinks are very useful. For example a lot of deployment tools and scripts use symlinks.

This post describes how to manage symlinks.

Usage

Create a new symlink

Usage:

ln -s dir|file symlink_name

Example:

ln -s /var/www/domain/current /var/www/domain/releases/latest

Remove an existing symlink

Usage:

rm symlink_name

Update an existing symlink

Usage:

ln -sfn dir|file symlink_name

Example:

ln -sfn /var/www/domain/current /var/www/domain/releases/latest