Get free disk space under unix with df command
def freespace(device=".") lines = %x(df -k #{device}).split("\n") n = lines.last.split[1].to_i * 1024 end puts freespace("/tmp")