1 2 3 4 5 6 7 8 9 10 11 12 13 Be really careful as these are powerful commands which blow away files wholesale. Note: To find files created more than 5 days use -mtime +5 To find files created less than 5 days use -mtime -5 For log files older than 5 days find /opt/app/logs/ -name *.log -mtime +5 -exec ls -tl {} \; find /opt/app/logs/ -name *.log -mtime +5 -exec rm -f {} \; For log files newer than 5 days find /opt/app/logs/ -name *.log -mtime -5 -exec ls -tl {} \; find /opt/app/logs/ -name *.log -mtime -5 -exec rm -f {} \;
1
2
3
4
5
6
7
8
9
10
11
12
13
Be really careful as these are powerful commands which blow away files wholesale. Note: To find files created more than 5 days use -mtime +5 To find files created less than 5 days use -mtime -5 For log files older than 5 days find /opt/app/logs/ -name *.log -mtime +5 -exec ls -tl {} \; find /opt/app/logs/ -name *.log -mtime +5 -exec rm -f {} \; For log files newer than 5 days find /opt/app/logs/ -name *.log -mtime -5 -exec ls -tl {} \; find /opt/app/logs/ -name *.log -mtime -5 -exec rm -f {} \;
Install MRTG Poetry System Admin Courses Linux Cheat Sheet Downloads Interview Cheat Sheet Solaris Commands Install Oracle 11g SSH Keys Create NFS Share Yum Repository Create RPM UNIX .profile
Brian BillsFounder MJ12NetSystem Admin
ankara escort escort ankara escort bayan bayan escort eskort bayan bursa escort escort bursa sex shop bursa escort escort bursa