CompTIA Linux+ (XK0-005) — Question 274
A systems administrator is analyzing the data usage on a Linux system. Which of the following commands will display a list of the entire /var contents along with sizes?
Answer options
- A. ls –ltr /var | sort –n
- B. df –h /var
- C. du –ah /var/
- D. lsblk /var
Correct answer: C
Explanation
The correct command is 'du –ah /var/' because it provides a detailed list of files and directories along with their sizes in the specified path. The 'ls –ltr /var | sort –n' command lists files but does not show sizes, 'df –h /var' displays available disk space but not individual file sizes, and 'lsblk /var' shows block device information, which is irrelevant to file sizes.