← Back to Notes

joshua stein via twitter.com/jcs - Apr 20 2021 22:01:23

I needed to monitor how far `gzip -d dump.sql.gz` was, long after I started it (without pv):

$ ruby -e 'loop do n = `fstat -o dump.sql.gz`.split("\n").last.split(" ")[8].split(":").map(&:to_i); printf("%0.2f%%\n", (n[1] / n[0].to_f) * 100.0); sleep 1; end'
50.68%
50.71%