Remove a symlink to a directory

前端 未结 11 996
情深已故
情深已故 2020-12-02 03:16

I have a symlink to an important directory. I want to get rid of that symlink, while keeping the directory behind it.

I tried rm and get back rm

11条回答
  •  既然无缘
    2020-12-02 03:48

    # this works:
    rm foo
    # versus this, which doesn't:
    rm foo/
    

    Basically, you need to tell it to delete a file, not delete a directory. I believe the difference between rm and rmdir exists because of differences in the way the C library treats each.

    At any rate, the first should work, while the second should complain about foo being a directory.

    If it doesn't work as above, then check your permissions. You need write permission to the containing directory to remove files.

提交回复
热议问题