Skip to main content
1 of 3
cshu
  • 111
  • 3

File is a widely used concept about entries in a filesystem.

Usually it includes Directory, Regular File (hard link), and Symbolic Link (soft link). And may even include device and socket.

My question is simply what is the difference of a file and a hard link ? Hard link is pointing to an inode, so what is a file ? Inode entry itself ? Or an Inode with a hard link ?

Let's say, I create a file with touch, then an Inode entry is created in the Inode Table. And I create a hard link, which has the same Inode number with the file. So did I create a new file ? Or the file is just defined as an Inode ?

Sinc even symbolic link is usually counted as file, a hard link itself can also be counted as a file. You can say it's a file regardless of whether it's a hard or soft link.

The concept is a bit ambiguous so it's also okay to say that an inode entry is a file, though you may actually want to refer to the data.

cshu
  • 111
  • 3