Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11
I have a symbolic link that I am trying to remove. I have tried rm -f as root and owener and get.... rm: cannot remove directory 'filename/': Is a directory ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Lit
    Lit is offline
    Just Joined!
    Join Date
    Nov 2007
    Posts
    6

    Cannot remove Symbolic Link


    I have a symbolic link that I am trying to remove. I have tried rm -f as root and owener and get....
    rm: cannot remove directory 'filename/': Is a directory

    I have tried rmdir as root and owner and get...
    rmdir: 'filename/': Not a directory

    I cannot chown the link but it has 777 read/write access.

    Does anyone have any suggestions?

    Thanks.

  2. #2
    Linux Engineer rcgreen's Avatar
    Join Date
    May 2006
    Location
    the hills
    Posts
    1,134
    Did you create it, or was it part of the system as installed?
    Do a ls -l <filename> to list detailed information.

  3. #3
    Lit
    Lit is offline
    Just Joined!
    Join Date
    Nov 2007
    Posts
    6
    Thank you for your quick response....

    It was created when copying a directory. the ls -l list it as a link with full rwx.

  4. #4
    Linux Engineer rcgreen's Avatar
    Join Date
    May 2006
    Location
    the hills
    Posts
    1,134
    ls -l will tell you what file the link points to

    Code:
    rcgreen@kirby:~$ ls -l /bin/sh
    lrwxrwxrwx  1 root root 4 2007-06-20 10:06 /bin/sh -> bash
    In the example, /bin/sh points to bash

    When you see what it points to, list that item and see whether
    it is a file or a directory.

  5. #5
    Lit
    Lit is offline
    Just Joined!
    Join Date
    Nov 2007
    Posts
    6
    It points to a directory.

  6. #6
    Linux Engineer rcgreen's Avatar
    Join Date
    May 2006
    Location
    the hills
    Posts
    1,134
    Were you trying to delete the directory, or just the link?

  7. #7
    Lit
    Lit is offline
    Just Joined!
    Join Date
    Nov 2007
    Posts
    6
    Just the link.

  8. #8
    Linux Engineer rcgreen's Avatar
    Join Date
    May 2006
    Location
    the hills
    Posts
    1,134
    Are you sure it is a symbolic link and not a hard link?

  9. #9
    Lit
    Lit is offline
    Just Joined!
    Join Date
    Nov 2007
    Posts
    6
    It is a link to a directory, so I wouldn't think so. Also, they have different inodes.

  10. #10
    Linux Engineer rcgreen's Avatar
    Join Date
    May 2006
    Location
    the hills
    Posts
    1,134
    So rm <link name> gives an error?

    I have a symbolic link that I am trying to remove. I have tried rm -f as root and owener and get....
    rm: cannot remove directory 'filename/': Is a directory

    I have tried rmdir as root and owner and get...
    rmdir: 'filename/': Not a directory
    BTW, do not put a slash on the filename. it generates an error

    HOWTO: Remove a Symbolic Link

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •