#!/usr/bin/perl # find out what's filling up a partition # Mikel Ward require 5.6.0; use Getopt::Long qw(:config no_ignore_case bundling); my @fileinfo; # [path, size] my @dirinfo; our %dirsize; # path => total size of files at that level our %dirfileinfo; our %seen; # $seen{$dev . $inode} = 1 if seen, else undef # tracks which files were already seen to avoid counting twice or going into a loop our $pathwidth; # maximum width to use for printing a file name our $apparentsize = 0; our $debug = 0; our $groupbydir = 0; our $minsize = 0; our $quiet = 0; # it's a string, so remember that \\ becomes \ #our $pathskip = "^/proc\\b|^/dev\\b|^/sys\\b|^/lib/udev\\b|^/net\\b|\\bfd/\\d+\\b|\\bdosdevices\\b|\\b\\.gvfs\\b"; our $pathskip; our $maxage; our $dirsonly = 0; our $singledevice = 1; our $sizeunits = "MB"; our $subdirsize = 0; our $showdirtotals = 1; # TODO try to get the terminal width (can't use $ENV{'TERM'} because $TERM is not exported) our $verbose = 0; our $width; use constant BLKSIZE => 512; sub usage { print STDERR " Usage: diskuse Options:\ -a