tags:

views:

138

answers:

6

/dev/md1 6068992 5204648 551080 91% /

I have 91% taken and am trying to discover what files are taking up space. I'm using linux. Does any one know the command?

thanks

+9  A: 

du -k -S -x / | sort -n -r | head -10

Will return the 10 largest files on the root file system.

Edit: @Alnitak's answer included the -S and -x, included here for completeness.

Ken Gentle
+8  A: 

This will list the directories in (reverse) order of size

# du -k -S -x / | sort -r -n

Note:

  • -S tells it not to include subdirectory counts, so each directory figure will be the use of that directory, not the tree below it
  • -x tells it not to leave that file system. Without this it'll go into /proc, /dev, /sys, etc, and you don't need to du those.

EDIT: doh! didn't mean the --max-depth=1 - just force of habit!

Alnitak
+1: "-S" and "-x" are nice improvements. `du` on `/proc` doesn't hurt anything - just more nodes to filter out, right?
Ken Gentle
+1  A: 

You can use find to locate the largest files on your system, for example:

find / -size 100M -print

Will find and print the names of all files that are 100 MB or larger. You can use the -mount option if you only want to look in the partition that the specified directory resides on:

find / -mount -size 100M -print
Robert Gamble
A: 

I usually use:

du -x / | sort -ns

But when on the GUI you can also use filelight or fsview.

CesarB
A: 

This seems like a dupe of Tracking down where disk space has gone on Linux?

hangy
I wonder why someone down-modded you?
Randy Stegbauer
A: 

Often it is not the size of a single file but what is contained in the subdirectories. I usually use the --max-depth=1 option to du to find the "big directories" in my home. Everything outside of home is installed in some way, so I can go to my package manager and let it show all installed packages, sorted by disk size; then I can throw out some things I do not need anymore.

Svante