I've moved from shared hosting to a VPS and see in my HyperVM that 11 GB out of my allotted 20 GB of disk space is being used.

According to how big this files are on Windows before I upload, all of my files are taking up less than 100 MB of space.

I've got 11 websites running in 11 directories. What is the best command/way on Linux to show me exactly how much space each directory is taking up, e.g. like the TreeSize tool on windows?


du -h will show you disk usage by directory in human readable form.

If you have a lot of subdirectories --max-depth=1 might be helpful.

Start by running it in your website directory, and then in the / directory.

df -h will show disk usage by partition as well.

  • 1
    but du will not count space occupied by deleted files that are still open by a program – dmityugov Jun 1 '09 at 13:14
  • 1
    use lsof to find out what files are open – dmityugov Jun 1 '09 at 13:20
  • I was wondering how much disk this could eat up - so of course I recently ran across a server where this was using around 40 GBs of space. Thanks for the hint. – Aaron K. Jun 8 '09 at 22:02

You can try ncdu /<path>, it's a nice frontend to du -shx /<path>, you will have to install it though, because it's not included on standard installations.


Sounds like you have a lot of saved backups or temp files. Use the du command, as said above, to work out how much is really used, then to narrow it down to the folders.


You can install "durep" and get a nice "web page" showing where you use the most storage etc..

From site: durep creates disk usage reports with bar graphs, allowing one to easily deduce which directories are using the most space. Although durep can produce text output similar to du, its real power lies in the ability to store reports in a file, which can then be viewed as a web page with the supplied cgi script.


du is the basic command to calculate disk usage.

You can get it to display a summary for the current directory by doing du -s .. the -s flag just calculates the total. If you want it in human readable format (eg "112MB") then use -h, eg du -hs ..

If you want to scan all the directories in the current directory to see how much space you're using up, then you can do du -hs *.

If you're using a graphical environment, baobab is a very nice GNOME programme for viewing disk usage.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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