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.
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)- A2% (1)
- B90% (38)
- C2% (1)
- D5% (2)
Why each option
The ls command with the -i flag displays the inode number of files alongside their names.
There is no standard Linux command called 'inode'; inode information is accessed via commands like ls or stat.
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.
ln creates hard or symbolic links between files and does not display inode numbers.
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
Community Discussion
No community discussion yet for this question.