Analyze disk space usage on linux servers
December 14, 2016
I have been using du
and df
with a bit of other bash
scripts to gather disk space usage information on my linux servers. I need to clean up disk space often specially when I am reaching 70% usage just to be sure I will really need that next upgrade. On Windows we have WinDirStat
and for KDE there is KDirStat
(same tool ported to Windows) but for headless Servers GUI is not an option.
I have come accross the command line tool called ncdu
that can be installed from the regular Repository. Just yum
or apt-get
this tool.
You can get per directory usage sorted by space taken like this
ncdu <root-path-to-use>
You can even hit d
to delete directories and files recursively. None of that xargs
weirdness to handle large number of files. It takes care of that.
Give it a spin.