Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Distribution: OpenSuse 10.2, Slackware 11, Solaris 10
softlinks vs hardlinks
I read form a source that if hardlinks to a file exist, the file can not be deleted until the hardlinks are removed? I tried this in my openSUSE 10.2 installation, and to my surprise I could remove the file with hardlinks, but the hardlinks were not behaving as links at all, rather when I created a hardlink like this:
ln filename linkname
Then removed filename, the file named linkname was an exact copy of the original file, and rm gave no errors removing the original file. Rather symbolic links behaved as links, and if the original file was removed the link became invalid, rather the hardlink retained the content? So what is the difference b/w simple copy and a hardlink then?
a hard link is *NOT* a copy of a file, you clearly haven't done your reading. it is *THE* same file, but with a different name in the file table. a normal file is a file with one hard link. if you use ln to add a hard link, then it is a file with two hard links. both names are equal and one does not depend on the other.
you do not delete "files", you delete references (hardlinks) to spaces of disk. all the time something in the fat table references a piece of disk space, then the contents of that space is reachable as a file.
The number of links to the contents of your file, stored on disk, is stored.
Each time a new hard link is created, this link count is increased by one.
Each time you delete a hard link, the link count is decreased by one. It's only when the link count reaches
0, that the file contents are actually marked for deletion/overwriting on the disk itself.
I suggest you also read up on inodes, if this interests you.