12

I'm running out of disk space on one of our Linux servers and I need to find out what is taking up all the space.

TIA

8 Answers 8

10

du -m --max-depth=6 / | sort -nr | head -n 20 would show you 20 largest directories with the biggest ones on the top, usage indicated by megabytes.

1
  • I know that on Windows tools like WizTree can take advantage of FS implementations to considerably speed up file stats (e.g. by reading MFT on NTFS instead of scanning whole disk). Are there any such tools on Linux? Or is it simply not relevant for common linux filesystems (i.e. no way to do it faster than a straight-forward way)?
    – Dan M.
    Apr 17, 2023 at 14:32
5

Try one of these:

Or these:

3

Windirstat was heavily inspired by kdirstat, it should be in your distro.

0
1

Gnome has Disk Usage Analyzer, i have used it in Ubuntu, but i believe it is not ubuntu only. It has a similar pie chart thing to WinDirStats gui

1
0

du - disk usage. - "man du" for more information.

edit: normally something like du / -hc --max-depth=1 should do it

for graphical tools, try "filelight"

0
0

I routinely use:

du -cks * | sort -nr
2
  • At first glance I read that as "ducks in a row."
    – Hyppy
    Jul 16, 2012 at 15:23
  • ducks is my mnemonic for this command. I think I stole it from an O'Reilly Linux Hacks book way back when.
    – dmourati
    Jul 17, 2012 at 17:55
0

agedu is running fine under RHEL 6, scanning a target folder and exposing the report over HTTP:

Suppose you're running low on disk space. You need to free some up, by finding something that's a waste of space and deleting it (or moving it to an archive medium). How do you find the right stuff to delete, that saves you the maximum space at the cost of minimum inconvenience?

Unix provides the standard du utility, which scans your disk and tells you which directories contain the largest amounts of data. That can help you narrow your search to the things most worth deleting.

However, that only tells you what's big. What you really want to know is what's too big. By itself, du won't let you distinguish between data that's big because you're doing something that needs it to be big, and data that's big because you unpacked it once and forgot about it.

Most Unix file systems, in their default mode, helpfully record when a file was last accessed. Not just when it was written or modified, but when it was even read. So if you generated a large amount of data years ago, forgot to clean it up, and have never used it since, then it ought in principle to be possible to use those last-access time stamps to tell the difference between that and a large amount of data you're still using regularly.

agedu is a program which does this. It does basically the same sort of disk scan as du, but it also records the last-access times of everything it scans. Then it builds an index that lets it efficiently generate reports giving a summary of the results for each subdirectory, and then it produces those reports on demand.

man page

enter image description here

0

NCurses Disk Usage runs just fine under RHEL 6:

Ncdu is a disk usage analyzer with an ncurses interface. It is designed to find space hogs on a remote server where you don't have an entire graphical setup available, but it is a useful tool even on regular desktop systems. Ncdu aims to be fast, simple and easy to use, and should be able to run in any minimal POSIX-like environment with ncurses installed.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .