2025-03-07[Fri]23:14 🦓 read that
2025-03-07[Fri]07:21 Greg Wooledge wrote
That's conceptually similar to the little program that I wrote, which you can get from <https://wooledge.org/~greg/ds>. It's in perl.

Wow! Looks backward compatible with perl4.036 - what do i need to write to make ds installable as sudo aptitude install ds?
/usr/share/man/man1/ds.1 and /usr/share/src/ds/DEBIAN/control?

zoom                               705531
brave-browser                      399770
google-chrome-stable               365765
firefox-esr                        251227

(debian)czyborra@localhost:/usr/bin$ cd /usr/bin &&
 curl https://wooledge.org/~greg/ds | sudo tee ds &&
 sudo chmod a=rx ds && ds | head -16 | cat -n
  % Total    % Received % Xferd  Average Speed   Time     Time     Time  Current
                                 Dload  Upload   Total    Spent    Left  Speed
100   850  100   850    0     0   1407      0 --:--:-- --:--:-- -:--:--  1404
#!/usr/bin/perl -w

# Print the installed-size of Debian packages, in descending order.
# Skip over anything that's in state "deinstall" ("rc" on dpkg -l).

my %pkgs = ();
my %skip = ();
my $pkg = "";
my $size = 0;
my $maxlen = 0;
open (S, "< /var/lib/dpkg/status") || die "cannot open /var/lib/dpkg/status";
while (<S>) {
        if (/^Package:/) {
                (undef, $pkg) = split;
                $skip{$pkg} = 0;
                $maxlen = length $pkg if (length $pkg > $maxlen);
        } elsif (/^Installed-Size:/ && !$skip{$pkg}) {
                (undef, $size) = split;
                die "internal error: Installed-Size: without Package:" unless
                        defined($pkg);
                $pkgs{$pkg} = $size;
        } elsif (/^Status: deinstall/) {
                $skip{$pkg} = 1;
        }
}

@sorted = sort { $pkgs{$b} <=> $pkgs{$a} } keys %pkgs;
foreach (@sorted) {
        next unless (defined($_) && defined($pkgs{$_}));
        printf "%-*s %6d\n", $maxlen, $_, $pkgs{$_};
}
     1  libperl5.28                        26270
     2  cpp-8                              25571
     3  iso-codes                          19418
     4  libc6-dev                          18937
     5  perl-modules-5.28                  18894
     6  coreutils                          15719
     7  systemd                            13484
     8  binutils-common                    13000
     9  guile-2.0-libs                     11541
    10  libc6                              11538
    11  binutils-x86-64-linux-gnu          11537
    12  perl-base                          10148
    13  aptitude-common                    10089
    14  python3.7-minimal                   9652
    15  udev                                8289
    16  libpython3.7-stdlib                 8143

Reply via email to