Disk Usage

Helpful info: http://www.codecoffee.com/tipsforlinux/articles/22.html

http://www.makeuseof.com/tag/how-to-analyze-your-disk-usage-pattern-in-linux/

http://www.google.com/#sclient=psy&hl=en&source=hp&q=linux+disk+usage&aq=1&aqi=g5&aql=&oq=linux+disk+&pbx=1&bav=on.2,or.r_gc.r_pw.&fp=ae988db1847db761&biw=1280&bih=872

Command line

If you are geeky enough, the easiest and fastest way is to use the ‘df’ command in your terminal. Simply type

$ df -h

in the terminal and it will show the disk usage percentage of your hard disk.

$ du -a -m /app 2>/dev/null | egrep '.*[123456789]{3}\.[123456789]{2}.*/.*' | less
output
118.69 /app/Apache22/0/logs
162.93 /app/Apache22/0
162.93 /app/Apache22
114.83 /app/Tomcat55/0/reference
367.62 /app/Tomcat55/0
367.62 /app/Tomcat55
114.82 /app/vpc/activemq-4.1.1/activemq-data
136.45 /app/vpc/activemq-4.1.1
4894.78 /app/vpc/event-normalizer-service/nohup.out
739.71 /app/vpc/sxg-event-normalizer-service-delete-me/lib
739.71 /app/vpc/sxg-event-normalizer-service-delete-me
6612.81 /app

Java 7 provicdes a solution:

http://stackoverflow.com/questions/1051295/how-to-find-how-much-disk-space-is-left-using-java

NumberFormat nf = NumberFormat.getNumberInstance();
for (Path root : FileSystems.getDefault().getRootDirectories())
{
System.out.print(root + ": ");

try
{
FileStore store = Files.getFileStore(root);
System.out.println("available=" + nf.format(store.getUsableSpace()) + ", total=" + nf.format(store.getTotalSpace()));
}
catch (FileSystemException e)
{
System.out.println("error querying space: " + e.toString());
}
}


Tag Cloud