stat -c %s -- $(<list) | paste -d+ -s - | bc
stat displays information about the file
-c specifies the format,
%s gives the filesize in bytes
paste -d+ -s concats the output together line by line with a
+ as delimiter
bc piped to
bc, it will be calculated together.
-L option to
stat, if for symlinks, you'd rather count the size of the file that the symlink eventually resolves to.
That assumes a shell like
zsh with the
$(<file) operator to invoke split+glob on the content of a file.
list is expected to be a space, tab or newline (assuming the default value of
$IFS) delimited list of file patterns (as in
*.txt /bin/*). For a list of file paths, one per line, you'd need to disable globbing and limit
$IFS to newline only, or with GNU
xargs -rd '\n' -a list stat -c %s -- | paste -sd+ - | bc