Swap is a virtual memory concept that allows your system to use a portion of your hard drive as the physical memory (RAM). Your system swaps the inactive pages in memory in RAM to this swap space on the hard disk. This way, your system has more free RAM available for other programs.
I have shown you to check RAM in Linux and I have also discussed how to check swap usage on Linux. In this quick tip, I’ll show you how to clear swap memory in Linux.
Clear swap in Linux
Clear Linux memory cache. Jackie Chen Linux October 24, 2014 2 Minutes. There was a alert showing that the swap free space is low in a RHEL 5.6 box. If space is needed by programs or applications like Oracle, then Linux will free up the buffers and cache to yield memory for the applications. If your system runs for a while you will usually see a small number under the field “free” on the first line. Shell Script for Linux clear cache: clearRAM.sh.
However, if you want to force the Linux OS to do clearing memory cache on a particular interval, just add the command to cron job. Here, I show you how. Related Stories: Fun with Linux Commands(Oct 20, 2008) Four Completely Useless Linux Commands(Feb 03, 2009) Learning Linux Commands: ls(Feb 13, 2012). There are three options available to clear cache in Linux system memory. Use one of below as per your requirements. Clear PageCache, dentries and inodes in cache memory sync; echo 3 sudo tee /proc/sys/vm/dropcaches.
But first, why would you want to clear swap at all? There could be various reasons. Adobe illustrator cs6 free download for mac full version. Some time your system will use a lot of swap even when plenty of RAM is available.
This may or may not be associated with swappiness of your system. Sometimes it happens that the RAM doesn’t swap back the pages from swap space to RAM. In such cases, you’ll have to manually clear the swap. Thunderstruck guitar notes. Download flash player 8 for mac.
Attention
Before clearing the swap, check that you have enough free RAM available to take all the pages from swap. In other words, you should have more free RAM available than the current swap in use.
You can see the state of RAM and swap using the free command in Linux:
Once you are sure that the size of free RAM is bigger than the swap memory in use, you can clear the swap memory by turning it off and on again.
Pun aside, that’s the way to do it. Disable all the swap using this command:
Now turn the swap back on:
That’s it. This simple exercise will clear the swap in your Linux system. I hope you find this little tip helpful. Any questions or suggestions are always welcome.

Become a Member for FREE
Clear Cache Ram Linux Mac
Arch Linux Clear Ram Cache
Join the conversation.
