25

There are some programs which can display used disk space using a treemap, such as WinDirStat for Windows and KDirStat for KDE/Linux:

KDirStat screenshot

I'm looking for something similar, but for a headless Linux box. (E.g. run console data collection program on the server, then load the file in a graphical program in a GUI environment.)

Alternatively, what are other good ways to get a structured used disk space representation, with just SSH access?

1

6 Answers 6

27

NCurses Disk Usage (ncdu) is good for this. See http://dev.yorhel.nl/ncdu for details. It's available as a package for most popular distributions and lets you browse and find out where your disk space is used. It uses text characters to display a bar-chart of directory usage so you get a semi-graphical interface, in a text only environment.

3
  • This one is awesome, highly recommended.
    – RomanSt
    Oct 7, 2011 at 10:10
  • ncdu does not produce treemaps. May 7, 2017 at 8:10
  • 1
    Almost a decade after this answer introduced me to ncdu, I created my own ncdu clone for btrfs: github.com/CyberShadow/btdu Thanks again! Mar 16, 2021 at 12:41
11

gt5 is very nice. It has a console interface and also creates html files you can view in your browser. It's in the repositories so you can just apt-get it.

3
  • nice one....wasn't aware of that package. Mar 8, 2010 at 18:21
  • 2
    I've been using gt5 for a while, but it has one considerable flaw: if you have a lot of files, gt5 ironically requires a considerable amount of disk space (hundreds of megabytes) to generate the results. Aug 24, 2011 at 0:36
  • The humor of that comment gets my upvote. Oct 12, 2021 at 19:48
8

I use du -cks * | sort -rn | head -11.

It shows the top ten directories by disk consumption. I use it on /home and such all the time.

1
  • Brilliant! Nothing to install, does the job just fine, even if it requires navigating a little bit and run the command in different places to investigate where has all your free space gone.
    – sylbru
    Aug 27, 2018 at 17:13
5

xdiskusage allows you to pipe the output of du into it for analysis. It's a great option.

3

For headless servers philesight might be of great use.

(kludos for that gem go to http://www.makeuseof.com/tag/how-to-analyze-your-disk-usage-pattern-in-linux/)

2
1

You can run the same command if you connect on the server via ssh and use ssh X forwarding and an X server on your workstation. If you want from commandline:

df -k /*|sort -n
1
  • 1
    Yeah, that's obvious, but I don't want to install KDE on a server :) And I was looking for a nicer/more structured method than just sorting all files by size... edited question to clarify. Mar 8, 2010 at 18:17

Not the answer you're looking for? Browse other questions tagged or ask your own question.