- df
Reporting file system diskspace usage (df)
examples/applications/diskspace.pl
#!/usr/bin/env perl use strict; use warnings; use Filesys::DfPortable qw(dfportable); #my $df = dfportable("/", 1024 * 1024 * 1024); my $df = dfportable("/", 1024); print "Total Size: $df->{blocks} K\n"; print "Available: $df->{bfree} K\n"; print "Used: $df->{bused} K\n"; print "Percent Full: $df->{per} %\n"; print "Total available to me: $df->{bavail} K\n";
$ perl diskspace.pl ; df / Total Size: 48062440 K Available: 38720692 K Used: 9341748 K Percent Full: 20 % Total available to me: 36279216 K Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda1 48062440 9341748 36279216 21% /