admin's blog

Find folder sizes on Ubuntu

Scenario

I needed to find out the amount of data stored in a group of folders. Each of the folders contains a web site, and I want to track the sites on-disk usage statistics.

Prerequisites

Linux system running bash.

du binary (typically induced in linux base install or busybox.

Tested on Ubuntu 12.

Command

du -shc *

Explanation:
s ..... Summary
h ..... Human Readable. K, M, and G for sizes.
c ..... Summary or Total
* ..... All files or folders in the current directory.

Add SWAP disk on Amazon EC2 Ubuntu servers

Scenario

My Ubuntu web servers were killing processes due to low free memory. I would prefer them to slow down than to kill processes. So I added SWAP disk space that is not setup by default in the EC2 instances.

Prerequisites

Amazon AWS EC2 Ubuntu 11 or 12 instance.

This may work on other Linux versions, but I have only used it on Ubuntu.