nerdexam
CompTIA

LX0-103 · Question #64

Which of the following commands can be used to display the inode number of a given file?

The correct answer is B. ls. The ls command with the -i flag displays the inode number of files alongside their names.

GNU and Unix Commands

Question

Which of the following commands can be used to display the inode number of a given file?

Options

  • Ainode
  • Bls
  • Cln
  • Dcp

How the community answered

(42 responses)
  • A
    2% (1)
  • B
    90% (38)
  • C
    2% (1)
  • D
    5% (2)

Why each option

The ls command with the -i flag displays the inode number of files alongside their names.

Ainode

There is no standard Linux command called 'inode'; inode information is accessed via commands like ls or stat.

BlsCorrect

Running 'ls -i' prepends each filename with its inode number, which is the unique identifier the filesystem uses to store metadata (permissions, timestamps, data block pointers) for that file. The stat command can also show inode numbers, but among the listed options only ls provides this capability.

Cln

ln creates hard or symbolic links between files and does not display inode numbers.

Dcp

cp copies files to a new destination and does not report inode information.

Concept tested: Displaying file inode numbers with ls -i

Source: https://man7.org/linux/man-pages/man1/ls.1.html

Topics

#inode#ls command#file attributes

Community Discussion

No community discussion yet for this question.

Full LX0-103 Practice