Removing a Unix sym link

If you try deleting a symbolic link like this:

rm -f test/

You get this:

rm: cannot remove `test/': Not a directory

Same deal if you try to use 'rmdir' to delete it.

Here's what works:
Remove the trailing slash from 'test/' and you're all gravy.

Though the sym link looks kind of like a directory, it is just a pointer to the linked file. So just delete it as you would any ol' file.

rm -f test

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <cpp>, <java>, <php>. The supported tag styles are: <foo>, [foo].
  • Web page addresses and email addresses turn into links automatically.
  • Lines and paragraphs break automatically.

Ready for transformation?