How can I find total disk space occupie开发者_JS百科d by a certain user, say located in /home/Mary? What function is available in Perl to know this?
Perl has Filesys::DiskUsage for that. There is just one downside, it doesn't take the size of the directories while counting. Only the size of the files.
use Filesys::DiskUsage qw/du/;
$size = du ( { 'sector-size' => 1024 } , { 'human-readable' => 1 } , qw%/home/Mary% );
print "Total size: $size\n";
if Perl is not a must, you can use shell commands
find /home -user "Mary" -type f -printf "%s\n" | awk '{sum+=$1}END{print sum" bytes"}'
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论