how to remove old log files on Unix with find command

iKnow-IT banner

You can also remove all file older then 150 day by executing this command:

 

  • find $LOGDIR -name "*log*" -mtime +150 -type f -exec rm -f {} \;

or

  • cd <DIRECTORY>
  • find . -name "*log*" -mtime +150 -type f -exec rm -f {} \;