如何删除目录的软链接?

如何删除目录的软链接?
[murphy@eva02 playg]$ ls -l
total 12
drwxrwxr-x. 2 murphy murphy 4096 Jul 22 14:02 dir1
lrwxrwxrwx. 1 murphy murphy    4 Jul 22 14:03 dir1-sym -> dir1
drwxrwxr-x. 2 murphy murphy 4096 Jul 22 14:02 dir2
-rw-r--r--. 3 murphy murphy 2690 Jul 22 13:59 fun
lrwxrwxrwx. 1 murphy murphy    3 Jul 22 14:01 fun-sym -> fun
[murphy@eva02 playg]$ rm -i fun
rm: remove regular file 'fun'? y
[murphy@eva02 playg]$ ls -l
total 8
drwxrwxr-x. 2 murphy murphy 4096 Jul 22 14:02 dir1
lrwxrwxrwx. 1 murphy murphy    4 Jul 22 14:03 dir1-sym -> dir1
drwxrwxr-x. 2 murphy murphy 4096 Jul 22 14:02 dir2
lrwxrwxrwx. 1 murphy murphy    3 Jul 22 14:01 fun-sym -> fun
[murphy@eva02 playg]$ rm fun-sym dir1-sym/
rm: cannot remove 'dir1-sym/': Is a directory
[murphy@eva02 playg]$ ls -l
total 8
drwxrwxr-x. 2 murphy murphy 4096 Jul 22 14:02 dir1
lrwxrwxrwx. 1 murphy murphy    4 Jul 22 14:03 dir1-sym -> dir1
drwxrwxr-x. 2 murphy murphy 4096 Jul 22 14:02 dir2
[murphy@eva02 playg]$ rm -f dir1-sym/
rm: cannot remove 'dir1-sym/': Is a directory
[murphy@eva02 playg]$ rm -r dir1-sym/
rm: cannot remove 'dir1-sym/': Not a directory
[murphy@eva02 playg]$ rm -rf dir1-sym/
[murphy@eva02 playg]$ ls -l
total 8
drwxrwxr-x. 2 murphy murphy 4096 Jul 22 14:04 dir1
lrwxrwxrwx. 1 murphy murphy    4 Jul 22 14:03 dir1-sym -> dir1
drwxrwxr-x. 2 murphy murphy 4096 Jul 22 14:02 dir2

funfun-sym很容易被删除...与 不一样吗dir1-sym?我怎样才能删除它?

诗。这是书本练习的一部分。我想这是错误的...

答案1

省略斜杠:

rm dir1-sym

这将删除符号链接。

相关内容