LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora
User Name
Password
Fedora This forum is for the discussion of the Fedora Project.

Notices

Reply
 
Search this Thread
Old 10-09-2007, 07:22 PM   #1
rhbegin
Member
 
Registered: Oct 2003
Location: Arkansas, NWA
Distribution: Fedora/CentOS/SL6
Posts: 381

Rep: Reputation: 23
Exclamation How to remove a symbolic link without deleting the file


What linux command will enable you to remove a symbolic link without deleting the original file. I used the unlink and it deleted the original file leaving me with a broken symbolic link to clean up.


Basically I need to know how to unlink a symbolic link without removing the original file.

Second, how to clean up the broken symbolic links to free the inodes.

Thanks any help would be greatly appreciated.
 
Old 10-09-2007, 07:30 PM   #2
jailbait
Guru
 
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Debian Wheezy, Debian Jessie
Posts: 7,476

Rep: Reputation: 156Reputation: 156
Quote:
Originally Posted by rhbegin View Post
What linux command will enable you to remove a symbolic link without deleting the original file. I used the unlink and it deleted the original file leaving me with a broken symbolic link to clean up.


Basically I need to know how to unlink a symbolic link without removing the original file.

Second, how to clean up the broken symbolic links to free the inodes.

Thanks any help would be greatly appreciated.
Use the rm command to delete the symbolic link without disturbing the original file. See:

man rm

Second: Use the rm command to remove the broken symbolic links.

-------------
Steve Stites
 
Old 10-09-2007, 07:52 PM   #3
rhbegin
Member
 
Registered: Oct 2003
Location: Arkansas, NWA
Distribution: Fedora/CentOS/SL6
Posts: 381

Original Poster
Rep: Reputation: 23
Question

Quote:
Originally Posted by jailbait View Post
Use the rm command to delete the symbolic link without disturbing the original file. See:

man rm

Second: Use the rm command to remove the broken symbolic links.

-------------
Steve Stites

Thanks for the quick reply Steve, what has happened is that I had created some ssh keys linked the private one to another file I created for another server. In process I used the wrong command deleting my private key for the system.

Take this example, I am really confused on how to remove the symlink, like if you had file1 ---> file2 how do you go about removing the link without deleting the file this is what happens with the rm command???

I am just not understanding the main concept.


Thanks,
Scott
 
Old 10-09-2007, 09:29 PM   #4
AtomicAmish
Member
 
Registered: Dec 2005
Location: East coast, USA
Distribution: Slackware 12.0
Posts: 139

Rep: Reputation: 15
Unlink should do it.

See this thread, post #8.

Last edited by AtomicAmish; 10-09-2007 at 09:38 PM.
 
Old 10-10-2007, 10:38 AM   #5
shafty023
Member
 
Registered: Oct 2007
Distribution: OSX
Posts: 248

Rep: Reputation: 31
If you have a symbolic link ALINK that pointed to AFILE as follows:

ALINK -> AFILE

then you'd simply run this command to remove ALINK
rm ALINK

This will leave AFILE intact.
 
  


Reply


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
Cannot remove symbolic link to directory. martint Linux - Newbie 5 03-24-2007 02:50 AM
Can I delete a symbolic link and the file its linked to? mavness Linux - General 4 02-14-2007 01:31 PM
Checking whether a file is symbolic link or not rajesh_b Programming 3 01-06-2005 10:07 AM
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


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

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