我想问当我删除文件夹符号链接(symbolic link)目标中的文件时,是否可以使该文件在原始文件中仍然可用?
我使用 ls -n/folder/target
但当我删除 /target
中的文件时,原始文件夹中的文件也被删除。
最佳答案
使用 rm
删除符号链接(symbolic link)
rm symlink_name
使用unlink
删除符号链接(symbolic link)
unlink symlink_name
Unlink
command andrm
command without-R
option doesn't delete regular directory. The two commands delete symbolic link from directory because it's considered as a file so, when using the rm or unlink command to remove a symbolic link from a directory, make sure you don’t end the target with a / character because that will create an error
更多内容请阅读documentation 、手册页等
关于linux - linux使用符号链接(symbolic link)时如何使原文件不被删除,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61054770/