On Tue, 2018-03-13 at 07:26 +1100, Stephen Morris wrote:
'du' with no parameters recursively lists all the subdirectories and their sizes, along with the grand total. When applied to my home directory, I get over 30,000 lines of output. That's almost never what I want. My usual call is 'du -hs'.
poc
Thanks Patrick, taking this a step further, it seems to me that the only parameter for du that, to me, provides the correct file size is -b as shown below.
I think you have a misconception here. 'du' does not give file sizes, it gives disk usage. A 1-byte file takes up at least 1 disk block, so that's the size 'du' will give. I seem to remember that it also counts indirect blocks and other housekeeping that corresponds to the file without being included in the file's content, but I could be mistaken (though I'm fairly sure early versions did do that).
I am listing my Desktop directory via ll, du -hs and du -bhs. Just further to this is it a bug with du that the -a parameter which is supposed to list all files not just directories, does not list files prefixed with a '.'?:
It does list files beginning with '.'. The reason you aren't seeing these files is because you're implicitly excluding them when you write '.../*'. The Shell meta-character '*' doesn't match the initial '.'.
poc