RE: Example of using 'ln'
Posted: 6/16/2003 2:52:27 PMBy: Comfortably Anonymous
Times Read: 2,704
Likes: 0 Dislikes: 0
Topic: Linux
"if you have a hard link /home/myname/hardlink.txt "pointing" to /home/myname/importantinfo.txt and you delete /home/myname/hardlink.txt, you ALSO DELETE /home/myname/importantinfo.txt!! Be careful, a hard link can burn you."
THAT'S NOT TRUE !!!
(I think)
THAT'S NOT TRUE !!!
(I think)
Rating: (You must be logged in to vote)
Discussion View:
By: Comfortably Anonymous
Times Read: 2,704
Likes: 0 Dislikes: 0
Topic: Linux
Replies:
RE: Example of using 'ln'
Posted: 6/16/2003 2:52:27 PMBy: Comfortably Anonymous
Times Read: 2,704
Likes: 0 Dislikes: 0
Topic: Linux
Hmmm... OK, I should have stuck with 'ln -s', I never use ln without the -s.
I did a test and got curious results I'm not sure I understand:
I first created a file called test.txt containing 'blah blah blah'.
I then created a hard link to it with 'ln -s test.txt test2.txt'
I then deleted test2.txt with 'rm test2.txt', and saw that test.txt still existed. (I had expected test.txt to be gone along with test2.txt)
I then created a new hard link with 'ln -s test.txt test3.txt'
I then deleted the original file with 'rm test.txt'
I saw that test.txt was gone, but test3.txt was still there, containing the original 'blah blah blah' content of the previously-deleted test.txt file!
I'm not sure what that's all about. If someone else would like to explain here, it would be most appreciated! :) I never use hard links, so don't know much about them
I did a test and got curious results I'm not sure I understand:
I first created a file called test.txt containing 'blah blah blah'.
I then created a hard link to it with 'ln -s test.txt test2.txt'
I then deleted test2.txt with 'rm test2.txt', and saw that test.txt still existed. (I had expected test.txt to be gone along with test2.txt)
I then created a new hard link with 'ln -s test.txt test3.txt'
I then deleted the original file with 'rm test.txt'
I saw that test.txt was gone, but test3.txt was still there, containing the original 'blah blah blah' content of the previously-deleted test.txt file!
I'm not sure what that's all about. If someone else would like to explain here, it would be most appreciated! :) I never use hard links, so don't know much about them
Rating: (You must be logged in to vote)