user@host:~$ mkdir -p test/parent/child; cd test
user@host:~/test$ seq 20 | while read i; do dd if=/dev/urandom of=parent/child/$i.bin bs=1M count=100; done
100+0 records in
100+0 records out
104857600 bytes (105 MB, 100 MiB) copied, 0.636299 s, 165 MB/s
100+0 records in
100+0 records out
104857600 bytes (105 MB, 100 MiB) copied, 0.605005 s, 173 MB/s
100+0 records in
100+0 records out
104857600 bytes (105 MB, 100 MiB) copied, 0.604265 s, 174 MB/s
100+0 records in
100+0 records out
104857600 bytes (105 MB, 100 MiB) copied, 0.637298 s, 165 MB/s
100+0 records in
100+0 records out
104857600 bytes (105 MB, 100 MiB) copied, 0.637734 s, 164 MB/s
100+0 records in
100+0 records out
104857600 bytes (105 MB, 100 MiB) copied, 0.610857 s, 172 MB/s
100+0 records in
100+0 records out
104857600 bytes (105 MB, 100 MiB) copied, 0.611513 s, 171 MB/s
100+0 records in
100+0 records out
104857600 bytes (105 MB, 100 MiB) copied, 0.611749 s, 171 MB/s
100+0 records in
100+0 records out
104857600 bytes (105 MB, 100 MiB) copied, 0.63855 s, 164 MB/s
100+0 records in
100+0 records out
104857600 bytes (105 MB, 100 MiB) copied, 0.610356 s, 172 MB/s
100+0 records in
100+0 records out
104857600 bytes (105 MB, 100 MiB) copied, 0.628912 s, 167 MB/s
100+0 records in
100+0 records out
104857600 bytes (105 MB, 100 MiB) copied, 0.610145 s, 172 MB/s
100+0 records in
100+0 records out
104857600 bytes (105 MB, 100 MiB) copied, 0.606974 s, 173 MB/s
100+0 records in
100+0 records out
104857600 bytes (105 MB, 100 MiB) copied, 0.610318 s, 172 MB/s
100+0 records in
100+0 records out
104857600 bytes (105 MB, 100 MiB) copied, 0.629691 s, 167 MB/s
100+0 records in
100+0 records out
104857600 bytes (105 MB, 100 MiB) copied, 0.611301 s, 172 MB/s
100+0 records in
100+0 records out
104857600 bytes (105 MB, 100 MiB) copied, 0.635625 s, 165 MB/s
100+0 records in
100+0 records out
104857600 bytes (105 MB, 100 MiB) copied, 0.607789 s, 173 MB/s
100+0 records in
100+0 records out
104857600 bytes (105 MB, 100 MiB) copied, 0.609169 s, 172 MB/s
100+0 records in
100+0 records out
104857600 bytes (105 MB, 100 MiB) copied, 0.646711 s, 162 MB/s
user@host:~/test$ du -h parent/ # this makes sense
2.0G parent/child
2.0G parent/
user@host:~/test$ du -h parent/ parent/child/ # this makes some sense, but I would expect to see child counted twice
2.0G parent/child
2.0G parent/
user@host:~/test$ du -h parent/child/ parent/ # swapping the order makes parent have 0 size?? (4k is "empty": it's the size of the inode)
2.0G parent/child/
4.0K parent/
user@host:~/test$ du -h -s parent/ parent/child/ # -s makes child not get counted at all?
2.0G parent/
user@host:~/test$ du -h -s parent/child/ parent/ # but swapping the order *does* count it, but with 0 size
2.0G parent/child/
4.0K parent/
user@host:~/test$ du --version
du (GNU coreutils) 8.30
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Torbjorn Granlund, David MacKenzie, Paul Eggert,
and Jim Meyering.
user@host:~/test$ cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.3 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.3 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal