LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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!

Notices


Reply
  Search this Thread
Old 02-18-2008, 05:34 AM   #1
ashim.bansal
LQ Newbie
 
Registered: Feb 2008
Posts: 3

Rep: Reputation: 0
Cool Linux Hard link


Dear Friends,

As you must be knowing that when you create a hardlink of any file in linux both files show same info.

If we have to see which of the two files where created first then we donot way to see that because the time shown by both files is also same.


Can anybody please tell me is there any way where we can see which of these files where created first.
 
Old 02-18-2008, 06:35 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by ashim.bansal View Post
Can anybody please tell me is there any way where we can see which of these files where created first.
Directly using 'debugfs' or equivalent tools? No. With the help of "circumstantial evidence" like one's shell history? Yes. If it was logged and still within $HISTSIZE range.

Last edited by unSpawn; 02-18-2008 at 07:27 AM.
 
Old 02-18-2008, 07:15 AM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
I would think that one answer would be: "There are not two files." There are simply two pathways to the same file.
 
Old 02-18-2008, 07:29 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by pixellany View Post
two pathways to the same file.
Short and to the point. Markings of the qualitatively better answer.
 
Old 02-19-2008, 02:30 AM   #5
ashim.bansal
LQ Newbie
 
Registered: Feb 2008
Posts: 3

Original Poster
Rep: Reputation: 0
Thanks for your replies.
As for my knowledge is concerned I think these are not two pathways for same files, as if I delete one file other still exits without any problem. So That means these are two different files.

Still waiting for more appropriate replies.
 
Old 02-19-2008, 02:59 AM   #6
IBall
Senior Member
 
Registered: Nov 2003
Location: Perth, Western Australia
Distribution: Ubuntu, Debian, Various using VMWare
Posts: 2,088

Rep: Reputation: 62
No.

A "file" occupies an area of storage (ie hard disk space). A filename is a link that points to that area. If you create a hard link to the file, you are creating an additional file name for the same file. The file itself is only actually deleted when all the links to it are removed.

--Ian
 
Old 02-19-2008, 04:27 AM   #7
ajaydubey
LQ Newbie
 
Registered: Jun 2007
Posts: 1

Rep: Reputation: 0
hardlink issue

dear ashim
you allredy check with stat filename command and it show the same inode number for both file . that why it not two diffrent file
 
Old 02-19-2008, 07:58 AM   #8
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Quote:
Originally Posted by ashim.bansal View Post
Still waiting for more appropriate replies.
What does this mean? Are you waiting for someone to tell you that it works the way you have imagined?

"appropriate" to me means that the answer is directly relevant to the question and is correct. It does not have to be a complete anwser. Everyone here has given you appropriate answers.

Try an experiment: create two links to a file--one hard and one soft. Then delete the original file. Now try and open each link.

Another: Make multiple hard links to a file and then run df to see how disk space is being used.

Last edited by pixellany; 02-19-2008 at 08:00 AM.
 
  


Reply



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
Difference Between Soft Link & Hard Link rajaniyer123 Solaris / OpenSolaris 16 09-30-2012 03:42 AM
How to link "free space on Hard Drive to LINUX" navin_karnam Linux - Desktop 2 06-21-2007 03:14 AM
Soft Link and Hard Link Moataz Red Hat 1 04-25-2005 06:30 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:12 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