Linux Foundation Certified System Administrator: Disable Swapping Command

Disable Swapping Command

Question

SIMULATION -

Which command will disable swapping on a device? (Specify ONLY the command without any path or parameters.)

Explanations

swapoff -or- /sbin/swapoff

The command to disable swapping on a device in Linux is:

swapoff

This command disables swapping on all devices that have active swap partitions. To disable swapping on a specific device, you would specify the device name as an argument to the command. For example:

bash
swapoff /dev/sdb1

This would disable swapping on the device /dev/sdb1.

It's important to note that disabling swapping on a device will cause all data stored in the swap space to be lost. Therefore, it's recommended that you first use the "free" command to check if there is any swap space being used, and if so, move it to another device before disabling swapping on the original device.