Mailinglist Archive: opensuse (1599 mails)

< Previous Next >
Re: [opensuse] Partition filled up
  • From: Anton Aylward <anton.aylward@xxxxxxxxxx>
  • Date: Tue, 27 Oct 2009 09:07:04 -0400
  • Message-id: <4AE6F078.8010306@xxxxxxxxxx>
Bob S said the following on 10/26/2009 11:47 PM:

Does that explain the numbers?

Well, I am not sure. When I use the -s option I get a single line with the
number 8032.

If you use 'find / -type f -ls' it will list EVERY file.
You OK with that?
Well, no, its a long coffee break, so limit the depth and only list

Now take the date stamp off, the owner, group and type, leaving just the
file size and file name. You can do that with 'sed' but why bother when
you can

find / -type f -print | xargs du -k

You see how we got here now?

Just as 'find' can limit depth and restrict to one file system, so can
'du'. See the manual pages.

8032 what? That number doesn't seem right to me. When I use
the du -k --max-depth=2 | sort -n I get that huge long list of partitions and
numbers which the last of is the . partition and the number is 75112312. I
would just like to understand what I am looking at.

The implicit option you've been using is

-B, --block-size=SIZE
use SIZE-byte blocks

but in KILObytes since

-k like --block-size=1K

So that number is the number of KILObytes of disk space used by files
under that directory. See the manual page.

See also

-c, --total
produce a grand total

If you don't want the details along the way
You do, since you want to find out where on the root FS the space is.

You were asked for the plain number so that it could be numerically
sorted. Its also available in human readable form but that isn't sortable

-h, --human-readable
print sizes in human readable format (e.g., 1K 234M 2G)

du -h --max-depth=2
and satisfy ourself that the numbers are meaningful.
They may even look reasonable :-)

Now see how that completely screws up with
du -h --max-depth=2 | sort -n

Human readable isn't sortable.

This isn't anything world shaking.
You really DO need to learn to read the manual pages.
They may not be great literature, but as I've illustrated the key
information is there and its not particularly obscured...

One difference between using something like 'find' and the command line.

The shell basic wildcard sorts the files POSIXly but doesn't include the
hidden files. If you want the hidden files you have to use a specific
pattern as per my previous post.

'find' does a treewalk and gets to look at everything its told and its
wildcard is inclusive, so
find . -type f -print
**WILL* include hidden files and directories.

This applies to 'du' as well. It walks the tree.
Limits like '-mount' and '--max-depth' limit the treewalking.

Every great advance in natural knowledge has involved the absolute
rejection of authority.
Thomas H. Huxley
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx

< Previous Next >