[NTLUG:Discuss] Re: Is there a command line utility which will report directory statistics?
Leroy Tennison
leroy_tennison at prodigy.net
Sat Jan 21 05:17:53 CST 2006
Terry wrote:
>On 1/21/06, Leroy Tennison <leroy_tennison at prodigy.net> wrote:
>
>
>>Kevin Brannen wrote:
>>
>>
>>
>>>Leroy Tennison wrote:
>>>
>>>
>>>
>>>>...
>>>>Second, I take it that 'du' reports only in blocks rather than actual
>>>>aggregates of sizes even if the '-b' switch is used, correct? The
>>>>reason I ask is that I'm looking for an equivalent of what the Evil
>>>>Empire does when it calculates directory sizes.
>>>>
>>>>
>>>
>>>Not sure what you're asking here, but -b gives you the size in bytes
>>>(or changes the block size to 1 byte instead of the default 1K). Try
>>>"du --help" and read closely. If you prefer to learn by example,
>>>here's something for you:
>>>
>>>[13 ~ /home/kevin] ls -l SUSE-10.0-LiveDVD.iso
>>>-rwx------ 1 kevin users 1094363136 2006-01-17 20:57
>>>SUSE-10.0-LiveDVD.iso
>>>
>>>[14 ~ /home/kevin] du -b SUSE-10.0-LiveDVD.iso
>>>1094363136 SUSE-10.0-LiveDVD.iso
>>>
>>>[15 ~ /home/kevin] du -k SUSE-10.0-LiveDVD.iso
>>>1069760 SUSE-10.0-LiveDVD.iso
>>>
>>>[16 ~ /home/kevin] du -h SUSE-10.0-LiveDVD.iso
>>>1.1G SUSE-10.0-LiveDVD.iso
>>>
>>>So you can see the actual size with the "ls -l" and that "du -b" gives
>>>the same answer (as would "wc -c"). The -k and -h switches to du just
>>>change their reporting format. I used a file here to make the example
>>>easier, but you would get the same type of results with full dirs.
>>>
>>>HTH,
>>>Kevin
>>>
>>>_______________________________________________
>>>https://ntlug.org/mailman/listinfo/discuss
>>>
>>>
>>>
>>Your point is exactly why I'm having heartburn, I don't get the same
>>answer with 'ls -al' and 'du -b' on RedHat 9, see actual output below:
>>
>>
>>
>
>ls -s [filename] will report the size of the file
>du -b [filename] will report the amount of disk space occupied by the
>file, (the amount of "disk usage" taken up to store the file).
>
>
>
>>[leroy at linux-b index_files]$ ls -al
>>total 108
>>drwxr-xr-x 2 root root 4096 Jan 19 05:42 .
>>drwxr-xr-x 7 root root 4096 Jan 19 05:33 ..
>>-rw-r--r-- 1 root root 195 Jan 19 05:42 filelist.xml
>>-rw-r--r-- 1 root root 83761 Jan 19 05:42 image001.jpg
>>-rw-r--r-- 1 root root 6807 Jan 19 05:42 image002.jpg
>>[leroy at linux-b index_files]$ du -b
>>106496 .
>>[leroy at linux-b index_files]$ ls -al filelist.xml
>>-rw-r--r-- 1 root root 195 Jan 19 05:42 filelist.xml
>>[leroy at linux-b index_files]$ du -b filelist.xml
>>4096 filelist.xml
>>[leroy at linux-b index_files]$
>>
>>What I'm getting with 'du -b' is the sum of a rounding up of each file
>>to the next higher 4K boundary plus the size of the . and .. entries. I
>>guess it's time to boot up Fedora and SuSE to see if this is a
>>distribution/version issue.
>>
>>
>>_______________________________________________
>>https://ntlug.org/mailman/listinfo/discuss
>>
>>
>>
>
>
>--
><><
>
>_______________________________________________
>https://ntlug.org/mailman/listinfo/discuss
>
>
>
Thanks, ls -s is useful to know even if it's not what I'm really looking
for.
More information about the Discuss
mailing list