Which of the following commands displays the inode number of a file in the Linux operating
system?
A.
cat
B.
ls -i
C.
ls -l
D.
ls
Explanation:
A file’s inode number can easily be found by using the ls command with the -i option.
What is an inode?
An inode is a data structure in Unix file systems, which holds key information about a file. A file is
uniquely identified by its
inode number. An inode contains the following information about a file:
Owner’s user identification number
Owner’s group identification number
Device on which the inode resides
Locking information of the file
Mode and type of file
Number of links to the file
Size of the file
Access and modification time of the file
Modification time of the inode
Addresses of the blocks of the file on the disk
Answer option D is incorrect. ls without arguments lists the names of files and directories in the
current directory.
Answer option A is incorrect. The cat command only displays the contents of a file, not the file’s
inode number.
Answer option C is incorrect. This command displays the long listing of files and directories. It will
not display the inode number of a file.