Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Dec 2018 22:13:10 +0200
From:      Esa Karkkainen <freebsd.lists@zxas.fi>
To:        Paul Schmehl <pschmehl_lists@tx.rr.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Files in /
Message-ID:  <20181204201310.GE52067@pp.htv.fi>
In-Reply-To: <23558.33730.773326.914041@jerusalem.litteratus.org>
References:  <66B63BE11669F00AA754FE87@Pauls-MacBook-Pro.local> <FADEF472-E4FC-4C41-9572-940A6DC3DA4C@glasgow.ac.uk> <23558.33730.773326.914041@jerusalem.litteratus.org>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
On Tue, Dec 04, 2018 at 08:40:18AM -0500, Robert Huff wrote:
> 	And - if you're trying to track down what's gobbling disk space -
> try this, aimed at the suspect directory:
> 
> 	du -k | sort -n -r | head -n 25

I'm using a variation of that

du -axk / | sort -rn 

Which I usually redirect to a file, so I don't need to run the same
command again and again.

But I digress, the command will list every directory and file within
the / filesystem, Each directory will contain sum of the files within,
for example

# du -axk / | sort -rn | head -2
1860504	/
1761543	/boot
# df -k /
Filesystem 1024-blocks    Used     Avail Capacity  Mounted on
tank/root    180339052 1860536 178478516     1%    /
# 

So df show usage of 1 860 536 KiB and df shows 1 860 504 KiB, difference
of 32 KiB, the numbers will not match exactly. In this case there is a
0.000018% difference between disk usage shown by df and du.

Second largest directory is /boot, sum of the file sizes within /boot
directory is 1 761 543 KiB.

The "du -axk" keeps du within one filesystem, so it will not wander to
other filesystems like /proc, possibly /var, if it is a separate
filesystem etc.

The "sort -rn" sorts the lines, using the first column, sort order is
largest to smallest number.

Regards,

Esa

-- 
"In the beginning the Universe was created. This has made a lot of
people very angry and been widely regarded as a bad move."
        -- Douglas Adams 1952 - 2001



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?20181204201310.GE52067>