Categories
Linux

Linux Tip: Truncate multiple files using find

Assuming you have a find command of

find . -type f -name '*.log'

Then it’s as simple as:

for item in $(find . -type f -name '*.log' ) ;do cat /dev/null > $item ;done

Handy for truncating log files…