cool tech graphics

Removing a Unix sym link

Filed under:

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

Date posted: September 30, 2008

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.

Metal Toad is an Advanced AWS Consulting Partner. Learn more about our AWS Managed Services

Have questions?