The paths /var/www/index.html and /srv/site/index.html sit on the same filesystem. Which command's output settles whether they are two names for one inode rather than two independent copies?

LPIC-1 Exam 101-500, objective 104. Devices, Linux filesystems, filesystem hierarchy standard easy

Machine-checked — no person has signed for it. This question was read against the source cited below by an automated pass, which found no contradiction. That is a weaker claim than it sounds: the same kind of process wrote the question, so it can confirm its own mistake.

Treat it as a good draft rather than as settled fact, and read the source below before you rely on it. It is not used in mock exams here — only questions a person has signed for are.

How these questions are written — where each question comes from, what the verification ledger records, and what happens when one is found wrong.

The options

Correct ls -i /var/www/index.html /srv/site/index.html

Correct. -i prints each entry's inode number. Identical inode numbers on the same filesystem mean the two names refer to one and the same file.

Not correct ls -l /var/www/index.html /srv/site/index.html

Wrong on its own. The long listing shows a link count, so a count above 1 tells you other names exist, but it never tells you which names those are.

Not correct ls -s /var/www/index.html /srv/site/index.html

Wrong. -s reports allocated size in blocks. Two separate copies of the same content would show exactly the same figure.

Not correct file /var/www/index.html /srv/site/index.html

Wrong. file guesses content type from magic bytes. It says both are HTML documents whether they share an inode or not.

Why

Identity on a filesystem is the inode number, not the name: every name in a directory is a pointer to an inode, and hard-linked names point at the same one. ls -i exposes that number, and stat prints it too. The link count in ls -l is the count of names attached to the inode, which is a hint that hard links exist but never says where they are; find -samefile or find -inum is how you locate them.

Where this comes from

Cited
manual page ls(1)

Practise this

Reading one question is not practice. The trainer will draw a short set from objective 104 and space the ones you get wrong.

Practise LPIC-1 Exam 101-500

More questions on this objective

All questions on Devices, Linux filesystems, filesystem hierarchy standard

Practise LPIC-1 Exam 101-500