Delete symlink

October 4, 2013

111 words, a 1 minutes read

To delete a symlink (only the link), you treat it like a file.

However, if you try this, you get:
(“r” is my symlink)

rm r/
rm: cannot remove `r/': Is a directory

Ok, if rm is of no help, rmdir should, as it (sort of) tells me

rmdir r/
rmdir: failed to remove `r/': Not a directory

Uh-oh.

I then went on the Internet (Top Gear reference intended) and found out, what the problem was:
The / (slash) on “r/”

rm r

went just fine :)

Well, where did it come from? Tab completion.

Lesson learned: Tab completion is only 99.8% right. Where has that other .1% gone? Safety margin.