I want to have an idea of how much archivelogs the database is generating daily, so I did:find /u02/archivelog -mmin -1440 | du -sh and got 220GB, which is the total size of all files in that directory, and not only less than 1 day total.If instead I did find /u02/archivelog -mmin -1440 -exec ls -ltrh {} \; This would work and list only the files less than 1 day. But the logic does not seem to apply with du.How can I improve the syntax in order to get expected result?
du command combined with find -mmin
disk usage;size
du doesn't seem to accept files piped into it. I think what you're looking for isfind /u02/archivelog -type f -mmin -1440 -exec du -ch {} +Using the + instead of the ; makes find build up {} as a list and executes once, instead of executing once for each match.You also need to use -type f, otherwise it'll match the directory itself, which is modified every time a new file is added. If you include the directory itself in the du, you're going to wind up with the size of all files again.The -c makes du show a total line as well. If you only want the total, you can add | tail -1 to the end.