Clear Squid Cache CentOS 5.x

Written by James McDonald

January 5, 2009

service squid stop
rm -rf /var/spool/squid/* (removes cached files and directory structure)
rm -rf /var/log/squid/* (removes the logs)
squid -z (recreates the cache_dir structure)
service squid start

Doing the above can be helpful if you want to claw back some diskspace in a hurry.

If you wanted to shift the squid cache_dir you could edit squid.conf cache_dir to repoint it to another disk/partition before restarting.


  1. Leon

    use mv for shorter down time

    service squid stop
    mv /var/spool/squid /var/spool/squidold
    mv /var/log/squid/* /var/spool/squidold
    squid -z
    service squid start
    rm -rf /var/spool/squidold

  2. Leon

    If your disk is full, the squid -z will fail

    you can start the rm -rf for a few, then kill it, go back to squid -z, then complete rm -rf later


Submit a Comment

Your email address will not be published. Required fields are marked *

You May Also Like…

Docker on Fedora 32

Docker on Fedora 32

Commands to run to get moby-engine running on Fedora 32 # as root or sudo'd dnf install grubby grubby...

PDF Poster

PDF Poster

Start with a wide long image. This is just a screen shot of my desktop. widescreen.png Convert it to postscript using...