Here is my way of doing it with Perl.
#!/usr/bin/perl printf "Generating overview over user account storage amounts.\n\n"; opendir(DIR, '/home/'); @dirs = readdir(DIR); closedir(DIR); foreach $dir (@dirs) { if($dir ne '..' && $dir ne '.') { $dir_size = `du -h --max-depth=0 /home/$dir`; $dir_size =~ s/\s.*//; printf "$dir : $dir_size"; } } printf "\n";
To show through a website you can use something like this.
#!/usr/bin/perl
$output = `cat /home/myuser/scripts/thescript.pl`;
print "Content-Type: text/html\n\n";
print '<pre>'. $output .'</pre>';
Here is how the output looks like
root@Mybox adminscripts # ./userstorage
Generating overview over user account storage amounts.
User1 : 608K
User2 : 28M
User4 : 300M
MyUser : 400K
root@Mybox adminscripts #