How to clear cache in Linux

Here I would like to share a script which you can use to clear your cache memory.

IMPORTANT NOTICE:
This is something one should not do as cache is used to speed up your work activity building a cache memory but still if you feel to clear your cache memory size then you can follow the following steps:

Create a script

# vi clearcache.sh  
#!/bin/bash  
sync; echo 3 > /proc/sys/vm/drop_caches

save and exit

# chmod +x clearcache.sh  
Sync should be run beacause this is a non destructive operation and dirty objects are not freeable. So we run sync in order to make sure all cached objects are freed.  
echo 1 is clearing only page cache   
echo 2 is to clear free dentries and inodes  
echo 3 is clearing page cache, dentries and inodes

Follow the below link for more tutorials

Taking Backup of Hard Disk

How to change user Password Expiry, Home Directory etc in Linux

How to Upgrade Kernel in Linux (Red Hat)

YUM with APACHE configuration

VSFTPD configuration

VNC configuration in Linux

Samba 4 as Active Directory configuration guide

How to configure Samba 3 as Primary Domain Controller in Red Hat Linux

How to configure Squirrel mail server in Red Hat Linux

How to configure Sendmail server in Red Hat Linux

Configure DNS server using Forward and Reverse Lookup zone files in Linux

How to configure Dovecot server in Red Hat Linux