This command shows the list of sub-folders of the current folder with their size:
du -h --max-depth=1
This command shows the list of sub-folders of a specific folder with their size:
du -h --max-depth=1 /var
To get the disk size, run this command:
df -h
To remember between df
and du
, here is a tip:
df
: Disk Freedu
: Disk Usage
Sometimes you see the outputs of these commands are different. One situation that I usually see is I get the disk full notification, while du
tells me I have some GB to use.
After looking for a while, I notice that it's the Apache issue. Apache keeps its log in the memory, and that makes the df
fails. Restarting Apache fixes the bug:
service apache2 restart
This solution is provided in StackOverflow.
One important thing to remember is when you see disk is full, try to remove Apache's log first (in /var/log/apache2
). It usually takes up to GB!
Leave a Reply