The following is a demonstration of the rwbbypid.d script,
Here we run it for a few seconds then hit Ctrl-C,
# rwbbypid.d
Tracing... Hit Ctrl-C to end.
^C
PID CMD DIR BYTES
20347 bash R 22
11053 dtrace W 32
1532 Xorg W 64
20317 sshd R 86
20347 bash W 87
20317 sshd W 137
1659 mozilla-bin R 213
20334 sshd R 1232
20334 sshd W 1282
11054 cp W 18652
11054 cp R 18652
1532 Xorg R 51112
1659 mozilla-bin W 51261
In the above output, we can see that mozilla-bin with PID 1659 has written
51261 bytes, while Xorg has read 51112 bytes.