Skip to content

Instantly share code, notes, and snippets.

@uprush
Created January 8, 2014 07:56
Show Gist options
  • Save uprush/8313317 to your computer and use it in GitHub Desktop.
Save uprush/8313317 to your computer and use it in GitHub Desktop.
Pretty print HDFS usage
# Pretty print HDFS usage
include Java
import org.apache.hadoop.util.StringUtils
path = ARGV[0]
dus = %x[$HADOOP_HOME/bin/hadoop fs -dus #{path}]
splited = dus.split
byteDesc = StringUtils.byteDesc(splited[0].to_i)
puts splited[1] + "\t" + byteDesc
# Usage
# $HBASE_HOME/bin/hbase org.jruby.Main pdus.rb /hbase
# => /hbase 11.96 GB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment