Hacker News new | past | comments | ask | show | jobs | submit login
Duf: Disk Usage/Free Utility (github.com/muesli)
191 points by kiyanwang 33 days ago | hide | past | favorite | 43 comments

For a CLI alternative to manually running `du -sh *` recursively to try and find which directory is taking up your space I recommend `ncdu`.

I'm pretty sure there was a similar CLI app better than `ncdu` but I don't recall it right now.

There is also Duc: https://duc.zevv.nl/. It has a both a Tui and a Gui, but can also do nifty CGI things (shameless plug)

I love duc but man is it nearly impossible to build.

author here. please drop your grievances in a github issue t see if we can help you out, because building should be a simple as "configure && make && make install"

Seconded. Duc is awesome. Thanks for your great work on it!

baobab is a nice GUI alternative that has similar graphs to duc, except I can never remember the name =P (fortunately it shows up when I search the "start menu" for "usage")


I use `ncdu --color dark` for pretty colors.

i have an alias that shows each folder in the current directory humanized... might have been slightly modified from one where i got it to work on macos. duf == disk utilization folders. a caveat is that it can be a bit slow if there are a lot of files/subdirectories.

alias duf='du -sk * | sort -n | perl -ne '\''($s,$f)=split(m{\t});for (qw(K M G)) {if($s<1024) {printf("%.1f",$s);print "$_\t$f"; last};$s=$s/1024}'\'

What's the difference vs:

  du --max-depth=1 -h | gsort -h

for one it works on osx... i don't know about the output. that said there are many ways to do something

Another option is

du | sort -n

(I've got it aliased to "dun".)

Or human readable. This is what I usually use:

    du -sh * | sort -h

Wow thanks for sort -h (sorting by human representation, 2M>150k) gnu tools never cease to amaze me.

Thanks! I've got a new alias cut out for me: duh! :-)

`rclone ncdu` for cloud storages.

I wonder if this entire thing could be built into 'glances' as an alternate pane view.


Is there anything similar to glances that's native, super light. Don't have python in all production server and I wonder how weighty it would be when things are getting haywire .. or am I wrong and glances is lightweight enough?

Try bashtop

I dont prefer glances because of its dependencies of python and i really avoid installing big dependencies unless I feel its required for most of the other packages/use cases.

It seems bashtop is being deprecated in favour of a python based program for ease of maintenance and it actually uses less cpu. Makes sense if it's doing a lot of work in bash.

Filelight is convenient if you prefer a GUI for this sort of exploration.


I personally have used k4dirstat, but while finding it's webpage I found out that there's a more modern fork/recreation called qdirstat that doesn't need kde either called qdirstat. https://github.com/shundhammer/qdirstat

There's also windirstat for windows.


Disk Inventory X for MacOS: http://www.derlien.com/

I have been using Spacesniffer [0] for over a decade now. But glad to see some new attempts in the space for disk usage.

[0] http://www.uderzo.it/main_products/space_sniffer/

While I love the animation and zooming in and out of folder, I found that WizTree [0] is by far the fastest reading the file structure and sizes. Neither SpaceSniffer nor WinDirStat can compare to its speed.

[0] https://wiztreefree.com/

+1 for spacesniffer (and the old spacemonger)

I wish there were more disk space analyzer like it that use rectangular blocks of space rather than circles which I find harder to read how much space they actually take on disk.

From glancing at the source code I believe this uses the same algorithm as df from coreutils. It outputs pretty much useless data for btrfs, which needs to be handled differently. See:

  $ btrfs fi df
  $ btrfs fi us

Your program looks nice for a text-based UI. However, I think existing graphical tools are more powerful, especially when displaying a treemap visualization. Examples: https://en.wikipedia.org/wiki/Disk_utility#Disk_space_analyz...

I like it! Might have a go at rewriting something like this in Rust as an exercise.

Already done, (un)fortunately:


Duf seems close to `df` while dust seems closer to `du`.

Sounds like fun! Drop me a message if you get it going and want a collaborator.

Was just thinking the same!

Why? This is a real question. Is it because of the pleasure of writing rust, getting rid of go? Speed? Size?

Duf doesn't understand MacOS APFS volumes. I have two such volumes sharing my primary SSD. For those accustomed to more primitive file systems, one doesn't have to arbitrarily divide a drive into volumes of separate fixed sizes. Volumes on an APFS drive can share pooled free space.

My two volumes sharing a drive have separate percentages that look quite healthy, but their combined percentage reveals that I am perilously short on space. Duf doesn't know to combine these percentages. DaisyDisk (a wonderful GUI app for managing MacOS disk space) makes the problem clear.

This issue would be encountered with ZFS too.

I’ll plug my own fast OSX scanner, though “storage management” got better recently (or I hadn’t noticed when using it initially).


Haven’t tried it yet but the —hide-network option sounds really useful to me. The number of times I’ve been looking for free space on local file system when I have some massive ntfs remote file system mounted and trying to get that excluded from other utilities is a massive pain in the butt.

Looking for ideas to build http://dfdu.com. What should be there to ease the usage of these two commands? 1. Include the tools listed here 2. Add command usage examples

pip install [ohmu] for a nice ascii treemap.

[ohmu]: https://gitlab.com/paul-nechifor/ohmu

Does this utility accept directories as parameters? Couldn't see an example in the readme and the screenshot only shows the full-screen disk view.

i.e duf directory

xdiskusage has been my go-to when using a gui.

Package info from Debian: https://packages.debian.org/sid/x11/xdiskusage

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact