#!/usr/bin/env perl # Get sorted list files my @sortedFiles = `du -s * | sort -nr`; foreach my $file (@sortedFiles) { # Get just the file name, remove size my @fileName = split("\t", $file); my $realFileName = $fileName[1]; chomp($realFileName); # Print the size of the file and the file size my $fileSortedPrintCmd = "du -s \"$realFileName\""; print `$fileSortedPrintCmd`; }