afzal

Sunday, January 23, 2011

Delete old log files in Linux

To find files modified more than 5 days use -mtime +5 and files modified less than 5 days use -mtime -5


Use -ctime parameter to find out the created time



To List and Delete log files older than 10 days, execute the following commands


find /var/log/ -name *.log -mtime +10 -exec ls -tl {} \;

find /var/log/ -name *.log -mtime +10 -exec rm -f {} \;
Posted by Afzal at 11:35 PM
Newer Post Older Post Home

Blog Archive

  • ▼  2011 (28)
    • ►  September (5)
    • ►  August (1)
    • ►  May (1)
    • ►  February (1)
    • ▼  January (20)
      • Recreate the OraInventory
      • SQL*Plus command line history completion
      • Redhat Package Management (RPM)
      • IPTables in Linux
      • Server Status & Health Check in Linux
      • Linux Booting Process Sequence
      • Disable SSH root login
      • Delete old log files in Linux
      • Reinstall Grub in Linux
      • Changing hostname without rebooting Linux server
      • Backup and Recovery in Linux using dd command
      • Enable cron for a locked account in Linux
      • Finding BIOS version in Linux Servers
      • NOHUP : Run command continiously even if session c...
      • Moving volume group to another Server in Linux
      • CLEANING UP THE LINUX BUFFER CACHE
      • Clear Swap Space in Linux
      • Find RPM packages installed on particular date
      • Configuring Network Bonding in Linux
      • Yahooooooo! in Outlook
  • ►  2010 (7)
    • ►  September (1)
    • ►  July (4)
    • ►  June (2)
  • ►  2009 (1)
    • ►  October (1)

About Me

My photo
Afzal
View my complete profile
Watermark theme. Powered by Blogger.