Timeline for How to get difference between 2 dates in Linux?
Current License: CC BY-SA 4.0
13 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Nov 19, 2019 at 10:37 | comment | added | AdminBee | @abhishek glad to hear it! | |
| Nov 19, 2019 at 10:34 | comment | added | supriyo_basak |
Thanks a lot, @AdminBee, for pointing out the -daystart option once again. I had indeed glossed over it. I performed some more tests and it's now working fine, just the way I expected.
|
|
| Nov 19, 2019 at 10:33 | vote | accept | supriyo_basak | ||
| Nov 19, 2019 at 7:48 | comment | added | AdminBee |
I may be mistaken, but could it be that you forgot the -daystart option in the tests you mentioned? If it is omitted, the -mtime argument will amount to "n*24h from the current time", not "n*24h from last midnight". Also, not that the + or - sign to the -mtime argument is relevant: If no sign is supplied, it means "last modified between n*24h and (n+1)*24h ago". If you add a + or -, this is considered start or end of a range of modification times.
|
|
| Nov 19, 2019 at 7:00 | comment | added | supriyo_basak | Please take a look at the edit of my question which I posted after testing the command. | |
| Nov 18, 2019 at 13:55 | history | edited | AdminBee | CC BY-SA 4.0 |
Add caveat about non-standard operation
|
| Nov 18, 2019 at 11:53 | comment | added | AdminBee | @Stéphane Chazelas good point updating the filter rules, thanks you! | |
| Nov 18, 2019 at 11:52 | comment | added | AdminBee | Yes, I believe you are right, and my own tests support that. I would still recommend to err on the safe side and test "non-destructively" if the filter rules do exactly what you intend. | |
| Nov 18, 2019 at 11:13 | comment | added | supriyo_basak | So, from your example, I have the feeling that if I have to purge logs from n number of days back and further, I will have to give the argument to mtime as +(n-1). Please correct me if I'm wrong. | |
| Nov 18, 2019 at 11:03 | history | edited | Stéphane Chazelas | CC BY-SA 4.0 |
added 4 characters in body
|
| Nov 18, 2019 at 10:57 | history | edited | Stéphane Chazelas | CC BY-SA 4.0 |
added 265 characters in body
|
| Nov 18, 2019 at 10:34 | history | edited | AdminBee | CC BY-SA 4.0 |
Add explanation on "daystart"
|
| Nov 18, 2019 at 10:26 | history | answered | AdminBee | CC BY-SA 4.0 |