117-101 · Question #228
Which of the following commands will print the amount of disk space used by files specified on the command line?
The correct answer is D. du. See the full explanation below for the reasoning.
Question
Options
- Adc
- Bdd
- Cdf
- Ddu
How the community answered
(33 responses)- A12% (4)
- B3% (1)
- C6% (2)
- D79% (26)
Community Discussion
5D is your answer, no debate. du stands for disk usage and it reports how much space the files or directories you hand it on the command line are actually consuming, while dc is a calculator, dd copies block data, and df shows free space on whole filesystems, not individual files.
du measures actual file usage, not df (free space) -- so why does df confuse so many people here?
I almost marked C thinking df was the one since I use it constantly to check filesystem space on servers, but df reports on the whole filesystem or mount point, not individual files you hand it on the command line. Once I remembered that du, disk usage, takes specific file and directory arguments and totals them up, D was the clear pick.
du is your storage bill per folder/file. Why does df feel tempting here?
I jumped straight to C thinking df was the move since we talk about df all the time for checking disk space, but df reports on whole filesystems, not on specific files you hand it on the command line. What clicked for me was remembering that du, disk usage, is the one that actually walks whatever paths you give it and reports back how much space those files or directories are eating up. So the answer is D, du, and the key distinction is file-level versus filesystem-level reporting. Anyone else get tripped up by df here, or did your group land on du pretty quickly?