Created
January 8, 2014 07:56
-
-
Save uprush/8313317 to your computer and use it in GitHub Desktop.
Pretty print HDFS usage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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