Sys::S...skUsage(3pm)

πŸ“¦
version 0.66 Β· 6 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– Sys::Statistics::Linux::DiskUsage πŸ’–

okay bestie, so this is a page from the User Contributed Perl Documentation and it's literally all about peeking at your disk usage on Linux. it's giving main character energy for your filesystem. let's go ✨


🌸 NAME 🌸

Sys::Statistics::Linux::DiskUsage β€” collect linux disk usage. that's it, that's the whole job, and she does it beautifully πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

use Sys::Statistics::Linux::DiskUsage;

my $lxs  = new Sys::Statistics::Linux::DiskUsage;
my $stat = $lxs->get;

boom. two lines and you're already getting stats. iconic behavior tbh.


🌈 DESCRIPTION 🌈

Sys::Statistics::Linux::DiskUsage gathers the disk usage with the command df. no cap, that's the whole vibe β€” she shells out to df and hands you the tea πŸ«–

if you want the full lore, go read the documentation of the front-end module Sys::Statistics::Linux. iykyk.


πŸ‘‘ DISK USAGE INFORMATIONS πŸ‘‘

so this info is generated by /bin/df -kP. here's what you're getting back:

  • total β€” the total size of the disk πŸ’–
  • usage β€” the used disk space in kilobytes πŸ“
  • free β€” the free disk space in kilobytes πŸ•ŠοΈ
  • usageper β€” the used disk space in percent πŸ“
  • mountpoint β€” the mount point of the disk 🧚

✨ GLOBAL VARS ✨

so like… if you wanna change the path or the arguments for df, you absolutely can, bestie. just poke these variables:

$Sys::Statistics::Linux::DiskUsage::DF_PATH = '/bin';
$Sys::Statistics::Linux::DiskUsage::DF_CMD  = 'df -akP';

Example:

use Sys::Statistics::Linux;
use Sys::Statistics::Linux::DiskUsage;
$Sys::Statistics::Linux::DiskUsage::DF_CMD = 'df -akP';

my $sys  = Sys::Statistics::Linux->new(diskusage => 1);
my $disk = $sys->get;

custom df command? we love to see it. glow up πŸ’…


πŸ’€ METHODS πŸ’€

πŸ’œ new()

call new() to create a new object. it's that simple, no drama:

my $lxs = Sys::Statistics::Linux::DiskUsage->new;

and yes, you can also set the path to df. very customizable of her:

Sys::Statistics::Linux::DiskUsage->new(
   cmd => {
       # This is the default
       path => '/bin',
       df   => 'df -kP 2>/dev/null',
   }
);

πŸ’œ get()

call get() to get the statistics. get() returns the statistics as a hash reference. so like, you get a whole hash ref back, go wild with it πŸŽ€

my $stat = $lxs->get;

🌟 EXPORTS 🌟

no exports. none. zero. she's self-contained and unbothered πŸ’…


🫢 SEE ALSO 🫢

df(1) β€” go say hi to the OG πŸ‘‘


😭 REPORTING BUGS 😭

please report all bugs to <jschulz.cpan(at)bloonix.de>. don't be shy, she wants to know πŸ›


πŸ‘Έ AUTHOR πŸ‘Έ

Jonny Schulz <jschulz.cpan(at)bloonix.de>. periodt. πŸ’–


Copyright (c) 2006, 2007 by Jonny Schulz. All rights reserved.

this program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. slay ✨


fr fr that's the whole page, no cap 🌸

okay so final vibes check: this whole thing is perl v5.36.0, dated 2022-11-19, and yeah the header got a little cut off up top but you know exactly what it is. go check your disks bestie, ily πŸ’–πŸŒˆπŸ¦‹

πŸ“¦ where this page comes from