LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Red Hat (https://www.linuxquestions.org/questions/red-hat-31/)
-   -   Softlinks - cannot delete (https://www.linuxquestions.org/questions/red-hat-31/softlinks-cannot-delete-354129/)

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;

Code:


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

Then I tried;

Code:


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?

DaJoMu


---------------------------------------------------------------

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


Cheers,
Tink

------------------------------------

I issued the softlink in this manner

Code:


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/


Code:


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.


Cheers,
Tink

------------------------------------------------------

Not working ( post #5)

Code:


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

Code:


uname -a
Linux gateway.xxx.xxx  2.6.9-19.cc #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:
Code:

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
Code:

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

Code:

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

Code:

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

Code:

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

Code:

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

DaJoMu

spooon 08-17-2005 05:18 AM

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

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

dajomu 08-17-2005 02:36 PM

Genius!!
 
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.

Thanks


All times are GMT -5. The time now is 11:16 PM.