Checking Disk Usage (*nix)
Brazenly lifted from
http://kb.mediatemple.net/questions/916/Managing+your+disk+usage
View Disk Space from SSH
To check your Total Disk Usage for your entire server via SSH you can type the following:
df -h
The first column displayed is the device. The next three columns show the total size, the amount used, and the amount available.
Filesystem Size Used Avail Use% Mounted on /dev/vzfs 20G 658M 19G 4% / simfs 20G 658M 19G 4% /tmp simfs 20G 658M 19G 4% /var/tmp
TIP:
- You can use -m for megabytes
- You can use -k for kilobytes
Another useful command is du. Running this command will list all directories with their filesize from your current directory.
du
A good example of using this command would be to view the sizes of your site's directories:
du -m /var/www/vhosts/mt-example.com/httpdocs
To show the total directory size of the current directory you can run the following command:
du -csh
To show directory sizes as a listing you can use the command:
du -sh *
Searching for Large Files
You can use the following command to search for files over 10MB in size:
NOTE:
To adjust the size of your search replace +10000k with the size you desired, such as the following:
- 50MB: +50000k
- 100MB: +100000k
- 500MB: +500000k
find / -type f -size +10000k -exec ls -lh {} \; | awk '{ print $5 ": " $9 }' |sort -n
