Problem Statement
What does the free -h command show?
Explanation
The free command displays memory usage information including total, used, free, shared, buff/cache, and available memory. The -h flag shows values in human-readable format using KB, MB, GB units instead of raw bytes, making it easier to understand at a glance.
Free shows both physical RAM and swap space. The 'available' column indicates memory available for starting new applications without swapping, considering that cached memory can be reclaimed. The buff/cache column shows memory used by kernel buffers and page cache, which can be freed if applications need it.
Common options include free -m (megabytes), free -g (gigabytes), free -s N (continuous updates every N seconds), and free -t (show totals). Example: free -h -s 5 displays human-readable memory stats updating every 5 seconds, useful for monitoring memory during operations.
Understanding free is essential for troubleshooting memory issues, capacity planning, and performance optimization. High swap usage indicates insufficient RAM, while high buff/cache is normal and beneficial. Monitoring memory helps prevent OOM (Out Of Memory) killer from terminating processes unexpectedly.
Practice Sets
This question appears in the following practice sets:
