Answered by the Webhosting Experts

How Can I Check How Much of My Hard Disk Is Being Used On My Linux Server?

The df and du commands are useful tools for checking disk space in Linux, but they have some key differences. The df command stands for disk free, and it shows the amount of space taken up by different drives or filesystems. The du command stands for disk usage, and it shows the amount of space used by files or directories and their subdirectories.

The df command gives a quick overview of the entire filesystem, including the size, used space, available space, usage percentage, and mount point of each drive. The command gives a detailed report of the space used by a specific file or directory and its subdirectories and shows the size of each file or subdirectory within a given directory.

The df command is useful when you want to see how much space is left on your drives or filesystems, or when you want to compare the size and usage of different drives or filesystems. The command is useful when you want to see how much space a file or directory takes up, or when you want to find out which files or directories are taking up the most space.

Using the du and df Commands

Review the three commands below which are very useful for determining space usage in the server and directories.

Using df -h we can view the usage and remaining space of our server, as shown below.

Screenshot showing the results of the df -h command.

Using du -sh /home, we can view the size of the home directory. The “/home” can be changed to whichever directory you’d wish to examine.

Screenshot showing the results of the du -sh /home command.

To view the list of largest files in a directory and have it sorted by file size, the command below can be used. 

*Note: both “/home” can be changed to any directory and “50” to whichever value of results you’d like to receive.

du -ahx /home | sort -rh | head -50

Screenshot showing the results of the du -ahx /home | sort -rh | head -50 command.

Need More Personalized Help?

If you have any further issues, questions, or would like some assistance checking on this or anything else, please reach out to us from your my.hivelocity.net account and provide your server credentials within the encrypted field for the best possible security and support.

If you are unable to reach your my.hivelocity.net account or if you are on the go, please reach out from your valid my.hivelocity.net account email to us here at: support@hivelocity.net. We are also available to you through our phone and live chat system 24/7/365.