Re: Finding the size of directory with multiply hardlinked files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dean S. Messing wrote:
Thanks Roberto.  That's _exactly_ what I want.

I saw the -c option of `du' in the man page when
trying to figure this out but it just says

       -c, --total
              produce a grand total

Pray tell, how did you figure this out.
I've re-read the man page and I don't see this
this differential behaviour advertised anywhere.

I just got it by testing and observing results.

Actually, the "-c" is not needed at all, it's there
because I also want to know the total space used by backups.

And... the "-s" is also not needed! It just avoids the
printing of all the subtotals of the subdirectories of
your backups.

It looks like du simply discard everything already
found on its way when calculating disk space.

Look at this:

$ mkdir d
$ head -c 1000000 /dev/zero >f1
$ ln d/f1 d/f2
$ cp d/f1 d/f3

Now, this command reports only two files and not the third (hardlinked):

$ du d
1962    d

And, look at this; f2 is totally ignored even if it appears on the
command line:

$ du d/f1 d/f2 d/f3
981     d/f1
981     d/f3

Amazing.

--
   Roberto Ragusa    mail at robertoragusa.it


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux