Piping list of files and directories to du only shows sizes of directories?
What's going on is that xargs
puts (if it can) all of the names on one command-line, so that you see only one command passed to du
. Then du
ignores the filenames (as you might expect: the files are part of the directories and it does not count those twice).
If you use a -n 1
parameter to xargs
, it will split the command up and you will see something more as you expect.
find . | xargs -n 1 du -a