Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

5 Answers

up vote 6 down vote accepted

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.

share|improve this answer
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
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

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.