0

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?

Edward Tanguay
  • 1,209
  • 4
  • 22
  • 31

5 Answers5

8

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.

Aaron K.
  • 464
  • 2
  • 6
1

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.

Amandasaurus
  • 31,471
  • 65
  • 192
  • 253
0

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.

drybjed
  • 554
  • 2
  • 7
0

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.

Dentrasi
  • 3,752
  • 1
  • 24
  • 19
0

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.

rkthkr
  • 8,618
  • 28
  • 38