Sum the size of your logfiles

Find out how much space is occupied by your logfiles. Usefull in /var/log et al.

find . -type f -name “*.log” -size +2048 -exec du -s {} \; | awk ‘{ SUM += $1; } END { print SUM/1024/1024 }’

3 Responses to “Sum the size of your logfiles”


  • haidi@haidi:~/$ find . -type f -name “*.log” -size +2048 -exec du -s {} \; | awk ‘{ SUM += $1; } END { print SUM/1024/1024 }’
    –> bash: syntax error near unexpected token `}’

  • Bei mir sagt er
    bash: syntax error near unexpected token `}’

    Gruß,
    C.

  • syntax error near unexpected token happens because when copying and pasting the example, the curly single quotes are translated to full stops – it would be better if the examples contained straight quotes

Leave a Reply