commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
-n: dereference the existing link
-v: (optional) to be sure of what is being done
-f: force the deletion of the existing one
-s: creates a symlink
Be careful: the destination can also be a file or a directory and it will be overwritten.
There are 6 alternatives - vote for the best!
Instead of deleting an existing symlink and then re-creating it pointing at the new location, it is possible to perform the same action with this one command.
Interesting discussion on whether this is possible to do atomically here: http://answers.google.com/answers/threadview?id=526119
If you can do better, submit your command here.
You must be signed in to comment.