Saturday, October 11

mtime



what is the command for,
1. find logs of last 5 days
2. find logs of last 5th day
3. find logs of last 10 to 20 days.
4. find logs of particular day(15aug2014).
5. find logs of particular period (15th aug to 20th aug)



  • 1. find logs of last 5 days find . -name xxxxx.log -mtime -5
  • 2. find logs of last 5th day find . -name xxxxx.log -mtime 5
  • 3. find logs of last 10 to 20 days find . -name xxxxx.log -mtime +10 -mtime -20 
  • 4. find logs of particular day(15aug2014). find . -type f -mtime $(( ( $(date +%s) - $(date -d '2014-08-15' +%s) ) / 60 / 60 / 24 - 1 ))
  • 5. find logs of particular period (15th aug to 20th aug) find . -type f -mtime +$(( ( $(date +%s) - $(date -d '2014-08-15' +%s) ) / 60 / 60 / 24 - 1 )) -mtime -$(( ( $(date +%s) - $(date -d '2014-08-15' +%s) ) / 60 / 60 / 24 - 1 ))

No comments:

Post a Comment