usage of softlinks
usage of symbolic links
symbolic links also called soft links,soft links is means shortcut as windows,it has different inode as original file. hard link like copy of a file,it has the same inode as original file.
ln -s targetffile/targetdir linkname
how to remove rm linkname unlink linkname
pay attention
if your softlink is point to a directory,when you delete your softlink,DON’T ADD “/” at the end of the link name,or it will delete all the files in the target directory. for example:
so ,for safe use, dont use “-r” option, dont’t add “/” at the end of linkname; use “unlink” is better.
CONCLUSION: DONT ADD “/” AT THE END OF LINKNAME.
symbolic links also called soft links,soft links is means shortcut as windows,it has different inode as original file. hard link like copy of a file,it has the same inode as original file.
ln -s targetffile/targetdir linkname
how to remove
pay attention
if your softlink is point to a directory,when you delete your softlink,DON’T ADD “/” at the end of the link name,or it will delete all the files in the target directory. for example:
mkdir dir
cd dir
touch a.a b.b c.c d.d
cd ..
ln -s dir mylink
unlink mylink //it's ok,it will delete soft link,but won't delete the target dir
unlink mylink/ //it's ok,it will delete soft link,but won't delete the target dir
rm mylink //it 's ok,it wi ll delete soft link,but won't delete the target dir
rm -r mylink //it 's ok,it wi ll delete soft link,but won't delete the target dir
rm -rf mylink //it 's ok,it wi ll delete soft link,but won't delete the target dir
rm -r mylink/ __*IT'S NOT OK,it will delete the target dir !!!*__
so ,for safe use, dont use “-r” option, dont’t add “/” at the end of linkname; use “unlink” is better.
CONCLUSION: DONT ADD “/” AT THE END OF LINKNAME.