LPIC-1 System Architecture Practice Question
Which command shows the amount of free and used memory in the system, including swap?
⚠ Common exam trap
Many candidates confuse `free` with `df` (disk free) or assume `top` provides a simpler memory summary, but only `free` directly and concisely shows both RAM and swap totals in a single, easy-to-read output.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
free -h
The `free -h` command displays the total, used, and free physical memory (RAM) and swap space in a human-readable format (e.g., GiB, MiB). The `-h` flag ensures output is scaled to appropriate units, making it the direct and correct tool for checking both memory and swap usage.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
top
Why it's wrong here
While `top` displays real-time process activity and includes a memory summary line showing total, used, free, and swap figures, it fails to meet the question’s requirement because it does not provide a dedicated, static snapshot of memory and swap usage on demand; instead, it continuously refreshes a dynamic process list. It is tempting because its header does show memory and swap statistics, making it seem sufficient, and it would be the correct choice if the task were to monitor live memory consumption alongside CPU usage over time.
- ✓
free -h
Why this is correct
`free -h` reads `/proc/meminfo` and reports total, used and available RAM alongside swap usage, with the `-h` flag converting values into human-readable units. This directly satisfies the stem's requirement to display both free and used memory plus swap, unlike `df`, which reports filesystem space instead.
- ✗
df -h
Why it's wrong here
df reports filesystem disk space usage per mounted device; it never reads RAM or swap statistics, so it cannot answer a memory question. It is tempting because df -h presents free and used capacity in human-readable units, which is the correct choice when checking disk partition consumption instead.
- ✗
vmstat
Why it's wrong here
vmstat reports virtual memory statistics, including swap in/out rates and paging activity, but its memory columns show kilobytes of free, buff, and cache rather than the requested total free and used memory summary. It is tempting because vmstat does display swap-related counters, making it the right tool for diagnosing paging pressure over time.
Go deeper
Related to this question
About these practice questions
One of 402 original LPIC-1 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This LPIC-1 practice question is part of Courseiva's free LPI 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 LPIC-1 exam.