How do I find the largest 10 files in a given directory, with Perl or Bash?
EDIT:
Steps to find Largest directories in Linuxdu command : Estimate file space usage. sort command : Sort lines of text files or given input data. head command : Output the first part of files i.e. to display first 10 largest file. find command : Search file.
head command -10 OR -n 10 option : It shows the first 10 lines.
This prints the 10 largest files recursively from current directory.
find . -type f -printf "%s %p\n" | sort -nr | awk '{print $2}' | head -10
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With