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

Post Reply
User avatar
isscbta
Team Member
Posts: 154
Joined: Mon Jul 19, 2021 1:41 am
Has thanked: 18 times
Been thanked: 3 times

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:
User avatar
nicolasmru
Posts: 2
Joined: Tue Sep 02, 2025 6:49 pm

Here command with formatted size for human being:

Code: Select all

du -hs /home/student-fr10/web/domain4.fr/public_html/* | sort -rh | head -10

Code: Select all

78M     /home/student-fr10/web/domain4.fr/public_html/wp-content
56M     /home/student-fr10/web/domain4.fr/public_html/wp-includes
11M     /home/student-fr10/web/domain4.fr/public_html/wp-admin
52K     /home/student-fr10/web/domain4.fr/public_html/wp-login.php
36K     /home/student-fr10/web/domain4.fr/public_html/wp-signup.php
32K     /home/student-fr10/web/domain4.fr/public_html/wp-settings.php
20K     /home/student-fr10/web/domain4.fr/public_html/license.txt
12K     /home/student-fr10/web/domain4.fr/public_html/wp-mail.php
8.0K    /home/student-fr10/web/domain4.fr/public_html/wp-trackback.php
8.0K    /home/student-fr10/web/domain4.fr/public_html/wp-cron.php
And if you want to go deeper for wp-content folder:

Code: Select all

du -hs /home/student-fr10/web/domain4.fr/public_html/wp-content/* | sort -rh | head -10

Code: Select all

53M     /home/student-fr10/web/domain4.fr/public_html/wp-content/themes
26M     /home/student-fr10/web/domain4.fr/public_html/wp-content/plugins
68K     /home/student-fr10/web/domain4.fr/public_html/wp-content/uploads
8.0K    /home/student-fr10/web/domain4.fr/public_html/wp-content/upgrade-temp-backup
4.0K    /home/student-fr10/web/domain4.fr/public_html/wp-content/upgrade
4.0K    /home/student-fr10/web/domain4.fr/public_html/wp-content/index.php
Post Reply