Which command shows the amount of free and used memory in the system, including swap?
`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.
Why this answer
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.
Exam trap
The trap here is that candidates may 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.
How to eliminate wrong answers
Option A is wrong because `top` shows real-time process activity and memory usage but does not provide a concise summary of total free and used memory including swap; it focuses on per-process and dynamic system load. Option C is wrong because `df -h` reports disk filesystem usage (e.g., partitions and mount points), not memory or swap. Option D is wrong because `vmstat` reports virtual memory statistics, including swap activity, but its output is more granular and less immediately readable for a simple summary of free and used memory; it requires interpretation of columns like `swpd`, `free`, `buff`, and `cache`.