Linux: du – Disk Usage

du

Disk Usage – report the amount of disk space used by the specified files and for each subdirectory.

Syntax
      du [options]... [file]...

With no arguments, `du’ reports the disk space for the current directory. Normally the disk space is printed in units of 1024 bytes, but this can be overridden

OPTIONS

`-a'
`--all'
     Show counts for all files, not just directories.

`-b'
`--bytes'
     Print sizes in bytes, overriding the default block size (*note
     Block size::).

`-c'
`--total'
     Print a grand total of all arguments after all arguments have been
     processed.  This can be used to find out the total disk usage of a
     given set of files or directories.

`-D'
`--dereference-args'
     Dereference symbolic links that are command line arguments.  Does
     not affect other symbolic links.  This is helpful for finding out
     the disk usage of directories, such as `/usr/tmp', which are often
     symbolic links.

`-h'
`--human-readable'
     Append a size letter such as `M' for megabytes to each size.
     Powers of 1024 are used, not 1000; `M' stands for 1,048,576 bytes.
     Use the `-H' or `--si' option if you prefer powers of 1000.

`-H'
`--si'
     Append a size letter such as `M' for megabytes to each size.  (SI
     is the International System of Units, which defines these letters
     as prefixes.)  Powers of 1000 are used, not 1024; `M' stands for
     1,000,000 bytes.  Use the `-h' or `--human-readable' option if you
     prefer powers of 1024.

`-k'
`--kilobytes'
     Print sizes in 1024-byte blocks, overriding the default block size
     (*note Block size::).

`-l'
`--count-links'
     Count the size of all files, even if they have appeared already
     (as a hard link).

`-L'
`--dereference'
     Dereference symbolic links (show the disk space used by the file
     or directory that the link points to instead of the space used by
     the link).

`--max-depth=DEPTH'
     Show the total for each directory (and file if -all) that is at
     most MAX_DEPTH levels down from the root of the hierarchy.  The
     root is at level 0, so `du --max-depth=0' is equivalent to `du -s'.

`-m'
`--megabytes'
     Print sizes in megabyte (that is, 1,048,576-byte) blocks.

`-s'
`--summarize'
     Display only a total for each argument.

`-S'
`--separate-dirs'
     Report the size of each directory separately, not including the
     sizes of subdirectories.

`-x'
`--one-file-system'
     Skip directories that are on different filesystems from the one
     that the argument being processed is on.

`--exclude=PAT'
     When recursing, skip subdirectories or files matching PAT.  For
     example, `du --exclude='*.o'' excludes files whose names end in
     `.o'.

`-X FILE'
`--exclude-from=FILE'
     Like `--exclude', except take the patterns to exclude from FILE,
     one per line.  If FILE is `-', take the patterns from standard
     input.

On BSD systems, `du' reports sizes that are half the correct values
for files that are NFS-mounted from HP-UX systems.  On HP-UX systems,
it reports sizes that are twice the correct values for files that are
NFS-mounted from BSD systems.  This is due to a flaw in HP-UX; it also
affects the HP-UX `du' program.

Example

List the total files sizes for everything 1 directory (or less) below the currrent directory ( . )

[simon@testserver]$ du -hc –max-depth=1 .
400M ./data1
1.0G ./data2
1.3G .
1.3G total

“Never go to a doctor whose office plants have died” – Erma Bombeck



Digg: DIGG ME

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

Sponsor & Advertise
Tech Buzz

Zero-Day VBScript plagues Windows XP / 2000.

Apparently there is a new zero-day flaw that affects Windows XP and 2000 computers utilizing VBScript. An attacker can trick someone into visiting a website that binds the F1 key to a VBScript event which ultimately installs malicious code on your machine. Microsoft’s fix: Don’t press the F1 key when windows pop up. LOL. Ok [...]

Read More »

Has Verizon been hacked? Security certificates revoked!

Has Verizon been hacked? Google Chrome seems to think so. Just a few minutes ago I tried to log into Verizon to see why my phone isn’t making any calls and to also see why I can’t make any text messages. I’m going to have to probably assume they haven’t been hacked, but how does [...]

Read More »

My first blocked number in Google Voice.

Today I received my first piece of spam in Google Voice. At first I was really PISSED-OFF but then a feeling of serenity passed over my whole body as I noticed the “block” button. Slowly and cautiously I clicked it, making my day THAT MUCH better. Just knowing that I will no longer be getting [...]

Read More »

3500 Netflix on Linux petitions.

Currently you can not watch Netflix if you are a Linux user and all those new Ubuntu Netbook owners will not be watching Netflix anytime soon either. Watching movies online through Netflix is an awesome service, but worthless to Linux users. Netflix has chosen to only allow Windows and MAC users access to their online [...]

Read More »

Apple bans “android” from apps store.

Apples waving the ban stick around again, this time rejecting an educational iPhone app because it contained the word “Android”. The application? Flash of Genius: SAT Vocab 2.2, an iPhone app developed by Tim Novikof. The app did really well in the Android Developer Challenge that Google puts on and decided to mention that [...]

Read More »

My .02 on Apple’s anti-flash, anti-freedom movement.

As many of you iPhone consumers may know, Flash isn’t supported and will probably never be supported. The new up and coming iPad (Apple Tablet) will be running a version of the iPhone operating system and will probably have the same exact restrictions. The reason Apple doesn’t want to support Flash is because it allows third [...]

Read More »