I'm looking for a linux alternative to WinDirStat. I would like to know what is taking up space on my hard drives.
A program that works on console and doesn't require a UI is preferred .
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
Based on your issues in installing ncdu my recommendation would be to use
sort on together.
du /home | sort -rn(will search all files/directories under /home and sort them by largest to smallest.
du -h /home | sort -rh(same but will show it in MB/KB/etc) - Note this requires coreutils 7.5 or newer (
sort --versionto check)
You can replace /home with any directory of your choice.
If you want a command-line tool, I prefer ncdu, an ncurses version of
du. It scans the disk (or a given folder) and then shows the top-level space usages; you can select a given directory to get the corresponding summary for that directory, and go back without needing to reanalyze:
If you're ok with a GUI program, Filelight is the closest thing to WinDirStat I've found; it shows a graphical view of space consumption:
ncdu, Filelight lets you select a given directory to get the breakdown for that directory
You should be aware that WinDirStat is actually a port of KDirStat, which is a Linux/KDE program. So, if you are looking for a Linux alternative to WinDirStat, you certainly should take a look at KDirStat. It is already packaged in most distros, just install it.
Another alternative is FileLight, already cited by Michael Mrozek, and the Konqueror plugin
fsview (you can run it standalone from the command-line).
Another GUI program is: baobab
I prefer the following command line:
$ du -s -m -x * | sort -n
Breaking it down,
du shows disk usage;
-s says print the total for each argument (each item in the current directory),
-m says show the size in Megabytes. This makes it easier for sort to work; sort doesn't really understand the
-h output. The
-x ignores other filesystems; this is useful when trying to find space hogs in
/var/spool/foo is a different filesystem.
If you looked at the about screen on windirstat it showed you that it's based on kdirstat.
You could also try GD Map, another GUI tool based on treemaps.
xdiskusage is very flexible, lightweight with very lean dependencies, easy to compile..
It shows a tree left-to-right that you can navigate with mouse or arrow keys, zoom in (click or enter), hide some parts for a better view, change sort order, number of colors etc with keys or context menu.
It's so lighweight that you can use it on a remote SSH link with good performance. In this case I recommend
-q command line option to disable the progress bar that appears while files are walked.
You can also optionally run
du yourself beforehand.
One situation is a remote filesystem which is full or near-full. On that system run
du -ak | gzip >log_of_disk_usage.txt.gz, fetch the output and run
gzip -dc log_of_disk_usage.txt.gz | xdiskusage -aq locally.
ssh myremotesystem "cd /filesystem_near_full/ ; du -ak | gzip" > log_of_disk_usage.txt.gz to store the result locally without writing anything remotely.
xdiskusage does not offer to modify the filesystem (like move to trash, etc) but you can copy a path to clipboard and paste that into a file manager, terminal etc.
I have recently used command line tool (CLI, not TUI): http://zevv.nl/play/code/philesight/
It produces a PNG file which you can view somewhere else. It also has a CGI script.
Most likely you are not limited to text mode at your local workstation, so it should be appropriate.
Duc (https://duc.zevv.nl/) will work from the command line.
It can be installed and used like this in Debian 9:
# apt install duc # duc index / # duc graph /
NOTE: Duc is the replacement for the tool that @OCTAGRAM mentioned in his answer.