Dec 13, 2013

How to overwrite symbolic links in unix

You can overwrite symbolic links by using -f to the default command

Example
mohan@mysys /cygdrive/c/
$ ln -s /tmp/test.sh tumba
mohan@mysys /cygdrive/c/
$ ls -l
total 80
lrwxrwxrwx  1 mohan        Domain Users    5 Oct  9 14:59 tumba -> /tmp/test.sh
mohan@mysys /cygdrive/c/
$ ln -s /tmp/build_env.log  tumba
ln: failed to create symbolic link `tumba': File exists
mohan@mysys /cygdrive/c/


 Now we can overwrite the existing symbolic link by using -f







$ ln -s -f /tmp/build_env.log  tumba
mohan@mysys /cygdrive/c/
$ ls -l
total 80
lrwxrwxrwx  1 mohan        Domain Users    5 Oct  9 14:59 tumba -> /tmp/build_env.log

No comments:

Post a Comment