Operating System - HP-UX
1819803 Members
3257 Online
109607 Solutions
New Discussion юеВ

how to remove a symbolic link

 
SOLVED
Go to solution
Remko Oosenbrug
Contributor

how to remove a symbolic link

i have a symbolic link woctst -> woctst. How kan i remove that symbolic link whithout destroing de directory woctst?
OH No. It's happening again
4 REPLIES 4
Volker Borowski
Honored Contributor
Solution

Re: how to remove a symbolic link

Simply do

rm linkname

without "-r" rm will not delete any dir.

Btw: you can never have a directory and a Symlink with the same name inside the same directory.

If you are in doubt, qualify a full pathname and rename the directory before you delete the link.

Volker
Marcin Wicinski
Trusted Contributor

Re: how to remove a symbolic link

Hi,

Just execute #rm

The file pointed to by the link will not be affected.
Marcin Wicinski
Herve BRANGIER
Respected Contributor

Re: how to remove a symbolic link

Hi

Don't understand : you have a link to himself ?
I think that you can't create a link using the
name of an existing directory/file... If the
link is in the same directory than you directory
I think you have no printables characters in
on of the names. (use ls -lab to have all this
informations). In this case you can delete it
with rm -i to confirm.

When you delete a link to a directory using rm
you don't delete the directory...

HTH

Herv?

Jeffrey S. Sims
Trusted Contributor

Re: how to remove a symbolic link

Hi Remko,

You can use the unlink command to remove a link and leave the file that was linked to. So if you have a file named link2file and it links to the file named filename, the following command will remove the link.

unlink link2file

This is usually in /usr/sbin/unlink so you may need to either su or use sudo to run the command. Hope this helps.

Jeff