I made a symlink to a directory like this:

ln -s /some/directory symlink

Now I'd like to remove the symlink:

rm symlink/

This doesn't work. The error message is:

rm: cannot remove 'symlink/': Is a directory

What am I doing wrong? Why does rm claim my symlink is a directory? How to remove the symlink properly?


1 Answer 1


There is this question: When should I use a trailing slash on a directory? and one of the answers says:

rm won't let you remove a symlink to a directory if there's a slash at the end

It's like you told rm the object is a directory.

rm symlink/   # wrong
rm symlink    # right

Not the answer you're looking for? Browse other questions tagged .