[ Content | View menu ]

Updating a Symlink

Mark Mzyk | October 9, 2010

For future reference, because for some reason this is difficult to Google (and find the correct answer):

To update a symlink without having to delete it and recreate it:

ln -sfn [source file] [target file]

Why the options sfn?

-s is for creating the symlink and not a hard link
-f is of course to force the update, since it already exists.
-n (or -h, they are the same) says not to follow the existing symlink

These options in combination allow a symlink to a directory to be updated in place.