How to find a folder which consumes a large amount of memory

Post Reply
User avatar
isscbta
Posts: 39
Joined: Mon Jul 19, 2021 1:41 am

In your SSH, as root, run:

Code: Select all

du --max-depth=1 -c -m -x /home/ | sort -n
Output:
1 /home/useracc1
1 /home/useracc2
2 /home/admin
97 /home/useracc3
613 /home/useracc4
955 /home/useracc5
4826 /home/useracc6
9771 /home/useracc7
39447 /home/webi
62948 /home/
62948 total
From this, we can see that /home/webi is the largest directory. Let's now inspect that deeper, by running next command:

Code: Select all

du --max-depth=1 -c -m -x /home/webi/ | sort -n
Output:
1 /home/webi/mail
1 /home/webi/tmp
2 /home/webi/conf
39434 /home/webi/web
39436 /home/webi/
39436 total
Proceeding further with inspecting directories:

Code: Select all

du --max-depth=1 -c -m -x /home/webi/web/ | sort -n
Output:
777 /home/webi/web/domain1.com
868 /home/webi/web/domain2.com
975 /home/webi/web/domain3.com
32552 /home/webi/web/domain4.com
39418 /home/webi/web/
39418 total
From the previous step, we see that /domain4.com was the largest one, so the next step is to inspect that directory further:

Code: Select all

du --max-depth=1 -c -m -x /home/webi/web/domain4.com/public_html/ | sort -n
Output:
10 /home/webi/web/domain4.com/public_html/wp-admin
40 /home/webi/web/domain4.com/public_html/wp-includes
780 /home/webi/web/domain4.com/public_html/wp-content
32536 /home/webi/web/domain4.com/public_html/
32536 total
At the end, we see that largest files are stored in /public_html folder, and not in any further subdirectories.

Tags:
Post Reply