Wednesday, 17 May 2023
  1 Replies
  1.1K Visits
0
Votes
Undo
  Subscribe
How do I view the used space on my server's disk?
John Dallas set the post as Normal priority — 1 year ago
John Dallas set the type of the post as  Task — 1 year ago
1 year ago
·
#6
1
Votes
Undo
To verify the actual used and free space on your server's disk, you can run the following command:

df -h


You can determine the usage of specific directories using the du command. In the example below, you would modify the [directory] portion and enter the exact location you'd like to inspect.


sudo du [directory] -h --exclude=/proc --max-depth=3 | sort -hr | head

To view the root directory, you'd simply input / into the command, as below. The * indicates to show all within the directory.


$ sudo du -h /* --exclude=/proc --max-depth=3 | sort -hr | head

To view the srv/users/ directory, the command below should work:


$ sudo du -h /srv/users/* --exclude=/proc --max-depth=3 | sort -hr | head

To explain what's happening in the commands above, you are activating the sudo program to access superuser privileges. du is used to estimate file space usage. The -h flag makes sure that the output is printed in human readable format. Next, you're specifying the directory you'd like to see such as / for root. In this example, we used the --exclude=/proc tact to ignore some unnecessary output.

The --max-depth=3 portion includes three levels deeper into the directory. Next, we're using a pipeline | to sort the output by the -h (human readable output) values and list them in -r reverse. Finally, we use head to include only the first part of the files.
  • Page :
  • 1
There are no replies made for this post yet.
Submit Your Response

Sharing your current location while posting a new question allow viewers to identify the location you are located.

© 2025 hostsocial.io