Home » Questions » Computers [ Ask a new question ]

Show file size by type in Linux?

Show file size by type in Linux?

I'm trying to find out the total size of all files within a directory that have a particular extension.

Asked by: Guest | Views: 373
Total answers/comments: 2
Guest [Entry]

"You can use du:

find Music/ -type f -name ""*.mp3"" -exec du -shc {} + | tail -1 | awk '{print $1}'

output example:

980M"
Guest [Entry]

"find Music/ -iname ""*.mp3"" -type f -exec stat -c ""%s"" {} \; | awk '{SUM+=$0} END {print SUM/1024/1024}'

Got the correct answer as well, exactly the same as pavium's solution, could be a bit more reliable though."