• Fun With The du Command

    From Lawrence D'Oliveiro@21:1/5 to All on Wed May 29 01:52:12 2024
    Looking at the space taken up by my copy of the Blender source code:

    ldo@theon:projects> du -ks blender
    1444272 blender

    Most of that is in the commit history:

    ldo@theon:projects> du -ks blender/.git
    1139640 blender/.git

    So how much isn’t?

    ldo@theon:projects> du -ks blender/.git blender
    1139640 blender/.git
    304632 blender

    Do you see what happened there? If you specify a directory, and then
    its containing directory on the same command, du will subtract the
    usage of the former from the latter. This gives you an easy way of
    determining the space taken up by a directory, not including
    particular subdirectories.

    This can be broken down even more:

    ldo@theon:projects> du -ks blender/.git blender/extern blender/intern blender/source blender
    1139640 blender/.git
    40536 blender/extern
    15712 blender/intern
    105188 blender/source
    143196 blender

    Here, “extern” is various open-source libraries from other sources,
    that have been copied into the Blender source tree, while “intern” is
    code that originated from Blender itself, that has been organized into
    its own libraries. And as you can see, there is still a whole bunch
    left in other subdirectories.

    Does this work recursively?

    ldo@theon:projects> du -ks blender/.git blender/intern/cycles blender/intern blender
    1139640 blender/.git
    8880 blender/intern/cycles
    6832 blender/intern
    288920 blender

    Yes it does. Here we can see that the Cycles renderer makes up a bit
    over half the contents of “intern”.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Borax Man@21:1/5 to Lawrence D'Oliveiro on Wed May 29 10:36:43 2024
    On 2024-05-29, Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
    Looking at the space taken up by my copy of the Blender source code:

    ldo@theon:projects> du -ks blender
    1444272 blender

    Most of that is in the commit history:

    ldo@theon:projects> du -ks blender/.git
    1139640 blender/.git

    So how much isn’t?

    ldo@theon:projects> du -ks blender/.git blender
    1139640 blender/.git
    304632 blender

    Do you see what happened there? If you specify a directory, and then
    its containing directory on the same command, du will subtract the
    usage of the former from the latter. This gives you an easy way of determining the space taken up by a directory, not including
    particular subdirectories.

    This can be broken down even more:

    ldo@theon:projects> du -ks blender/.git blender/extern blender/intern blender/source blender
    1139640 blender/.git
    40536 blender/extern
    15712 blender/intern
    105188 blender/source
    143196 blender

    Here, “extern” is various open-source libraries from other sources,
    that have been copied into the Blender source tree, while “intern” is code that originated from Blender itself, that has been organized into
    its own libraries. And as you can see, there is still a whole bunch
    left in other subdirectories.

    Does this work recursively?

    ldo@theon:projects> du -ks blender/.git blender/intern/cycles blender/intern blender
    1139640 blender/.git
    8880 blender/intern/cycles
    6832 blender/intern
    288920 blender

    Yes it does. Here we can see that the Cycles renderer makes up a bit
    over half the contents of “intern”.

    Thats pretty cool!

    You can acheive the same thing using the --exclude option, at least it works for the GNU option.

    du -s --exclude="blender/.git" blender

    will do the same.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)