LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-05-2011, 09:43 PM   #1
lityit
LQ Newbie
 
Registered: Oct 2011
Posts: 8

Rep: Reputation: Disabled
Thumbs up Why do symbolic links retain data of deleted files to which they previously linked


How and why do symbolic links retain data of deleted files to which they previously linked

Suppose I have a textfile located at:

/home/user/textfile.txt

And I create a symbolic link:

ln -sv /home/usr/textfile.txt /home/otheruser/link_name

Then suppose I remove the original text file:

rm /home/user/textfile.txt

And I issue the following command:

cat /home/otheruser/link_name

cat will still display all of the text from the original deleted text file. How is this possible?

How and why does it do this?
 
Old 11-05-2011, 10:04 PM   #2
vharishankar
Senior Member
 
Registered: Dec 2003
Distribution: Debian
Posts: 3,178
Blog Entries: 4

Rep: Reputation: 138Reputation: 138
Hm... I cannot reproduce that behaviour. Symbolic links are just that. They don't hold any data.

This might be related to permissions. This might seem a bit obvious but are you absolutely sure the original file got deleted with the rm command?

Yes, but on the other hand "hard links" work the way you described.

Last edited by vharishankar; 11-05-2011 at 10:05 PM.
 
Old 11-05-2011, 10:35 PM   #3
lityit
LQ Newbie
 
Registered: Oct 2011
Posts: 8

Original Poster
Rep: Reputation: Disabled
Turns out I was linking to the wrong file (which was not deleted).
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How To Undelete Previously Deleted Files 9876543210 Linux - General 1 10-22-2010 08:28 PM
can I create symbolic links for multiple files simutaneously cliffyao Linux - Newbie 3 02-18-2010 03:11 PM
how to create jar files with symbolic links alps963 Linux - General 1 05-03-2008 06:30 AM
Gentoo-Im dumb and deleted /boot/boot Grub Says: Error 26 : Too many symbolic links smehi Linux - Software 5 06-24-2006 06:25 AM
How to search for files that are symbolic links pointing to a particular file? Akhran Linux - Newbie 1 10-13-2005 07:32 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:20 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration