-b For each name operand that is a directory for
which file system swap has been enabled, print the
number of blocks the swap system is currently using.
-k Gives the block count in 1024-byte blocks.
$> ll
total 96
-rwxr-xr-x 1 user test 23677 Jan 8 15:55 file1
-rwxr-xr-x 1 user test 23040 Jan 8 15:56 file2
$> du -bs * | sort -n
48 file1 #comment: result of 23677/512
48 file2 #comment: result of 23040/512
$> du -ks * | sort -n
24 file1 #comment: result of 23677/1024
24 file2 #comment: result of 23040/1024
Hmm... this is largely untested as I don't really have a heap of large directories to test on - however, something like
#!/bin/sh
for i in `ls /my/dirs/are/here`
do
if [ -d "$i" ]; then
result=`ls -lR "$i" | awk 'BEGIN {c=0;} {c+=$5} END{print c}'`
echo "$result * 1024" | bc | awk -vdir=$i '{print $1, dir }'
fi
done
will yield *approximate* values (not a true byte count as we're just multiplying the kilobyte count by 1024) on systems without GNU du for directories only....
When I used to work on HP-UX systems, the first thing I did was download a gcc development environment and build GNU utilities (like du, for example).
If I were you (of course I am not) I would create a GNU development environment for HP-UX and then you an have access to a very large (and free!) world of wonderful GNU tools that run on HP-UX.
As an editorial note, back in the 'good ole days' when I was a UNIX systems consultant/contractor for big firms, I installed a GNU development environment will my clients. In every case, we saved the client time and big $$$ using GNU software.