Certainly! Linux includes the "df" command to show usage. Let's use the following command:
The -h switch makes the output "human readable," so instead of the actual total number of bytes, you will see the output in megabytes or gigabytes. The output, depending on distro, will be something like:
Th very first output there is /dev/xvda1. This is the overall usage of your server. The rest of them are the various directories required by the operating system.
Want to break down directories and their specific usage?
We'll want to use the "du" command to check usage in each of our directories located in /. So, use sudo or obtain root and visit the / directory (cd /). You can use the following command to see your disk usage:
du -h --max-depth=1
"du" is the main command to give a disk space break down. The "-h" switch makes the output human readable (described earlier). The "--max-depth=1" switch tells the command to just give the report for one level deep. The space for all folders below that level are still counted, but the sub folders themselves are not displayed.
When the command is run, you would see something displayed like the following:
The last line will give you the total space used for all folders it counted. In this case, the total disk space usage on this server right now is 1.5GB. Of that amount, 972MB of space can be found in the /usr folder.
So lets say we think that amount is a little high and want to find out a little more detail about the usage inside that folder. So switch to the /usr folder.
Run the earlier command again to see the usage inside of that folder.
du -h --max-depth=1
You should then see the space inside of the /usr folder.
The above commands can be used for finding the space usage of any folder and the files below it. Just switch to that directory using the "cd" command and use du to check.
It is very, very important to note that just because a directory is using a lot of space, that does NOT mean there is an issue or the directory and files inside it need to be removed. Removing files and folders without regard to what they may be doing is similar to just removing system files in Windows. It's a quick way to hose your server!