Your VPS, dedicated server, and backup device all have something in common: a finite amount of space. Fortunately, you can always free up space, add a new drive, or compress files as needed. But you never want to get into a situation where the lack of space surprises you. On a Unix or Linux server, you can use “du” to find out information about your current disk usage.
To get the most basic disk usage information, type “du” without any other options. The output will look something like this (in kilobytes):
To get a summary of all disk usage without a complete list of directories, type this:
The output will only show the total:
In both instances, the total will show you how much disk space has been used in the specified directory and its sub-directories. On a server, the number may look something more like 141830722. To put that number into something more digestible, add the “-h” option to the command, which makes it “human readable”:
The output will look like this:
On a Linux server, you can also do the opposite: find out how much disk space you have available with the “df” (disk free) command. Simply type:
and the output will look like this:
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 73990360 51367736 18864084 74% /
udev 1472472 4 1472468 1% /dev
tmpfs 592988 1220 591768 1% /run
none 5120 0 5120 0% /run/lock
none 1482468 2692 1479776 1% /run/shm
For more information about du or df, type “man du” or “man df” from the command line for complete documentation.