fabic974 random (binary) wanderings in the philament empires…

Quick compute size of system header files

Using awk to sum the output of du (SO):

$ find /usr/include/ -type f \
    -iregex '.+\.\(c\|h\|hh\|cpp\|hpp\|cxx\|hxx\|h\.inc\|s\)$' \
      | xargs -r du -b \
      | awk '{s+=$1} END {print s}'

One-liner, using Bash’s $(( ... )) to compute the size in kilo-bytes:

$ echo "Size of your system header files: $(( $(find /usr/include/ -type f -iregex '.+\.\(c\|h\|hh\|cpp\|hpp\|cxx\|hxx\|h\.inc\|s\)$' | xar
gs -r du -b | awk '{s+=$1} END {print s}') / 1024 )) kBytes."

Size of your system header files: 270115 kBytes.