12

Is there a nice alternative for this? I always use

du -shc *

to check the size of all files and folders in the current directory. But it would be nice to have a colored and nicely formatted view (for example like dfc for viewing the sizes of partitions).

slm
  • 369,824
rubo77
  • 28,966
  • I see there is a package from here.http://www.cyberciti.biz/tips/unix-linux-bsd-pydf-command-in-colours.html – Ramesh Aug 22 '14 at 20:14
  • 1
    http://linuxaria.com/article/5-ways-to-check-your-disk-usage-on-linux – Ramesh Aug 22 '14 at 20:18
  • This might also provide some idea into writing a script to wrap df/du output... –  Aug 22 '14 at 20:37
  • @Ramesh: your first link to pydf is equivalent to dfc, which is nice too, but that was not the question – rubo77 Aug 22 '14 at 20:39
  • @rubo77, yeah. That's why I provided the second link which had all the tools. If you had checked that one, it has ncdu as well. – Ramesh Aug 22 '14 at 20:43
  • 1
    Related: http://unix.stackexchange.com/questions/73818/in-centos-how-to-find-free-disk-space/73834#73834 – slm Aug 22 '14 at 21:08
  • I've been searching for a bit and am not finding anything comparable. If you're desperate I'd think of constructing a filter myself in Bash or or higher level language to colorize the output as desired. – slm Aug 22 '14 at 21:58
  • Console or GUI? Just a full view or something interactive where you can e.g. collapse and expand a subtree? – Gilles 'SO- stop being evil' Aug 22 '14 at 23:12
  • console. gt5 or ncdu are already really nice, if they only could be called with less interaction: I don't like that they start a new screen (that you have to leave pressing q) – rubo77 Aug 22 '14 at 23:21

5 Answers5

13

This is not coloured, but also really nicely ordered by size and visualized:

ncdu - NCurses Disk Usage

apt-get install ncdu

SYNOPSIS
ncdu [options] dir

DESCRIPTION
ncdu (NCurses Disk Usage) is a curses-based version of the well-known 'du', and provides a fast way to see what directories are using your disk space.

Output looks like this:

ncdu 1.10 ~ Use the arrow keys to navigate, press ? for help                       
--- /var/www/freifunk -------------------------------------------------------------
  470,7MiB [##########] /firmware                                                  
  240,8MiB [#####     ] /ffki-firmware
  157,9MiB [###       ] /gluon-alfred-vis
  102,6MiB [##        ]  chaosradio_162.mp3
  100,2MiB [##        ] /ffki-startseite
   99,6MiB [##        ] /ffki-startseite-origin
   72,3MiB [#         ] /startseite
   66,2MiB [#         ] /metameute-startseite
   35,2MiB [          ] /startseite_site
   11,9MiB [          ] /jungebuehne

ncdu is nice, cause you can install it via apt on debian. Only colors would be cool and an export function that does not use the whole screen.

gt5 - a diff-capable 'du-browser'

gt5 looks quite the same, and there are some colors, but they have no meaning (only all files and folders are green). gt5 is also available via apt:

sudo apt-get install gt5
rubo77
  • 28,966
5

duf

https://raw.githubusercontent.com/muesli/duf/master/duf.png

Features

  • User-friendly, colorful output
  • Adjusts to your terminal's width
  • Sort the results according to your needs
  • Groups & filters devices
  • Can conveniently output JSON

Installation

Packages

  • Arch Linux: duf
  • macOS:
    • with Homebrew: brew install muesli/homebrew-tap/duf
    • with MacPorts: sudo port selfupdate && sudo port install duf
  • Nix: nix-env -iA nixpkgs.duf
  • Packages in Debian & RPM formats

Binaries

  • This is a nice alternative for dfcbut dowsn't show the size of subfolders in a certain directory, like I asked. Or is there a duf command, that would do that? – rubo77 Sep 30 '20 at 08:06
3

I see the below information from here.

cdu (for Color du) is a perl script which call du and display a pretty histogram with optional colors which allow to imediatly see the directories which take disk space.

With no arguments, cdu reports the disk space for all subdirectories of the current directory. With only one directory argument, cdu reports the disk space for all subdirectories of the given directory. You can also call du with no predefined options. For more documentation about available options, see the manpage below.

Ramesh
  • 39,297
2

gdu

enter image description here

tl;dr Similar interface and functionality with ncdu, but much faster.

Gdu is a pretty fast disk usage analyzer written in Go. Gdu is intended primarily for SSD disks where it can fully utilize parallel processing. However HDDs work as well, but the performance gain is not so huge.

There are static linked binaries for all major operating systems and packages for ArchLinux, Debian, RedHat/Fedora, Mac OSX (brew) available as well. See https://github.com/dundee/gdu/releases

0

Thanks to Ramesh for the cdu link

I've created an oneliner to run cdu without installing it:

export CDUVER=$(curl -s http://arsunik.free.fr/prog/cdu.html | grep -Po '(?<=cdu-)\d+\.\d+' | head -1); curl -s http://arsunik.free.fr/pkg/cdu-$CDUVER.tar.gz | gunzip | tar x -O cdu-$CDUVER/cdu.pl | perl

Explanation

  • curl -s http://arsunik.free.fr/prog/cdu.html | grep -Po '(?<=cdu-)\d+\.\d+' | head -1

returns current cdu version from the official website

  • export CDUVER=$(curl -s http://arsunik.free.fr/prog/cdu.html | grep -Po '(?<=cdu-)\d+\.\d+' | head -1); curl -s http://arsunik.free.fr/pkg/cdu-$CDUVER.tar.gz | gunzip | tar x -O cdu-$CDUVER/cdu.pl | perl

declares an actual cdu version in CDUVER variable

  • curl -s http://arsunik.free.fr/pkg/cdu-$CDUVER.tar.gz

downloads tar.gz package from the official website

  • curl -s http://arsunik.free.fr/pkg/cdu-$CDUVER.tar.gz | gunzip | tar x -O cdu-$CDUVER/cdu.pl

extracts only cdu.pl to stdout to send it to perl

  • curl -s http://arsunik.free.fr/pkg/cdu-$CDUVER.tar.gz | gunzip | tar x -O cdu-$CDUVER/cdu.pl | perl

runs extracted script with perl

Yasen
  • 101