-   Red Hat (
-   -   Softlinks - cannot delete (

dajomu 08-17-2005 03:42 AM

Softlinks - cannot delete
This is the result from a posting I had on the Newbie forum, but I still don't have an answer. Maybe somone specialized in Red Hat would know what the problem could be?

I made a softlink "ln -s" from the directory /var/www/html/public_html --> /home/ddd/public_html
but now I want to delete public_html so I tried;


rmdir /var/www/html/public_html but I got the error:
rmdir: `public_html/': Not a directory

Then I tried;


rm -d /var/www/html/public_html but I got the error:
rm: cannot remove directory `public_html/': Is a directory

Any solutions out there?



How exactly did you issue the
And what does
ls -ld /var/www/html
have to say about it?



I issued the softlink in this manner


ln -s /home/ddd/public_html /var/www/html/public_html

ls -ld /var/www/html/public_html 
drwxr-xr-x  2 ddd ddd 4096 Aug 15 19:49 /var/www/html/public_html/


ls -ld /var/www/html
drwxr-xr-x  5 root root 4096 Aug 15 20:18 /var/www/html/

yes, I am logged on as root.


How bizarre :)

That's an actual directory. And ln -s should have failed.

rm -rf /var/www/html/public_html
should work.



Not working ( post #5)


rm -rf /var/www/html/public_html/
rm: cannot remove `/var/www/html/public_html/': Not a directory

I could probably just leave it like this, but if anyone got
other suggestions that would be nice?

Let me say this is a Clarkconnect 3.1 server running Red Hat Enterprise Linux / CentOS 4 core


uname -a
Linux #1 Fri Jul 8 18:40:48 EDT 2005 i686 i686 i386 GNU/Linux

spooon 08-17-2005 04:03 AM

Is there any difference between these two:

ls -l /var/www/html/public_html
ls -l /var/www/html/public_html/

(Note the lack of trailing slash in the first line; some shells may add or remove the trailing slash when completing, so pay attention.)
If it really is a symlink then the first should tell you about the symlink and the second should tell you about the directory it points to.

Also check

alias ls
to check if ls is aliased to have certain options. In particular, the options "-L" and "-p" may cause ls to follow the symlink.

dajomu 08-17-2005 04:10 AM

softlinks - cannot delete
Output from the suggested commands


ls -l /var/www/html/public_html
Shows where the symlink points to.


ls -l /var/www/html/public_html
lists out the content in /home/ddd/public_html


alias ls
alias ls='ls --color=tty'


alias -p ls
alias cp='cp -i'
alias l.='ls -d .* --color=tty'
alias ll='ls -l --color=tty'
alias ls='ls --color=tty'
alias mv='mv -i'
alias rm='rm -i'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
alias ls='ls --color=tty'

alias -L ls does not work


spooon 08-17-2005 05:18 AM

I don't know what to tell you, except just to do this again:

rm /var/www/html/public_html
amd make sure not to have a trailing slash.

dajomu 08-17-2005 02:36 PM

Thank you so very much Spoon. The solution was the trailing /
Since I used tab to finish the line the / always was present.

I learned something new today.


All times are GMT -5. The time now is 01:35 AM.