How do I Delete all log files smaller than a certain size?
Posted: Thu Oct 01, 2020 8:32 am
In some situations like, when SafeSquid service has been hanged at some heavy load conditions, then some '0 or 20'k log files are generated.
You can remove those unnecessary log files with no data using below command.
Note the - before 20k. Just 20k means exactly 20 kilobytes. -20k means smaller than 20 kilobytes. +20k means larger than 20 kilobytes.
The -type 'f' forces the command to only act on files and skip directories.
You can remove those unnecessary log files with no data using below command.
Code: Select all
find ./ -type f -size 0 -delete
Code: Select all
find ./ -type f -size -20k -delete
The -type 'f' forces the command to only act on files and skip directories.