Find files and pass to du to get a human readable list sorted by size
I liked Jason's solution of passing a file list to du via xargs to produce results sorted by size in human readable format, but wanted ability to limit file list by name and age. Combining the find command with du, worked out nicely:
find . -name "*tar.bz2" -mmin -120 -ls | sort -k7rn | awk '{print$NF}' | xargs du -sh
122M ./sls-monitor/830144.tar.bz2
98M ./sls-monitor/830156.tar.bz2
67M ./sls-off1/905895.tar.bz2
50M ./sls-off1/893748.tar.bz2
16M ./sls-off1/893759.tar.bz2
7.3M ./sls-off1/905897.tar.bz2
5.1M ./sls-off1/854850.tar.bz2
4.4M ./sls-monitor/804331.tar.bz2
3.8M ./sls-monitor/804333.tar.bz2
612K ./sls-off1/893755.tar.bz2
512K ./sls-off1/905898.tar.bz2
Leave a comment