free unused memory Linux is a demand of every person who is using Ubuntu/Linux, here in this article we will discuss methods to free up and release the unused or cached memory is easy, you can use any of these ways and can schedule the command to clear the swap, heap, cache memory in Linux. Like Windows OS, the easiest way is to restart the machine, but when you have Ubuntu/Linux you don’t need to restart the machine or even no need to install any third party software.



Check Memory Usage in Real-Time

You can check your current memory usage using this command:

watch -n 1 free -m

check in real-time your system memory usage:

watch -n 1 cat /proc/meminfo

Free Up Unused Memory

If you have cached or buffered Ram, You can use following tricks to clean your memory.

Trick #1:

You can free up unused memory under Ubuntu/Linux Mint using this command:

sudo sysctl -w vm.drop_caches=3

NOTE: this action won’t make your system faster nor it will affect its stability and performance, it will just clean up memory used by the Linux Kernel on caches.

Trick #2
Here is another command that can help you free up memory either used or cached (page cache, inodes, and dentries):

sudo sync && echo 3 | sudo tee /proc/sys/vm/drop_caches

Trick #3

1. Freeing Up the Page Cache

echo 1 > /proc/sys/vm/drop_caches

2. Freeing Up the Dentries and Inodes

echo 2 > /proc/sys/vm/drop_caches

3. Freeing Up the Page Cache, Dentries and Inodes

echo 3 > /proc/sys/vm/drop_caches

4. Flushing the File System Buffers



NOTE: You can use cron jobs to schedule the commands above to run at specific time intervals.

If you have more useful commands for releasing/flushing memory in Ubuntu/Linux Mint, use the comment form below.