On linux, I have a file called dirs.txt. This file has directory names in it, some of which contain embedded blanks. I want to run the du -sh command on each directory name (to get a total usage for each directory and its children). I've tried:
cat dirs.txt | xargs du -sh
but that seems to split the directory names on their spaces which means lots of errors. How can I tackle this?
So long as the
dirs.txtfile has one directory name per line, this works.xargswith the-0option to take care to not mishandle special characters like spaces.