Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


Search this Thread
Old 11-19-2003, 08:48 AM   #1
LQ Newbie
Registered: Nov 2003
Distribution: Mandrake 9.1
Posts: 15

Rep: Reputation: 0
Cannot remove symbolic link to directory.

I have
and created a symbolic link to dir2:
ln -s ~/dir1/dir2 ~/symlink

Now I can't remove symlink! I get the errors:

$rm symlink/
rm: cannot remove directory 'testsymboliclink/': Is a directory
$rmdir symlink/
rmdir: 'testsymboliclink/': Not a directory

This is REALLY weird. I even cannot

$unlink symlink/
unlink: 'testsymboliclink/': Not a directory

I can't even remove the link, if the dir is empty. Please help me...

Last edited by martint; 11-19-2003 at 11:45 AM.
Old 11-19-2003, 08:52 AM   #2
Registered: Nov 2003
Location: Chicago, IL
Posts: 238

Rep: Reputation: 30
Just use the remove dir command for the link dir. I assume that link is in a different dir, so just

rmdir /path/to/where/the/link/is
Old 11-19-2003, 09:26 AM   #3
LQ Newbie
Registered: Nov 2003
Distribution: Mandrake 9.1
Posts: 15

Original Poster
Rep: Reputation: 0
I think you dont understand my problem:

When I use rm, it says "Is a directory"
When I use rmdir, it says "Not a directory"
Thats quite absurd...

I've tried to use both relative and absolute paths, none of them works.
Old 11-19-2003, 02:51 PM   #4
Registered: Oct 2003
Distribution: Gentoo rules them all
Posts: 279

Rep: Reputation: 31
DUDE, its
'rm symlink' (without '/' on the end)
1 members found this post helpful.
Old 11-19-2003, 06:43 PM   #5
LQ Newbie
Registered: Nov 2003
Distribution: Mandrake 9.1
Posts: 15

Original Poster
Rep: Reputation: 0
Ahh, thanks!
That must be the first (and last) disadvantage of _tab-completion_ :-)
Old 03-24-2007, 02:50 AM   #6
LQ Newbie
Registered: Mar 2007
Posts: 2

Rep: Reputation: 0
It's all in the completion...

If you do "rm target/", then rm assumes target is a directory without doing any further checking.

Someone should patch rm to remove this stupid behavior...


Last edited by DrDom; 03-24-2007 at 02:52 AM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to check if a parent directory is a symbolic link compnovice Linux - Newbie 11 10-06-2005 05:59 PM
Is there a way to remove a symbolic link Philter Linux - Newbie 3 11-30-2004 06:24 PM
Can't remove symbolic link kimchee411 Linux - Newbie 1 10-06-2004 02:25 AM
directory symbolic link resolution rusti999 Linux - Software 6 08-09-2004 04:13 PM
Symbolic link bwaynej2002 Linux - General 8 08-25-2003 10:06 PM

All times are GMT -5. The time now is 04:22 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration