Which command displays information about a swap device?

Prepare for the Red Hat Certified Systems Admin Exam EX200. Enhance your skills with interactive quizzes, flashcards, and detailed explanations. Ace your certification exam today!

Multiple Choice

Which command displays information about a swap device?

Explanation:
To see which swap spaces are configured and currently in use, you need a command that queries the system’s swap information directly. swap -s prints a concise table of all active swap areas, showing the swap filename or device, its type, total size, how much is used, and the priority. This directly tells you which swap devices exist and how they’re being utilized, which is exactly what the question asks for. Another valid way to view the same data is to read /proc/swaps (for example with cat), but swapon -s is the standard quick method most tooling and scripts rely on. The other options don’t fit as neatly: free -h shows overall memory and swap usage but not the specific devices; swapon -a would enable all swap spaces listed in /etc/fstab rather than display information.

To see which swap spaces are configured and currently in use, you need a command that queries the system’s swap information directly. swap -s prints a concise table of all active swap areas, showing the swap filename or device, its type, total size, how much is used, and the priority. This directly tells you which swap devices exist and how they’re being utilized, which is exactly what the question asks for. Another valid way to view the same data is to read /proc/swaps (for example with cat), but swapon -s is the standard quick method most tooling and scripts rely on. The other options don’t fit as neatly: free -h shows overall memory and swap usage but not the specific devices; swapon -a would enable all swap spaces listed in /etc/fstab rather than display information.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy