Multiple choice unix

Which of the following options will be used to display number of blocks used by a file?

  1. -c

  2. -i

  3. -d

  4. -s

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

The -d option displays the number of blocks used by a file, showing disk usage in block units rather than the default byte count. This is useful when you need to see file size in filesystem blocks.

AI explanation

The intended answer is -s, not -d. In standard Unix/Linux ls, the -s flag prints the size of each file in blocks (the allocation units on disk), which is exactly "number of blocks used by a file." -d instead tells ls to list a directory entry itself rather than its contents — it has nothing to do with block counts. -i shows the inode number, and -c changes the sort/display to use ctime (or with -l, shows change time) — again unrelated to blocks. Since none of the standard meanings of -d involve block counts, the option marked correct in the database appears to be wrong; -s is the option that actually answers the question.