Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a VPS which is a little starved for disk space. Long term plans call for moving to a system with a bigger disk but in the meantime I need to take a look at the existing disk use and clear up unnecessary stuff (e.g. old database dumps).

So far I've been using du -hc --max-depth=<n> to look at directories like /var/www and /home, but this is a pretty intensive process and it's not always easy to pick up the depth that will spot the disk use. I'd like to find something like Disk Inventory X that will show me a nice graph of what's taking the space, and there are such tools for Linux, but is there one which will either run over SSH or get some data (maybe even from a big du run) and visualize that offline?

share|improve this question
up vote 1 down vote accepted

I don't know of a good command-line disk usage visualization application, but it would be a good project with curses or similar :)

I usually use something like the following, and then page through the output file with less:

find / -type f -exec du -k {} + | sort -nr | cut -f2 | xargs -d '\n' du -sh > /tmp/usage.txt

Files are sorted from largest to smallest so it's easy to pinpoint the culprits...

782M    /ftp/
321M    /ftp/
321M    /ftp/
211M    /ftp/
193M    /ftp/5.wmv
183M    /ftp/
175M    /ftp/7.pdf
156M    /ftp/8.MPG
133M    /ftp/9.exe
111M    /ftp/10.pdf
104M    /ftp/11.MPG
96M     /ftp/12.rvt

You could go even further and use grep to grab certain filetypes:

grep  "\.zip" /tmp/usage.txt

and voila:

782M    /ftp/
321M    /ftp/
321M    /ftp/
211M    /ftp/
183M    /ftp/
share|improve this answer
I like David Spillet's answer but this is what I'm actually using. – pjmorse Sep 15 '10 at 15:12

If you are running a Linux desktop (or something else with an X server) at your end you could try running your preferred X application over SSH like so. How efficient and responsive this will be depends on the bandwidth (and latency) leaving your server and coming into your current location (unless the server is on the local LAN, in which case bandwidth and latency are not going to be much of an issue). You might need to make sure that the SSH client's compression option is used, as I don't think the X protocol compresses anything by default.

Three are several options for Windows too, you just need extra stuff installed. You could install cygwin and use its X server and SSH client which I've used before, or you could try Xming+puTTY which I've not got around to trying yet.

Unlike controlling a machine via VNC, you don't need a full X install on the server - you just need the X client libraries that the tools you run need.

share|improve this answer
This is a good technique, but the tools I'd use require either KDE or Gnome as well as X, so it won't work for this application. – pjmorse Sep 15 '10 at 3:38
You would still be able to do this without running X on the server. If you are installing on Debian or Ubuntu run `aptitude install chosen-app" and you'll see the extra packages it'll add are just the libraries needed not all the rest of X and the gnome/kde desktop environment and related services. Though if you are already running very short of space on the VM this may still be more than you want to install at this point. – David Spillett Sep 15 '10 at 10:03
The command in the comment above should have been aptitude --simulate install chosen-app (though unless you have a custom aptitude config it would prompt you before taking action anyway). There will be a similar incantation for yum if you use a distro that uses it for package management. – David Spillett Sep 15 '10 at 10:11


du -x --max-depth 1 | sort -n

is pretty good. Just cd into different directories. John T's answer is quicker at finding huge files quickly. If you don't have huge files (or rather, lots of big files), this might be better.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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