Delete old log files on Debian / Ubuntu / CentOS


sudo find /var/log/ -type f -regex '.*\.[0-9]+\.gz$' -delete

This will delete old, archived log files with the .gz extension.

You might also consider configuring logrotate to do this for you.


Leave a Reply

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

Markdown is allowed in comments.