This LFCS practice question tests your understanding of essential commands. Read the scenario carefully and evaluate each option against the stated constraints before committing to an answer. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.
Exhibit
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 20G 20G 0 100% /var
Refer to the exhibit. The /var partition is 100% full. Which command can be used to find the largest files in /var/log to free up space?
Clue words in this question
Noticing these words before you look at the options changes how you read each choice.
Clue: "which command"
Why it matters: Tests specific CLI syntax. Recall the exact command and its required context — near-synonyms and partial matches are common distractors.
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 20G 20G 0 100% /var
A
ls -lS /var/log
Why wrong: ls -lS lists files in the current directory sorted by size, but does not recurse into subdirectories and may not show the largest items overall.
B
find /var/log -size +100M
Why wrong: This finds files larger than 100M but does not sort them by size.
C
du -ah /var/log | sort -rh | head
du recursively calculates disk usage, sorts by size human-readable, and head shows the top entries.
D
df -h /var/log
Why wrong: df shows filesystem usage, not the size of individual files or directories.
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
du -ah /var/log | sort -rh | head
Option C is correct because it uses `du -ah` to list all files and directories in /var/log with human-readable sizes, pipes the output to `sort -rh` to sort them in reverse numerical order (largest first), and then uses `head` to display only the top entries. This combination efficiently identifies the largest files consuming space, allowing the administrator to target specific files for cleanup.
Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
✗
ls -lS /var/log
Why it's wrong here
ls -lS lists files in the current directory sorted by size, but does not recurse into subdirectories and may not show the largest items overall.
✗
find /var/log -size +100M
Why it's wrong here
This finds files larger than 100M but does not sort them by size.
✓
du -ah /var/log | sort -rh | head
Why this is correct
du recursively calculates disk usage, sorts by size human-readable, and head shows the top entries.
Clue confirmation
The clue word "which command" in the question point toward this answer.
Related concept
Read the scenario before looking for a memorised answer.
✗
df -h /var/log
Why it's wrong here
df shows filesystem usage, not the size of individual files or directories.
Common exam traps
Common exam trap: answer the scenario, not the keyword
The trap here is that candidates may choose `ls -lS` (option A) because it sorts by size, but they overlook that it does not recurse into subdirectories, making it ineffective for a directory tree like /var/log that typically contains multiple subdirectories.
Trap categories for this question
Command / output trap
ls -lS lists files in the current directory sorted by size, but does not recurse into subdirectories and may not show the largest items overall.
Detailed technical explanation
How to think about this question
The `du -ah` command with `sort -rh` leverages the `-h` flag for human-readable sizes, which `sort` interprets correctly with the `-h` flag to sort by numeric value (e.g., 1K < 1M < 1G). In real-world scenarios, log rotation failures or runaway daemon logs can fill /var/log with many moderately sized files; using `du` with `sort` and `head` is the standard approach for pinpointing space hogs, whereas `find` with `-size` may miss files just under the threshold that collectively consume significant space.
KKey Concepts to Remember
Read the scenario before looking for a memorised answer.
Find the constraint that changes the correct option.
Eliminate answers that are true in general but not in this case.
TExam Day Tips
→Watch for words such as best, first, most likely and least administrative effort.
→Review why wrong options are wrong, not only why the correct option is correct.
Key takeaway
Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
Real-world example
How this comes up in practice
A small business has 20 workstations on the 192.168.1.0/24 network and one public IP from its ISP. The router uses PAT (NAT overload) so all 20 devices share one public address using different source ports. NAT questions test whether you understand the four address terms and which direction each translation applies.
What to study next
Got this wrong? Here's your next step.
Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.
Essential Commands — This question tests Essential Commands — Read the scenario before looking for a memorised answer..
What is the correct answer to this question?
The correct answer is: du -ah /var/log | sort -rh | head — Option C is correct because it uses `du -ah` to list all files and directories in /var/log with human-readable sizes, pipes the output to `sort -rh` to sort them in reverse numerical order (largest first), and then uses `head` to display only the top entries. This combination efficiently identifies the largest files consuming space, allowing the administrator to target specific files for cleanup.
What should I do if I get this LFCS question wrong?
Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.
Are there clue words in this question I should notice?
Yes — watch for: "which command". Tests specific CLI syntax. Recall the exact command and its required context — near-synonyms and partial matches are common distractors.
What is the key concept behind this question?
Read the scenario before looking for a memorised answer.
About these practice questions
Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
This LFCS practice question is part of Courseiva's free Linux Foundation certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the LFCS exam.
Question Discussion
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
Sign in to join the discussion.