Visualize disk usage with d3.js and ZSH function

  22 Aug 2014

A standard UNIX du program that is usually used to check and provide information of disk usage (files and directories) usually look like this:

du output

Today, I take some time to tweak how to present the information in a bit more interesting, like the below figure:

duv output

I chose using the following tools (d3.js in presentation part and zsh function to create a commmand alias). This is quite a trivial task but it is a good playground.

First, I created a directory named ~/.duv in my home directory to contain this index.html file.

You could just simply download the file with cd ~/.duv; curl -O

Then, curl >> ~/.zshrc

Or append the following content in your ~/.zshrc

Reload your changed in zsh for current running shell, by doing so: source ~/.zshrc

And this was it. You can simply use duv command and get visualized report instead of du -s *

comments powered by Disqus