Linux : How to reallocate swap into memory

By | October 6, 2013

Use the following script if you want to reallocate the content of your swap area back to RAM. Before doing this, make sure you have enough free memory.

#!/bin/bash
echo -e "\nOutput of free before:"
free
swapoff -a ; swapon -a
echo -e "\nOutput of free after:"
free
echo ""